Splanchnology is defined as the study of viscera, known as the organs located in the thoracic, abdominal and pelvic cavities of the body, and are associated with the pleura and the peritoneum. There are four major systems identified in the viscera according to their functions, and they are the digestive system, the respiratory system, the urinary system, and the reproductive system. These four major systems are to process bodily intakes for metabolism such as nutrients and oxygen from surrounding to remove the wastes from the body. One last function of the viscera is to ensure the survival of the species as a whole by conducting the process of reproduction. Classification of the inner organs 1. On topography: the organs of the head, neck, thoracic and abdominal cavities. 2. On structure: parenchymal and tubular organs. 3. On function: the organs of the digestive, respiratory, urinary, reproductive, endocrine, immune systems. 4. On development: ectodermal, endodermal, mesodermal, mixed. The viscera can be divided into two categories based on their structure, tubular organs and nontubular organs or parenchymatous organs. Tubular organs. This type of organs can obtain a tubular shape or looks like a sack, due to the hollow space within them. Their wall will usually have three layers, ordered from interior to exterior: mucosa, muscular coat, and serosa or adventitia. Mucosa. The mucosa is the innermost layer, comprised of epithelium, lamina propria of the mucosa, and muscular of mucosa. The mucosa layer is responsible for protection, mucus secretion, and absorption. On the outside of mucosa, there is a layer, called submucosa. Since it is made of loose connective tissues, it has greater flexibility for better absorption and protection. In addition, there are blood vessels, nerves, and lymphatic tissues underlying the submucous layer. Muscular coat. The second coat is the muscular, consisting of longitudinal and circular muscular layers. Both layers of the muscular coat work in coordination to create motion to change the shape of the canal and thus enabling to move or rotate the foods inside (gastrointestinal tract). Functions of tunica muscularis are: • tone of the wall of the organ (tension); • possibility of conducting and mixing the mass inside this hollow organs; • contraction and relaxing of sphincters. 154 The outermost layer is the adventitia. It is composed of connective tissues. The organs in the abdominal and pelvic cavities will also be covered with a layer of mesothelium, known as the serosa. Functions of adventitia (tunica serosa): • fixation of organs; • conducting the blood vessels and nerves; • possibility of the movement of organs. Parenchymal organs. Parenchymal organs are the organs composed of the tissue which conducts the specific function of the organ (parenchyma). Parenchyma comprises the bulk of the organ. The stroma refers to the structural tissue – connective tissue, blood vessels, nerves, ducts. There are depressions or even slits on the surface of these organs called hilum or porta for blood vessels, nerves, and lymphatic tubules entering and leaving, e.g. the liver, the pancreas, the salivary glands, the gonads, and the kidney. However, the kidney and the gonads come from the mesoderm, instead of ectoderm of the alimentary canal. Body cavities. The body cavities are contained in the body trunk and, similar to the vertebrae, can be divided into three different zones: thoracic cavity, abdominal cavity and pelvic cavity. The thoracic and abdominal cavities communicate through three openings: the caval foramen, the oesophageal hiatus and aortic hiatus. The abdominal cavity remains connected to the pelvic cavity. 5.1 GENERAL INFORMATION ON THE DIGESTIVE SYSTEM (SYSTEMA DIGESTORIUM) The digestive (alimentary) system (systema digestorium) is a complex of organs whose function is in mechanical and chemical treatment of food, absorption of the treated nutrients, and excretion of undigested remnants of the food. The human alimentary canal is about 8–10 m long and is subdivided into the following parts: the cavity of the mouth, the pharynx, the oesophagus, the stomach, the small and large intestines. The upper three parts located in the head, neck, and chest maintains a relatively straight direction. In the pharynx the alimentary canal intersects with the respiratory tract. After the oesophagus passes through the diaphragm, the digestive tube dilates and thus forms the stomach; the next in order after the stomach, the small intestine, is in turn composed of the duodenum, jejunum, and ileum. The large intestine consists of the caecum (with the vermiform process), the colon (ascending, transverse, descending, and sigmoid), the rectum and, finally, the anal canal. The endodermal primary alimentary canal is subdivided into three parts: 1) anterior (the foregut); 2) middle part (the midgut) 3) the posterior part (hindgut). According to the different functions of the different segments of digestive tract, the three membranes of the primary alimentary canal, mucous, muscular, and connective-tissue, acquire different structure in the different parts of the canal.155 5.1.1 The oral cavity The mouth or oral cavity (cavitas oris) is divided into two parts, the vestibule of the mouth (vestibulum oris) and the cavity of the mouth proper (cavitas oris proprium). The vestibule of the mouth is the space bounded by the lips and cheeks externally and by the teeth and gingiva internally. By means of the opening of the mouth (rima oris), the vestibule opens into the external environment. The lips (labia oris) are fibres of the orbicular muscle of the mouth covered on the outside by the skin and lined inside with mucous membrane. At the angles of the oral fissure the lips come together by means of commissures (commissurae labiorum). The skin on the lips is continuous with the mucous membrane of the mouth; extending from the upper lip to the surface of the gum (gingiva) the mucous membrane forms on the midline a rather conspicuous fold, frenulum labii superioris. Frenulum labii inferioris is usually hardly noticeable. Epithelial villi (torus villosus) are seen in the region of the angle of the mouth and on the posterior margin of the vermillion border of the lip in the newborn; they help the infant to grasp and hold the mother’s nipple in the mouth during sucking. The cheeks (buccae) are similar to the lips in structure but instead of m. orbicularis oris, the buccinator muscle (m. buccinator) is located here. The fat lodged in the thickness of the cheeks (corpus adiposum buccae) is developed much better in the child than in an adult. Oral cavity proper (cavitas oris proprium) extends from the teeth anteriorly and laterally to the entry into the pharynx posteriorly. The oral cavity is bounded superiorly by the hard palate and the anterior part of the soft palate; the floor is formed by the diaphragm of the mouth (diaphragma oris) (the paired mylohyoid muscles) and is occupied by the tongue. When the mouth is closed, the tongue comes in contact with the palate so that the oral cavity becomes narrow slit-like space between them. The aperture by which the mouth communicates with the pharynx is called the oropharyngeal istmus, or fauces. The mucous membrane extending to the inferior surface of the tip of the tongue forms on the midline the frenulum of the tongue (frenulum linguae). On each side of the frenulum is a noticeable eminence, caruncula sublingualis, with the openings of the ducts of the submandibular and sublingual salivary glands. The sublingual fold (plica sublingualis) stretches on each side laterally and posteriorly of the sublingual caruncle; it is formed by the sublingual salivary gland located here. 5.1.2 The palate The palate (palatum) consists of two parts. Its anterior two thirds have a bony foundation, palatum osseum (the palatine process of the maxilla and the horizontal plate of the palatine bone); this is the hard palate (palatum durum). The posterior third, the soft palate (palatum molle) is a muscular structure with a fibrous foundation. During quiet breathing through the nose it hangs obliquely downward and separates the oral cavity from the pharynx. Raphe palati is seen on the midline of the palate. At the anterior end of the raphe is a row of transverse ridges (about six of them), plicae 156 palatinae transversum. The mucous membrane covering the inferior surface of the hard palate adheres closely to the periosteum by means of the fibrous tissue. The soft palate (palatum molle) is a duplication of the mucous membrane where the muscles are lodged together with a fibrous plate, the palatine aponeurosis, as well as glands. Its anterior margin is attached to the posterior edge of the hard palate, while the posterior part of the soft palate (velum palatinum) extends freely downward and to the back having a tongue-like projection, the uvula, on the midline. Laterally, the soft palate is continuous with folds, or arches. The anterior palatoglossal arch (arcus palatoglossus) passes to the lateral surface of the tongue, the posterior palatopharyngeal arch (arcus palatopharyngeus) stretches for some distance on the lateral wall of the pharynx. A space between the anterior and posterior arches is called tonsilar fossa (fossa tonsillaris) where palatine tonsil (tonsilla palatina) take place. Each palatine tonsil is an oval-shaped mass of lymphoid tissue. The nearest important blood vessel is the facial artery which sometimes comes very close to the pharyngeal wall at this level. The internal carotid artery passes at a distance of about 1 cm from the tonsil. The soft palate is composed of the following muscles (Fig. 97). 1. Palatopharyngeal muscle (m. palatopharyngeus) arises from the aponeurosis of the soft palate and from hamulus pterygoideus, descends to the pharynx in the thickness of arcus palatopharyngeus, and is inserted in the posterior margin of the thyroid cartilage and the pharyngeal wall. It pulls the velum palatinum downwards and the pharynx upwards, in that case the pharynx becomes shorter and presses the soft palate to the posterior pharyngeal wall. 2. Palatoglossus muscle (m. palatoglossus) arises on the inferior surface of the soft palate, descends in the thickness of arcus palatoglossus and is inserted on the side of the tongue where it is continuous with m. transversus linguae. It lowers velum palatinum and during this the movement both palatoglossal arches become tense and the opening of the fauces is narrowed. 3. Levator veli palatine muscle (m. levator veli palatini) originates on the inferior surface of the base of the skull and on the inferior surface of the cartilaginous part of the auditory tube and passes downwards and medially to the soft palate. It raises velum palatinum. 4. Tensor veli palatine muscle (m. tensor veli palatini) arises from spina ossis sphenoidalis and from the lateral surface of the membranous part of the auditory tube, descends vertically, its tendon curves around hamulus processus pterygoidei, turns medially almost at a right angle, and is inserted into the aponeurosis of the soft palate. It tenses velum palatinum in the transverse direction. 5. Uvulae muscle (m. uvulae) arises from spina nasalis posterior and from the aponeurosis of the soft palate; it is inserted in the uvula. It shortens the uvula. Fig. 97. Muscles of the soft palate: 1 – m. tensor veli palatini; 2 – m. levator veli palatini; 3 – hamulus pterygoideus; 4 – m. uvulae; 5 – m. palatopharyngeus; 6 – m. palatoglossus157 The uvula is present only in humans because it is necessary to create a condition of air-tightness in the oral cavity, preventing the jaw from hanging in the erect position of the body. The aperture by means of which the oral cavity communicates with the pharynx is called the fauces (fauces). It is bounded on the sides by the palatoglossal arches, above by the soft palate, and below by the back of the tongue. The palate controls two gates, the pharyngeal isthmus and the oropharyngeal isthmus. It can completely close them or can regulate their size according to requirements. Through these movements the soft palate plays an important role in chewing, swallowing, speech, coughing, sneezing. It isolates the mouth from the oropharynx during chewing, so that breathing is unaffected. It separates the nasopharynx from the oropharynx during swallowing, so that food does not enter the nose. By varying thee degree of closure of the pharyngeal isthmus the quality of voice can be modified and various consonants correctly pronounced. During sneezing, the blast of air is appropriately divided and directed through the nasal and oral cavities without damaging the marrow nose. Similarly during coughing it directs air and sputum into the mouth and not into the nose. Development: the palate is formed by shelf-like palatine processes of maxilla and horizontal plates of the palatine bone. Most of the palate gets ossified to form the hard palate. The unossified posterior part of fused palatine processes forms the soft palate. The epithelium of the soft palate develop from the ectoderm of maxillary process, muscles are derived from the 1st, 4th and 6th visceral arches. Blood supply: palatine branches of the a. maxillaris, a. facialis and a. pharyngea ascendens (from a. carotis externa). Veins pass to the pterygoid and tonsillar plexus and then to v. facialis. Nerve supply: innervations is accomplished by plexus pharyngeus formed by the branches of the 9th and 10th pairs of cranial nerves, truncus sympathicus, nn. palatini. All muscles of the soft palate except m. tensor veli palatini are supplied by the vagal nerve. Tensor veli palatini is supplied by the mandibular nerve (3rd branch of n. trigeminus). Nn. palatini, n. nasopalatinus and n. glossopharyngeus are mainly concerned with sensory innervations. Lymph drainage: drain into the submandibular and submental lymph nodes. 5.1.3 The teeth The teeth (dentes) are ossified papillae of the mucous membrane concerned with the mechanical treatment of food. The teeth can be divided into two groups according to age: deciduous or milk teeth (dentes decidui) and permanent teeth (dentes permanentes). The teeth are located in the alveolar processes of the maxilla and mandible and are connected to the bone by means of gomphosis. The tissue covering the alveolar process is called the gums (gingivae). The mucous membrane is closely jointed to the periosteum here by means of fibrous tissue; the gingival tissue is rich in blood vessels (and therefore bleeds relatively easily) but poor in nerves.158 Each tooth (dens) consists of a crown (corona dentis), a neck (collum dentis), and a root (radix dentis). The crown is elevated above the gum, the neck (the slightly narrowed part of the tooth) is embraced by the gum, while the root sits in the dental alveolus and terminates in an apex (apex radicis), on which a small opening, the apical foramen (foramen apicis) is seen even with the naked eye. Vessels and nerves enter the tooth through this opening. Inside the tooth crown is a dental cavity (cavum dentis), with the crown part, the widest part of the cavity, and the root part, the narrowed part of the cavity called the root canal (canalis radicis dentis). The canal opens at the apex by means of the above mentioned apical foramen. The cavity of the tooth is filled with the tooth pulp (pulpa dentis) rich in vessels and nerves. The tooth roots fuse tightly with the surface of the tooth alveoli by means of the alveolar periosteum (periodontium) supplied richly with blood vessels. The hard material of the tooth consists of dentine (dentinum), enamel (enamelum), and cement (cementum). The bulk of the tooth enclosing the cavity of the tooth is dentine. The crown is coated with enamel, while the root is covered with cement. The teeth are so fitted into the jaws that the crowns are above the gums; they form the dental rows, the upper (maxillary) and the lower (mandibular) rows. Each row consists of 16 teeth arranged in the form of dental arch. The following teeth can be distinguished according to their structure. The incisors (dentes incisivi), four on each jaw, have a crown shaped like a cutting chisel; they cut food to the needed size. The canines (dentes canini), two on each jaw, have a long single root flattened and grooved on its sides. The crown has two cutting edges meeting at an angle; a tubercle is seen on its lingual surface at the neck. The crown is so flattened that the lingual and labial surfaces converge toward the cutting edge. The premolars (dentes premolares), four on each jaw, are set immediately distal to the canines. The first premolar is located mesially and the second distally. A characteristic feature is the presence on the masticating surface of the crown of two masticating eminences, or cusps (tuberculum masticatoria). That is why these teeth are also called bicuspid (dentes bicuspidati). The molars (dentes molares). There are six molars on each jaw and they are smaller in the order from front to back; the first molar is the largest, the third one is the smallest and is called the wisdom tooth (dens serotinus s. dens sapientia). The function of the molars is to grind the food. Eruption, or cutting of the deciduous teeth, i.e. thinning of the gum and the appearance of the tooth crown in the mouth, begins in the six month of extrauterine life (the lower medial incisors erupt first) and ends by the second year or soon after. There are 20 deciduous teeth. Their dental formula of deciduous teeth is 2:1:0:2. The figures indicate the number of teeth on one half of each jaw (upper and lower): two incisors, one canine tooth, zero – premolars and two molars. The deciduous teeth are replaced by the permanent teeth after the age of six. The process consists in the eruption of new teeth, in addition to 20 deciduous teeth, and the replacement of each milk tooth by a permanent tooth. Eruption of the permanent teeth begins with the first molar and by the age of 159 12–13 all the teeth have erupted, except the third molar, erupting between the ages of 17–25 or even later. The dental formula of permanent teeth is 2:1:2:3; total of 32 teeth. A more convenient formula is used in the stomatological clinic: the teeth are indicated in the order of their numbers beginning with the first (central) incisor and ending with the last (third) molar: 1, 2 (incisors), 3 (canine tooth), 4, 5 (premolars), 6, 7, 8 (molars). Development: enamel – from the ectoderm of the oral pit; dentine, pulpa, cement – from the mesoderm. Blood supply: the arteries of the maxillary teeth arise from a. maxillaris, the posterior teeth of the upper jaw are vascularised from aa. alveolares superiores posteriores and the anterior teeth from aa. alveolares superiores anteriores (from a. infraorbitalis). All the mandibular teeth receive blood from the inferior alveolar artery. Each alveolar artery gives the branches to the teeth themselves – rami dentales, to the periosteum – rami alveolares, to the adjustment areas of the gum – rami gingivales. The blood drains along the corresponding veins into the facial vein. Nerve supply: the upper teeth are innervate by n. alveolaris superior (from n. infraorbitalis, branch from n. maxillaris of the 5th pair of cranial nerves), the lower – by n. alveolaris inferior (from n. mandibularis of the 5th pair of cranial nerves). Lymph drainage: the lymph flows to the submandibular, submental and deep cervical lumph nodes. 5.1.4 The tongue The tongue (lingua) (Greek glossa) is mainly a muscular organ (striated fibres). The changes in its shape and position are significant in the acts of mastication and speech, while due to the presence of specific nerve endings in the mucous membrane the tongue is also the organ of taste. Three parts are distinguished in the tongue: the larger part is body (corpus linguae) facing anteriorly, the tip (apex) and the root (radix linguae) by means of which the tongue is attached to the mandible and the hyoid bone. Its convex superior surface faces the palate and is called the back (dorsum). The inferior surface of the tongue (facies inferior linguae) is free only in the anterior part; the posterior part is occupied by muscles. The tongue is bounded by margins (margo linguae) on the sides. At the junction of the anterior and posterior parts of the tongue on the midline is a depression, caecal foramen (foramen caecum linguae), the remnant of the tubular projection from the floor of the primary pharynx, from which the thyroid isthmus develops. Terminal sulcus of the tongue (sulcus terminates linguae) goes forward and laterally from this foramen. The two parts of the tongue differ in development and structure of the mucous membrane. The tongue mucosa is a derivative of the first, second and, probably, the third visceral arches. The first visceral (mandibular) arch gives rise to two lateral areas, fusing on the midline to form the anterior part. The trace of the fusion of the paired germ remains throughout life on the dorsum of the tongue in the form of a median sulcus (sulcus medianus linguae) and within the tongue as a fibrous septum of the tongue (septum linguae).160 The posterior part arises from the second, third, and, evidently, the fourth visceral arches and fuses with the anterior part on linea terminalis. The mucous membrane of the anterior part of the tongue is supplied with numerous papillae. In the posterior part, the mucous membrane is thicker and smoother because there are no papillae, but it has a bulging appearance due to the presence of lymphoid nodules. The aggregation of the lymphoid structures of the posterior part of the tongue is called the lingual tonsil (tonsilla lingualis). Three folds of the mucous membrane, median glossoepiglottic fold (plica glossoepiglottica mediana) and two lateral glossoepiglottic folds (plicae glossoepiglotticae laterales) stretch from the posterior part of the tongue to the epiglottis; two depressions, valleculae epiglotticae, are seen between the median and lateral folds. The tongue papillae (papillae lingualis) are of the following types. 1. Filiform and conical papillae (papillae filiformis et conicae) are the smallest but most numerous. They occupy the superior surface of the anterior part of the tongue and lend its mucous membrane a rough or velvety appearance. The filiform and conical papillae evidently act as tactile organs. 2. Fungiform papillae (papillae fungiformes) are less in number and are found mainly at the apex and on the margins of the tongue. They are supplied with taste buds and it is therefore accepted that they are concerned with the sense of taste. 3. Vallate papillae (papillae vallatae) are surrounded by a bank. They are the largest to be arranged in the shape of the letter V immediately in front of the foramen caecum and the terminal sulcus, with the apex facing posteriorly. Their number varies between 7 and 12. Each papilla consists of a central cylindrical part (1.0–2.5 mm in diameter) and a surrounding deep narrow groove. Very many taste buds are embedded in each papilla. 4. Foliate papillae (papillae foliatae) are located on the margins of the tongue. They are taste papillae. The taste papillae are also encountered on the free edge and nasal surface of the palate and on the posterior surface of the epiglottis. Peripheral nerve endings, the receptors of the taste analyser, are embedded in the taste papillae. Muscles of the tongue constitute its muscular bulk, divided into two symmetric halves by a longitudinal fibrous septum (septum linguae). The superior edge of the septum does not reach the dorsum of the tongue. Muscles of the tongue are usually separated into two groups: extrinsic, skeletal, muscles, i.e. those the punctum fixum of which is on the bones and which alter its position on contraction: the genioglossus, hyoglossus, and styloglossus muscles; intrinsic muscles, which have no insertion on bones and are embedded within the tongue itself and change its shape: the superior and inferior longitudinal muscles and the transversus linguae and verticalis linguae muscles. This separation, however, is not quite correct since all muscles of the tongue are connected with bones to some degree, with the hyoid bone in particular. On contraction, they simultaneously change the position and the shape of the tongue. The tongue is a single muscular structure where isolated contraction of separate muscles is not possible. There are three groups of muscles according to structure and action (Fig. 98): 1) Muscles arising on the derivatives of the first visceral arch (on the mandible), these are the genioglossus muscle (m. genioglossus) and its continuation, the vertical muscle (m. verticalis linguae); 161 Fig. 98. Muscles of the tongue: 1 – m. styloglossus; 2 – m. hyoglossus; 3 – m. genioglossus; 4 – spina mentalis; 5 – m. geniohyoideus; 6 – os hyoideum 2) Muscles arising on the derivatives of the second visceral arch (on the styloid process and lesser horns of the hyoid bone): these are the styloglossus (m. styloglossus) and the superior and inferior longitudinal muscles (m. longitudinalis superior et inferior); 3) Muscles arising on the derivatives of the third visceral arch (on the body and greater horns of the hyoid bone): these are the hyoglossus (m. hyoglossus) and the transverse muscles (m. transversus linguae). The palatoglossus muscle (m. palatoglossus) is also related to this group. The first group: muscles arising on the derivatives of the first visceral arch. The genioglossus muscle is the largest of all the tongue muscles; it achieves the highest development just in human due to the appearance of speech articulation, as well. It arises from the mental spine, most conspicuous in man due to the effect of the muscle. The continuation of the muscle in the thickness of the tongue is m. verticalis stretching between the inferior surface and the dorsum of the tongue. The muscle fibres of the genioglossus and vertical muscles are predominantly vertical. As a result, their contraction moves the tongue forward and flattens it. The second group: muscles arising on the derivatives of the second visceral arch. The styloglossus muscle originates on the styloid process, descends medially and inserts into the side and inferior surface of the tongue; at the site of insertion it intersects with the fibres of the hyoglossus and palatoglossus muscles. It pulls the tongue upward and to the back. The superior longitudinal muscle (m. longitudinalis superior) arises on the lesser horns of the hyoid bone and on the epiglottis and stretches under the mucosa of the dorsum of the tongue on either side of septum linguae to the tip. The inferior longitudinal muscle (m. longitudinalis inferior) arises from the lesser horns of the hyoid bone and stretches on the inferior surface of the tongue between the genioglossus and hyoglossus muscles to the tip of the tongue.162 The bundles of this group of the muscles are mainly directed sagittally; as a result, their contraction moves the tongue backward and shortens it. The third group: muscles arising on the derivatives of the third visceral arch. The hyoglossus muscle arises from the greater horn and the nearest part of the body of the hyoid bone, stretches forward and upward; it is inserted into the margins of the tongue together with the fibres of the styloglossus and transverse muscles. It pulls the tongue backward and downward. The transverse muscle of the tongue (m. transversus linguae) stretches in the horizontal plane between the superior and inferior longitudinal muscles from the septum to the margins of the tongue. Its posterior part is attached to the hyoid bone. The transverse muscle of the tongue is continuous with the palatoglossus muscle. The slips of this group of muscles are mainly directed frontally with the result that their contraction reduces the transverse dimension of the tongue. In unilateral contraction, the tongue moves to the side of the contracting muscles, in bilateral contraction it moves downward and backward. Blood supply: a. lingualis (from a. carotis externa). Venous blood is carried away in the lingual vein draining into the internal jugular vein. Nerve supply: muscles from the 12th pair of cranial nerves; the anterior 2/3 of the mucous membrane from the lingual nerve (from the third division of the trigeminal nerve) and chorda tympani (the intermediate nerve), passing together with it and supplies the fungiform papillae with taste fibres; the posterior 1/3 including the vallate papillae from the glossopharyngeal nerve, and the root area near the epiglottis is innervated from the vagus (the superior laryngeal nerve). Lymph drainage: from the tip of the tongue to the submental lymph nodes, from the body into the submandibular nodes and also into the superior and inferior deep cervical nodes. Most of the lymphatics from the middle and posterior thirds intersect. 5.1.5 The salivary glands There are two types of the salivary glands: large and small. Numerous small salivary glands locate in the mucous membrane of the mouth and due to the position are named as follows: the labial, buccal, palatine, and lingual glands. Ducts of the three pairs of the large salivary glands (the parotid, submandibular, and sublingual glands) open into the oral cavity, as well. According to the character of the secretion, the large and small glands may be serous, mucous or mixed. The salivary glands produce saliva, keeping the oral cavity moist, and helping in chewing and swallowing. The saliva also contains enzymes (ptyalin) that aid digestion and lysozyme that destroys bacteria. The parotid gland (glandula parotis) is the largest of the salivary glands, being a serous gland. It is located on the lateral side of the face in front of and a little below the ear penetrating into the retromandibular fossa. On the surface, the tissue of the gland extends upward almost to the zygomatic arch and downward to the mandibular angle, in front lying on the masseter muscle, and at the back it reaches the external acoustic meatus and the anterior border of the sternocleidomastoid muscle. 163 The parotid is invested in a fascia (fascia parotidea). The duct of the gland (ductus parotideus) is 5–6 cm long and arising from the anterior border of the gland, passes on the surface of the masseter muscle, curving around its anterior border, and after passing through the fatty tissue of the cheek it pierces the buccinator muscle. It then enters the oral cavity under the mucous membrane and opens into the vestibule of the mouth by a small opening opposite the second upper molar. The parotid gland gets affected by the virus of mumps, which can extent the territory of its attack up to the gonads as well. The submandibular gland (glandula submandibularis) is of a mixed character, compound alveolar-tubular in structure, and the second largest after the parotid. The submandibular gland is located in the submandibular fossa, emerging from under the border of the mandible covered here by the skin, the platysma muscle, and the fascia of the neck; the fascia invests the gland and forms a thin-walled capsule. The posterior part of the gland extends a little beyond the posterior border of the mylohyoid muscle. On the posterior border of this muscle a process of the gland curves over to its anterior surface; from this process extends the submandibular duct (ductus submandibularis), passing over the mylohyoid muscle on the floor of the oral cavity opening on the caruncula sublingualis. The sublingual gland (glandula sublingualis) is of the mucous type and alveolartubular in structure. It is located over the mylohyoid muscle on the floor of the oral cavity, and, covered only by the mucous membrane, forms a sublingual fold (plica sublingualis) between the tongue and the inner surface of the mandible. The ducts of some lobules (18–20 in number) open independently into the oral cavity along the sublingual fold; they are called the smaller sublingual ducts (ductus sublinguales minores). The major duct of the sublingual gland (ductus sublingualis major) passes next to the duct of the submandibular gland and opens by means of a single opening common to both ducts or by its own opening alongside the opening of the submandibular duct. Development: the salivary glands are ectodermal in the origin. Blood supply: the parotid gland receive nutritients from the vessels piercing it (a. temporalis superficialis); the venous blood drains into the retromandibular vein. The submandibular and sublingual are vascularized from a. facialis, the venous blood drains into the facial vein. Nerve supply: the parotid gland is innervated by branches of the sympathetic trunk and glossopharyngeal nerve. The submandibular and sublingual salivary glands are innervated by the intermediate nerve (chorda tympani). Lymph drainage: the lymph flows into the parotid, the submandibular, and sublingual lymph nodes. 5.2 THE PHARYNX The pharynx (pharynx) is that part of the alimentary canal and respiratory tract, it is a connecting link between the cavity of the nose, of the mouth, the oesophagus, and the larynx. It stretches from the level of the base of the skull to that of the sixth full notes In organised mood

Here are your fully organised Splanchnology notes. Here is what was structured:
What's included:
  1. Introduction + Classification - definitions, the 4 major systems, all 4 classification axes (topography, structure, function, development) in a clean table
  2. Organ Structure - tubular vs. parenchymal organs with layer-by-layer breakdowns and ASCII diagrams showing wall architecture
  3. Body Cavities - three zones + the 3 thoracoabdominal openings
  4. Digestive System Overview - canal parts in sequence, embryological foregut/midgut/hindgut divisions
  5. Oral Cavity - vestibule vs. oral cavity proper, all named folds and landmarks
  6. Palate - hard vs. soft, all 5 muscles in a table with origin/insertion/action, functions of the soft palate, full NVL summary
  7. Teeth - dental formulas (deciduous 2:1:0:2 / permanent 2:1:2:3), tooth anatomy with internal layers, types by function, eruption timeline, NVL summary
  8. Tongue - surface anatomy, papillae types, all muscles grouped by extrinsic/intrinsic AND by visceral arch derivation, NVL summary
  9. Salivary Glands - all 3 large glands compared in one table, duct names, NVL summary
  10. Quick-Reference Master Tables - nerve supply, embryological origins, blood supply all consolidated
  11. Clinical Highlights - applied/exam-relevant points flagged in boxes

Generate a summary PDF with diagrams of tongue muscles and neural pathways

Reading File
Reading File
Running Command

ls /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/splanchnology-pd…

Writing File

~/splanchnology-pdf/generate_pdf.py

"""
Splanchnology Summary PDF
Tongue Muscles & Neural Pathways
"""

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyArrowPatch, FancyBboxPatch
import matplotlib.patheffects as pe
import numpy as np
import io, os

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, Image as RLImage, PageBreak, KeepTogether
)
from reportlab.lib.colors import HexColor

# ─── Colour palette ────────────────────────────────────────────────────────────
C_DARK_BLUE  = HexColor("#1A3A5C")
C_MID_BLUE   = HexColor("#2E6DA4")
C_LIGHT_BLUE = HexColor("#D6E8F7")
C_ACCENT     = HexColor("#E84545")
C_GOLD       = HexColor("#E8A045")
C_GREEN      = HexColor("#2E8B57")
C_LIGHT_GREY = HexColor("#F5F5F5")
C_MID_GREY   = HexColor("#CCCCCC")
C_TEXT       = HexColor("#1A1A1A")
C_WHITE      = HexColor("#FFFFFF")
C_PURPLE     = HexColor("#7B2D8B")
C_TEAL       = HexColor("#1A8080")

OUTPUT_DIR = "/home/daytona/workspace/splanchnology-pdf"
OUTPUT_PDF = os.path.join(OUTPUT_DIR, "Splanchnology_Tongue_Summary.pdf")

# ─── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent='Normal', **kwargs):
    s = ParagraphStyle(name, parent=styles[parent], **kwargs)
    return s

TITLE_STYLE = make_style('MyTitle', parent='Normal',
    fontSize=26, textColor=C_DARK_BLUE, spaceAfter=4,
    fontName='Helvetica-Bold', alignment=TA_CENTER)

SUBTITLE_STYLE = make_style('MySubtitle', parent='Normal',
    fontSize=13, textColor=C_MID_BLUE, spaceAfter=10,
    fontName='Helvetica', alignment=TA_CENTER)

H1_STYLE = make_style('MyH1', parent='Normal',
    fontSize=15, textColor=C_WHITE, spaceBefore=12, spaceAfter=6,
    fontName='Helvetica-Bold', alignment=TA_LEFT,
    backColor=C_DARK_BLUE, leftIndent=-10, rightIndent=-10,
    borderPad=5)

H2_STYLE = make_style('MyH2', parent='Normal',
    fontSize=12, textColor=C_DARK_BLUE, spaceBefore=8, spaceAfter=4,
    fontName='Helvetica-Bold', alignment=TA_LEFT,
    borderPad=3)

BODY_STYLE = make_style('MyBody', parent='Normal',
    fontSize=9.5, textColor=C_TEXT, spaceAfter=4,
    fontName='Helvetica', leading=14, alignment=TA_JUSTIFY)

BULLET_STYLE = make_style('MyBullet', parent='Normal',
    fontSize=9.5, textColor=C_TEXT, spaceAfter=3,
    fontName='Helvetica', leading=13, leftIndent=14,
    bulletIndent=4)

TABLE_HEADER_STYLE = make_style('TblHdr', parent='Normal',
    fontSize=9, textColor=C_WHITE, fontName='Helvetica-Bold',
    alignment=TA_CENTER, leading=12)

TABLE_CELL_STYLE = make_style('TblCell', parent='Normal',
    fontSize=8.5, textColor=C_TEXT, fontName='Helvetica',
    alignment=TA_LEFT, leading=11)

CAPTION_STYLE = make_style('Caption', parent='Normal',
    fontSize=8, textColor=C_MID_BLUE, fontName='Helvetica-Oblique',
    alignment=TA_CENTER, spaceAfter=8)

NOTE_STYLE = make_style('Note', parent='Normal',
    fontSize=8.5, textColor=C_DARK_BLUE, fontName='Helvetica',
    backColor=C_LIGHT_BLUE, borderPad=5, leading=13,
    leftIndent=6, rightIndent=6)

# ─── Helper: matplotlib figure → ReportLab Image ──────────────────────────────
def fig_to_rl_image(fig, width_cm, height_cm, dpi=180):
    buf = io.BytesIO()
    fig.savefig(buf, format='png', dpi=dpi, bbox_inches='tight',
                facecolor=fig.get_facecolor())
    buf.seek(0)
    plt.close(fig)
    return RLImage(buf, width=width_cm * cm, height=height_cm * cm)

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 1 – Tongue Muscles (sagittal schematic)
# ══════════════════════════════════════════════════════════════════════════════
def make_tongue_muscle_diagram():
    fig, ax = plt.subplots(figsize=(12, 7))
    fig.patch.set_facecolor('#F8FBFF')
    ax.set_facecolor('#F8FBFF')
    ax.set_xlim(0, 12)
    ax.set_ylim(0, 7)
    ax.axis('off')

    # ── Background reference boxes ──────────────────────────────────────────
    # Skull base
    skull = FancyBboxPatch((0.2, 5.9), 11.6, 0.8,
        boxstyle="round,pad=0.05", linewidth=1.5,
        edgecolor='#888888', facecolor='#D0C8B0')
    ax.add_patch(skull)
    ax.text(6, 6.3, 'SKULL BASE / STYLOID PROCESS', ha='center', va='center',
            fontsize=8, fontweight='bold', color='#555555', style='italic')

    # Mandible
    mandible = FancyBboxPatch((0.2, 0.1), 3.5, 1.0,
        boxstyle="round,pad=0.05", linewidth=1.5,
        edgecolor='#888888', facecolor='#D0C8B0')
    ax.add_patch(mandible)
    ax.text(1.95, 0.6, 'MANDIBLE\n(Mental Spine)', ha='center', va='center',
            fontsize=7.5, fontweight='bold', color='#555555', style='italic')

    # Hyoid bone
    hyoid = FancyBboxPatch((3.8, 0.1), 2.8, 0.85,
        boxstyle="round,pad=0.05", linewidth=1.5,
        edgecolor='#888888', facecolor='#D0C8B0')
    ax.add_patch(hyoid)
    ax.text(5.2, 0.55, 'HYOID BONE', ha='center', va='center',
            fontsize=7.5, fontweight='bold', color='#555555', style='italic')

    # Epiglottis
    epi = FancyBboxPatch((9.5, 3.0), 2.0, 1.5,
        boxstyle="round,pad=0.05", linewidth=1.5,
        edgecolor='#888888', facecolor='#C8E0C0')
    ax.add_patch(epi)
    ax.text(10.5, 3.75, 'EPIGLOTTIS', ha='center', va='center',
            fontsize=7.5, fontweight='bold', color='#2E6B2E', style='italic')

    # ── Tongue body (ellipse) ────────────────────────────────────────────────
    tongue = mpatches.Ellipse((5.5, 3.5), 7.5, 3.2,
        linewidth=2, edgecolor='#CC6666', facecolor='#F5C0C0', alpha=0.55,
        zorder=2)
    ax.add_patch(tongue)
    ax.text(5.5, 4.4, 'TONGUE BODY', ha='center', va='center',
            fontsize=8.5, fontweight='bold', color='#882222', zorder=10)

    # Septum linguae (dashed midline)
    ax.plot([2.0, 9.2], [3.5, 3.5], '--', color='#AA4444', linewidth=1.4,
            zorder=5, alpha=0.8)
    ax.text(5.5, 3.6, 'Septum linguae', ha='center', va='bottom',
            fontsize=7, color='#AA4444', style='italic', zorder=10)

    # Tip label
    ax.text(1.5, 3.5, 'TIP\n(Apex)', ha='center', va='center',
            fontsize=7.5, fontweight='bold', color='#882222', zorder=10)

    # Root label
    ax.text(9.2, 3.5, 'ROOT\n(Radix)', ha='center', va='center',
            fontsize=7.5, fontweight='bold', color='#882222', zorder=10)

    # ── Muscle arrows with labels ────────────────────────────────────────────
    # Colour code:  Extrinsic = blue family,  Intrinsic = green family
    EXTR_COL = '#1A5A9A'
    INTR_COL = '#1A7A3A'

    def muscle_arrow(ax, x0, y0, x1, y1, color, lw=2.2, style='->', zorder=6):
        ax.annotate('', xy=(x1, y1), xytext=(x0, y0),
            arrowprops=dict(arrowstyle=style, color=color,
                            lw=lw, connectionstyle='arc3,rad=0.15'),
            zorder=zorder)

    def muscle_label(ax, x, y, text, color, fontsize=8, zorder=8):
        ax.text(x, y, text, ha='center', va='center', fontsize=fontsize,
                fontweight='bold', color=color, zorder=zorder,
                bbox=dict(boxstyle='round,pad=0.3', fc='white', ec=color,
                          alpha=0.92, lw=1.2))

    # 1. Genioglossus (mandible → tongue body/forward)
    muscle_arrow(ax, 2.0, 0.85, 3.5, 3.1, EXTR_COL, lw=2.5)
    muscle_arrow(ax, 2.0, 0.85, 4.8, 3.5, EXTR_COL, lw=2.5)
    muscle_label(ax, 1.2, 1.9, 'Genioglossus\n(CN XII)\nForward + Flatten', EXTR_COL, fontsize=7.5)

    # 2. Styloglossus (skull → tongue side/backward)
    muscle_arrow(ax, 8.5, 5.9, 7.5, 4.2, EXTR_COL, lw=2.3)
    muscle_label(ax, 9.8, 5.3, 'Styloglossus\n(CN XII)\nUp + Backward', EXTR_COL, fontsize=7.5)

    # 3. Hyoglossus (hyoid → tongue, pulling down)
    muscle_arrow(ax, 5.5, 0.9, 5.5, 2.9, EXTR_COL, lw=2.3)
    muscle_label(ax, 6.9, 1.55, 'Hyoglossus\n(CN XII)\nBack + Down', EXTR_COL, fontsize=7.5)

    # 4. Superior Longitudinal (epiglottis/hyoid → tip, under dorsum)
    muscle_arrow(ax, 9.0, 4.5, 2.8, 4.1, INTR_COL, lw=2.0)
    muscle_label(ax, 6.2, 5.0, 'Sup. Longitudinal\n(CN XII)\nShorten/Curl Tip Up', INTR_COL, fontsize=7.5)

    # 5. Inferior Longitudinal (hyoid → tip, inferior surface)
    muscle_arrow(ax, 5.8, 1.0, 2.5, 2.9, INTR_COL, lw=2.0)
    muscle_label(ax, 3.5, 1.6, 'Inf. Longitudinal\n(CN XII)\nShorten/Curl Tip Down', INTR_COL, fontsize=7.2)

    # 6. Transversus linguae (septum → margins, horizontal)
    ax.annotate('', xy=(7.8, 3.5), xytext=(3.2, 3.5),
        arrowprops=dict(arrowstyle='<->', color=INTR_COL,
                        lw=1.8), zorder=7)
    muscle_label(ax, 5.5, 2.8, 'Transversus linguae\n(CN XII)\nNarrows tongue', INTR_COL, fontsize=7.5)

    # 7. Verticalis (continuation of genioglossus)
    ax.annotate('', xy=(4.0, 4.5), xytext=(4.0, 2.6),
        arrowprops=dict(arrowstyle='<->', color=INTR_COL,
                        lw=1.5, linestyle='dashed'), zorder=7)
    muscle_label(ax, 2.8, 3.5, 'Verticalis\n(CN XII)\nFlattens', INTR_COL, fontsize=7.2)

    # ── Legend ───────────────────────────────────────────────────────────────
    leg_x, leg_y = 0.1, 4.9
    ax.add_patch(FancyBboxPatch((leg_x-0.1, leg_y-0.6), 3.2, 1.0,
        boxstyle="round,pad=0.1", linewidth=1,
        edgecolor='#AAAAAA', facecolor='white', alpha=0.9, zorder=9))
    ax.plot([leg_x, leg_x+0.5], [leg_y+0.25, leg_y+0.25], '-',
            color=EXTR_COL, lw=2.5, zorder=10)
    ax.text(leg_x+0.65, leg_y+0.25, 'Extrinsic muscle', va='center',
            fontsize=8, color=EXTR_COL, fontweight='bold', zorder=10)
    ax.plot([leg_x, leg_x+0.5], [leg_y-0.15, leg_y-0.15], '-',
            color=INTR_COL, lw=2.5, zorder=10)
    ax.text(leg_x+0.65, leg_y-0.15, 'Intrinsic muscle', va='center',
            fontsize=8, color=INTR_COL, fontweight='bold', zorder=10)

    # ── Title ─────────────────────────────────────────────────────────────────
    ax.text(6, 6.85, 'Tongue Muscles – Schematic (Sagittal/Coronal View)',
            ha='center', va='center', fontsize=11, fontweight='bold',
            color='#1A3A5C',
            bbox=dict(boxstyle='round,pad=0.4', fc='#D6E8F7', ec='#1A3A5C', lw=1.5))

    plt.tight_layout(pad=0.3)
    return fig


# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 2 – Neural Pathways of the Tongue
# ══════════════════════════════════════════════════════════════════════════════
def make_neural_pathway_diagram():
    fig, ax = plt.subplots(figsize=(13, 8))
    fig.patch.set_facecolor('#F8FBFF')
    ax.set_facecolor('#F8FBFF')
    ax.set_xlim(0, 13)
    ax.set_ylim(0, 8)
    ax.axis('off')

    # ── Title ─────────────────────────────────────────────────────────────────
    ax.text(6.5, 7.65, 'Neural Pathways of the Tongue',
            ha='center', va='center', fontsize=11, fontweight='bold',
            color='#1A3A5C',
            bbox=dict(boxstyle='round,pad=0.4', fc='#D6E8F7', ec='#1A3A5C', lw=1.5))

    # ── Tongue outline (top view / schematic) ────────────────────────────────
    tongue = mpatches.Ellipse((6.5, 3.5), 9, 5.5,
        linewidth=2.5, edgecolor='#CC6666', facecolor='#FDE8E8', alpha=0.45,
        zorder=2)
    ax.add_patch(tongue)

    # Dividing line (sulcus terminalis / 2/3 : 1/3)
    ax.plot([2.6, 10.4], [2.8, 2.8], '--', color='#993333', linewidth=2.0,
            zorder=5)
    ax.text(6.5, 2.55, 'Sulcus terminalis / Terminal sulcus',
            ha='center', va='top', fontsize=7.5, color='#993333',
            style='italic', zorder=10)

    # Anterior 2/3 label
    ax.text(6.5, 5.0, 'ANTERIOR 2/3', ha='center', va='center',
            fontsize=9, fontweight='bold', color='#882222', zorder=10)

    # Posterior 1/3 label
    ax.text(6.5, 1.6, 'POSTERIOR 1/3', ha='center', va='center',
            fontsize=9, fontweight='bold', color='#882222', zorder=10)

    # Tip
    ax.text(6.5, 6.35, 'TIP (Apex)', ha='center', va='center',
            fontsize=8, fontweight='bold', color='#882222', zorder=10)

    # ── Colour scheme ────────────────────────────────────────────────────────
    # Motor = navy blue
    # General sensation = orange
    # Taste = purple
    # Autonomic / parasympathetic = teal

    MOT  = '#1A3A8A'   # Motor CN XII
    GEN  = '#C05A00'   # General sensation (V3)
    TAST = '#7B2D8B'   # Taste
    AUTO = '#1A8080'   # Autonomic (chorda tympani / IX)
    VAG  = '#2E6B2E'   # Vagus

    def nerve_node(ax, x, y, label, color, fontsize=8.5, zorder=12, width=None):
        bbox = dict(boxstyle='round,pad=0.4', fc=color, ec='white',
                    alpha=0.92, lw=1.5)
        ax.text(x, y, label, ha='center', va='center', fontsize=fontsize,
                fontweight='bold', color='white', bbox=bbox, zorder=zorder,
                wrap=True)

    def nerve_arrow(ax, x0, y0, x1, y1, color, lw=2.0, rad=0.2, zorder=6, ls='-'):
        ax.annotate('', xy=(x1, y1), xytext=(x0, y0),
            arrowprops=dict(arrowstyle='->', color=color, lw=lw,
                            connectionstyle=f'arc3,rad={rad}',
                            linestyle=ls),
            zorder=zorder)

    def label_on_arrow(ax, x, y, text, color, fontsize=7.2, zorder=11):
        ax.text(x, y, text, ha='center', va='center', fontsize=fontsize,
                color=color, style='italic', zorder=zorder,
                bbox=dict(fc='white', ec='none', alpha=0.8, pad=1))

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 1. MOTOR – CN XII (Hypoglossal)
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 0.85, 3.5, 'CN XII\nHypoglossal\nNucleus', MOT, fontsize=7.5)
    nerve_arrow(ax, 1.6, 3.5, 3.2, 4.8, MOT, lw=2.5, rad=0.1)
    label_on_arrow(ax, 2.3, 4.4, 'ALL tongue\nmuscles', MOT, fontsize=7)

    # Motor dots on anterior 2/3
    for pt in [(4.5, 5.2), (5.5, 4.5), (6.5, 4.8), (7.5, 5.0), (8.0, 4.3)]:
        ax.plot(*pt, 'o', color=MOT, ms=5, zorder=8, alpha=0.7)

    # Motor dots on posterior 1/3
    for pt in [(5.5, 1.8), (6.5, 1.5), (7.5, 1.9)]:
        ax.plot(*pt, 'o', color=MOT, ms=5, zorder=8, alpha=0.7)

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 2. GENERAL SENSATION – CN V3 (Lingual nerve) – anterior 2/3
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 12.3, 6.5, 'CN V3\nLingual N.\n(General\nSensation)', GEN, fontsize=7.5)
    nerve_arrow(ax, 11.5, 6.5, 9.5, 5.5, GEN, lw=2.3, rad=-0.1)
    # shade anterior 2/3
    ant_region = mpatches.Ellipse((6.5, 4.5), 8.0, 3.2,
        linewidth=0, facecolor=GEN, alpha=0.07, zorder=3)
    ax.add_patch(ant_region)
    label_on_arrow(ax, 10.8, 6.1, 'Ant. 2/3\nGeneral sensation', GEN, fontsize=7)

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 3. TASTE – Chorda tympani (CN VII / Intermediate N.) – anterior 2/3
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 12.3, 4.8, 'Chorda\nTympani\n(CN VII)\nTaste', TAST, fontsize=7.5)
    nerve_arrow(ax, 11.5, 4.8, 9.2, 4.2, TAST, lw=2.3, rad=0.15)
    label_on_arrow(ax, 10.7, 4.6, 'Ant. 2/3\nTaste (fungiform papillae)', TAST, fontsize=7)

    # Taste dots - fungiform papillae (anterior)
    for pt in [(4.8, 5.5), (6.0, 5.8), (7.2, 5.4), (5.5, 4.8), (7.8, 4.8), (8.5, 5.2)]:
        ax.plot(*pt, 's', color=TAST, ms=5, zorder=8, alpha=0.8)

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 4. TASTE + GENERAL – CN IX (Glossopharyngeal) – posterior 1/3
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 12.3, 2.5, 'CN IX\nGlossopharyngeal\n(Taste + Sensation\nPost. 1/3)', AUTO, fontsize=7.5)
    nerve_arrow(ax, 11.5, 2.5, 8.5, 1.8, AUTO, lw=2.3, rad=-0.1)
    label_on_arrow(ax, 10.3, 2.3, 'Post. 1/3 + Vallate\npapillae', AUTO, fontsize=7)

    # Posterior region shading
    post_region = mpatches.Ellipse((6.5, 1.6), 7.5, 2.0,
        linewidth=0, facecolor=AUTO, alpha=0.09, zorder=3)
    ax.add_patch(post_region)

    # Vallate papillae dots (V-row just above sulcus terminalis)
    vallate_x = [5.0, 5.8, 6.5, 7.2, 8.0]
    for vx in vallate_x:
        ax.plot(vx, 2.95, '^', color=AUTO, ms=7, zorder=8)
    ax.text(6.5, 3.2, 'Vallate papillae (7-12)', ha='center', va='bottom',
            fontsize=7, color=AUTO, zorder=10)

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 5. VAGUS – CN X – root / epiglottis area
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 0.85, 1.2, 'CN X\nVagus\n(Superior\nLaryngeal N.)', VAG, fontsize=7.5)
    nerve_arrow(ax, 1.6, 1.4, 4.0, 0.85, VAG, lw=2.0, rad=0.1)
    label_on_arrow(ax, 2.8, 1.3, 'Root/Epiglottis\narea', VAG, fontsize=7)

    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    # 6. PARASYMPATHETIC note (chorda tympani → submandibular ganglion)
    # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    nerve_node(ax, 0.85, 5.8, 'Submandibular\nGanglion\n(Para-\nsympathetic)', '#C06000', fontsize=7.2)
    ax.annotate('', xy=(1.6, 5.0), xytext=(1.55, 5.65),
        arrowprops=dict(arrowstyle='->', color='#C06000', lw=1.5,
                        linestyle='dashed'), zorder=6)
    ax.text(0.5, 5.35, 'Chorda\ntympani', ha='center', va='center',
            fontsize=6.8, color='#C06000', style='italic', zorder=10)
    ax.text(0.85, 4.75, '(submandibular +\nsublingual glands)', ha='center',
            va='center', fontsize=6.5, color='#C06000', zorder=10)

    # ── Legend ────────────────────────────────────────────────────────────────
    legend_items = [
        (MOT,  'Motor (CN XII) - all tongue muscles'),
        (GEN,  'General sensation - anterior 2/3 (CN V3)'),
        (TAST, 'Taste - anterior 2/3 (Chorda tympani, CN VII)'),
        (AUTO, 'Taste + sensation - posterior 1/3 (CN IX)'),
        (VAG,  'Sensation - root area (CN X, sup. laryngeal n.)'),
    ]
    lx, ly = 0.15, 7.5
    ax.add_patch(FancyBboxPatch((lx-0.1, ly-0.55), 7.5, 0.82,
        boxstyle="round,pad=0.1", linewidth=1,
        edgecolor='#AAAAAA', facecolor='white', alpha=0.95, zorder=11))
    for i, (col, txt) in enumerate(legend_items):
        xi = lx + i * 1.48
        ax.plot(xi, ly, 'o', color=col, ms=8, zorder=12)
        ax.text(xi + 0.12, ly, txt, va='center', fontsize=6.5, color=col,
                fontweight='bold', zorder=12)
        if i < len(legend_items) - 1:
            pass

    # Reposition legend as two rows
    ax.add_patch(FancyBboxPatch((-0.1, 6.9), 13.1, 0.65,
        boxstyle="round,pad=0.08", linewidth=1,
        edgecolor='#AAAAAA', facecolor='white', alpha=0.95, zorder=11))

    row1 = legend_items[:3]
    row2 = legend_items[3:]
    for i, (col, txt) in enumerate(row1):
        xi = 0.15 + i * 4.2
        ax.plot(xi, 7.38, 'o', color=col, ms=8, zorder=12)
        ax.text(xi + 0.18, 7.38, txt, va='center', fontsize=7.2, color=col,
                fontweight='bold', zorder=12)
    for i, (col, txt) in enumerate(row2):
        xi = 0.15 + i * 6.2
        ax.plot(xi, 7.0, 'o', color=col, ms=8, zorder=12)
        ax.text(xi + 0.18, 7.0, txt, va='center', fontsize=7.2, color=col,
                fontweight='bold', zorder=12)

    plt.tight_layout(pad=0.2)
    return fig


# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 3 – Visceral Arch derivation summary
# ══════════════════════════════════════════════════════════════════════════════
def make_visceral_arch_diagram():
    fig, ax = plt.subplots(figsize=(12, 5))
    fig.patch.set_facecolor('#F8FBFF')
    ax.set_facecolor('#F8FBFF')
    ax.set_xlim(0, 12)
    ax.set_ylim(0, 5)
    ax.axis('off')

    ax.text(6, 4.7, 'Tongue Muscles – Visceral Arch Derivations',
            ha='center', va='center', fontsize=11, fontweight='bold',
            color='#1A3A5C',
            bbox=dict(boxstyle='round,pad=0.35', fc='#D6E8F7', ec='#1A3A5C', lw=1.5))

    arches = [
        {
            'num': '1st Visceral Arch\n(Mandibular)',
            'origin': 'Mental spine\n(Mandible)',
            'muscles': 'Genioglossus\nVerticalis linguae',
            'action': 'Protrude / Flatten tongue',
            'col': '#1A5A9A',
        },
        {
            'num': '2nd Visceral Arch\n(Hyoid/Styloid)',
            'origin': 'Styloid process\n& Lesser horns of hyoid',
            'muscles': 'Styloglossus\nSup. Longitudinal\nInf. Longitudinal',
            'action': 'Retract / Shorten tongue',
            'col': '#7B2D8B',
        },
        {
            'num': '3rd Visceral Arch',
            'origin': 'Body & Greater horns\nof hyoid bone',
            'muscles': 'Hyoglossus\nTransversus linguae\nPalatoglossus',
            'action': 'Depress / Narrow tongue',
            'col': '#1A8080',
        },
    ]

    for i, arch in enumerate(arches):
        x0 = 0.3 + i * 3.9
        col = arch['col']

        # Header box
        ax.add_patch(FancyBboxPatch((x0, 3.55), 3.5, 0.85,
            boxstyle="round,pad=0.1", linewidth=1.5,
            edgecolor=col, facecolor=col))
        ax.text(x0+1.75, 3.97, arch['num'], ha='center', va='center',
                fontsize=8.5, fontweight='bold', color='white')

        # Origin box
        ax.add_patch(FancyBboxPatch((x0, 2.6), 3.5, 0.8,
            boxstyle="round,pad=0.1", linewidth=1,
            edgecolor=col, facecolor='#F0F8FF'))
        ax.text(x0+1.75, 3.0, arch['origin'], ha='center', va='center',
                fontsize=8, color=col, fontweight='bold')

        # Muscles box
        ax.add_patch(FancyBboxPatch((x0, 1.35), 3.5, 1.1,
            boxstyle="round,pad=0.1", linewidth=1,
            edgecolor=col, facecolor='#FFF8F0'))
        ax.text(x0+1.75, 1.9, arch['muscles'], ha='center', va='center',
                fontsize=8, color='#1A1A1A', linespacing=1.5)

        # Action box
        ax.add_patch(FancyBboxPatch((x0, 0.5), 3.5, 0.72,
            boxstyle="round,pad=0.1", linewidth=1,
            edgecolor=col, facecolor='#F0FFF4'))
        ax.text(x0+1.75, 0.86, arch['action'], ha='center', va='center',
                fontsize=8, color=col, fontweight='bold')

        # Arrows between boxes
        for y_from, y_to in [(3.55, 3.4), (2.6, 2.45), (1.35, 1.22)]:
            ax.annotate('', xy=(x0+1.75, y_to), xytext=(x0+1.75, y_from),
                arrowprops=dict(arrowstyle='->', color=col, lw=1.5), zorder=5)

    # Row labels on left
    row_labels = ['ARCH', 'ORIGIN', 'MUSCLES', 'ACTION']
    row_y = [3.97, 3.0, 1.9, 0.86]
    for lab, ry in zip(row_labels, row_y):
        ax.text(-0.05, ry, lab, ha='right', va='center', fontsize=7.5,
                fontweight='bold', color='#555555', style='italic')

    plt.tight_layout(pad=0.3)
    return fig


# ══════════════════════════════════════════════════════════════════════════════
#  BUILD PDF
# ══════════════════════════════════════════════════════════════════════════════
def build_pdf():
    doc = SimpleDocTemplate(
        OUTPUT_PDF,
        pagesize=A4,
        rightMargin=1.8*cm, leftMargin=1.8*cm,
        topMargin=1.8*cm, bottomMargin=1.8*cm,
    )
    story = []
    W = A4[0] - 3.6*cm   # usable width

    # ── COVER / HEADER ────────────────────────────────────────────────────────
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph("SPLANCHNOLOGY", TITLE_STYLE))
    story.append(Paragraph("Tongue Muscles &amp; Neural Pathways – Summary Notes", SUBTITLE_STYLE))
    story.append(HRFlowable(width="100%", thickness=2, color=C_DARK_BLUE, spaceAfter=10))

    # ── SECTION 1: Overview ───────────────────────────────────────────────────
    story.append(Paragraph("1. Overview of the Tongue (Lingua)", H1_STYLE))
    story.append(Spacer(1, 0.2*cm))

    overview_data = [
        [Paragraph('<b>Feature</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Details</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Type', TABLE_CELL_STYLE),
         Paragraph('Primarily muscular organ (striated fibres)', TABLE_CELL_STYLE)],
        [Paragraph('Parts', TABLE_CELL_STYLE),
         Paragraph('Tip (apex), Body (corpus linguae), Root (radix linguae), Dorsum, Inferior surface, Margins (margo linguae)', TABLE_CELL_STYLE)],
        [Paragraph('Key landmark', TABLE_CELL_STYLE),
         Paragraph('Foramen caecum linguae – remnant of thyroglossal duct; sulcus terminalis divides ant. 2/3 from post. 1/3', TABLE_CELL_STYLE)],
        [Paragraph('Septum linguae', TABLE_CELL_STYLE),
         Paragraph('Internal fibrous septum dividing tongue into 2 symmetric halves; does NOT reach dorsum', TABLE_CELL_STYLE)],
        [Paragraph('Functions', TABLE_CELL_STYLE),
         Paragraph('Mastication, deglutition, speech articulation, taste perception', TABLE_CELL_STYLE)],
    ]
    t = Table(overview_data, colWidths=[3.5*cm, W - 3.5*cm])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_DARK_BLUE),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 6),
        ('RIGHTPADDING', (0, 0), (-1, -1), 6),
        ('ROUNDEDCORNERS', [4]),
    ]))
    story.append(t)
    story.append(Spacer(1, 0.4*cm))

    # ── SECTION 2: Tongue Muscle Diagram ─────────────────────────────────────
    story.append(Paragraph("2. Tongue Muscles – Diagram", H1_STYLE))
    story.append(Spacer(1, 0.2*cm))

    fig1 = make_tongue_muscle_diagram()
    img1 = fig_to_rl_image(fig1, width_cm=16.5, height_cm=9.5)
    story.append(img1)
    story.append(Paragraph(
        "Fig. 1 – Schematic of tongue muscles (sagittal/coronal view). "
        "Blue arrows = extrinsic muscles (alter position); Green arrows = intrinsic muscles (alter shape). "
        "All muscles supplied by CN XII (Hypoglossal nerve).",
        CAPTION_STYLE))

    # ── SECTION 3: Extrinsic Muscles Table ────────────────────────────────────
    story.append(Paragraph("3. Extrinsic Muscles", H1_STYLE))
    story.append(Spacer(1, 0.15*cm))

    ext_data = [
        [Paragraph('<b>Muscle</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Origin</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Insertion</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Action</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Arch</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Genioglossus', TABLE_CELL_STYLE),
         Paragraph('Mental spine (mandible)', TABLE_CELL_STYLE),
         Paragraph('Tongue body & hyoid', TABLE_CELL_STYLE),
         Paragraph('Protrudes + flattens tongue', TABLE_CELL_STYLE),
         Paragraph('1st', TABLE_CELL_STYLE)],
        [Paragraph('Styloglossus', TABLE_CELL_STYLE),
         Paragraph('Styloid process', TABLE_CELL_STYLE),
         Paragraph('Side + inferior surface of tongue', TABLE_CELL_STYLE),
         Paragraph('Pulls tongue up + backward', TABLE_CELL_STYLE),
         Paragraph('2nd', TABLE_CELL_STYLE)],
        [Paragraph('Hyoglossus', TABLE_CELL_STYLE),
         Paragraph('Greater horn + body of hyoid', TABLE_CELL_STYLE),
         Paragraph('Margins of tongue', TABLE_CELL_STYLE),
         Paragraph('Pulls tongue backward + downward', TABLE_CELL_STYLE),
         Paragraph('3rd', TABLE_CELL_STYLE)],
    ]
    t2 = Table(ext_data, colWidths=[3.2*cm, 3.5*cm, 3.8*cm, 4.2*cm, 1.5*cm])
    t2.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_MID_BLUE),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 5),
        ('RIGHTPADDING', (0, 0), (-1, -1), 5),
    ]))
    story.append(t2)
    story.append(Spacer(1, 0.35*cm))

    # ── SECTION 4: Intrinsic Muscles Table ────────────────────────────────────
    story.append(Paragraph("4. Intrinsic Muscles", H1_STYLE))
    story.append(Spacer(1, 0.15*cm))

    int_data = [
        [Paragraph('<b>Muscle</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Fibre Direction</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Action</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Arch</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Superior Longitudinal', TABLE_CELL_STYLE),
         Paragraph('Sagittal (ant-post)', TABLE_CELL_STYLE),
         Paragraph('Shortens tongue; curls tip upward', TABLE_CELL_STYLE),
         Paragraph('2nd', TABLE_CELL_STYLE)],
        [Paragraph('Inferior Longitudinal', TABLE_CELL_STYLE),
         Paragraph('Sagittal (ant-post)', TABLE_CELL_STYLE),
         Paragraph('Shortens tongue; curls tip downward', TABLE_CELL_STYLE),
         Paragraph('2nd', TABLE_CELL_STYLE)],
        [Paragraph('Transversus linguae', TABLE_CELL_STYLE),
         Paragraph('Horizontal (transverse)', TABLE_CELL_STYLE),
         Paragraph('Narrows tongue; unilateral: tongue moves to that side; bilateral: tongue moves down + back', TABLE_CELL_STYLE),
         Paragraph('3rd', TABLE_CELL_STYLE)],
        [Paragraph('Verticalis linguae', TABLE_CELL_STYLE),
         Paragraph('Vertical', TABLE_CELL_STYLE),
         Paragraph('Flattens tongue (continuation of genioglossus fibres)', TABLE_CELL_STYLE),
         Paragraph('1st', TABLE_CELL_STYLE)],
    ]
    t3 = Table(int_data, colWidths=[3.5*cm, 3.5*cm, 7.3*cm, 1.9*cm])
    t3.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_TEAL),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 5),
        ('RIGHTPADDING', (0, 0), (-1, -1), 5),
    ]))
    story.append(t3)

    # ── PAGE BREAK ─────────────────────────────────────────────────────────────
    story.append(PageBreak())

    # ── SECTION 5: Neural Pathways Diagram ────────────────────────────────────
    story.append(Paragraph("5. Neural Pathways of the Tongue – Diagram", H1_STYLE))
    story.append(Spacer(1, 0.2*cm))

    fig2 = make_neural_pathway_diagram()
    img2 = fig_to_rl_image(fig2, width_cm=16.5, height_cm=10.0)
    story.append(img2)
    story.append(Paragraph(
        "Fig. 2 – Neural pathways of the tongue (superior/schematic view). "
        "The sulcus terminalis divides anterior 2/3 from posterior 1/3. "
        "Colour code: Navy = motor (CN XII); Orange = general sensation (CN V3); "
        "Purple = taste anterior 2/3 (chorda tympani, CN VII); Teal = posterior 1/3 (CN IX); Green = root area (CN X).",
        CAPTION_STYLE))

    # ── SECTION 6: Neural Supply Table ────────────────────────────────────────
    story.append(Paragraph("6. Nerve Supply – Detailed Reference", H1_STYLE))
    story.append(Spacer(1, 0.15*cm))

    nerve_data = [
        [Paragraph('<b>Nerve</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>CN</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Region</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Modality</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Notes</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Hypoglossal nerve', TABLE_CELL_STYLE),
         Paragraph('XII', TABLE_CELL_STYLE),
         Paragraph('All of tongue', TABLE_CELL_STYLE),
         Paragraph('MOTOR', TABLE_CELL_STYLE),
         Paragraph('All intrinsic + extrinsic muscles', TABLE_CELL_STYLE)],
        [Paragraph('Lingual nerve', TABLE_CELL_STYLE),
         Paragraph('V3', TABLE_CELL_STYLE),
         Paragraph('Anterior 2/3', TABLE_CELL_STYLE),
         Paragraph('General sensation', TABLE_CELL_STYLE),
         Paragraph('Branch of mandibular division of trigeminal (CN V)', TABLE_CELL_STYLE)],
        [Paragraph('Chorda tympani', TABLE_CELL_STYLE),
         Paragraph('VII (Intermediate)', TABLE_CELL_STYLE),
         Paragraph('Anterior 2/3', TABLE_CELL_STYLE),
         Paragraph('Taste (fungiform papillae)', TABLE_CELL_STYLE),
         Paragraph('Travels with lingual nerve; also carries parasympathetic fibres to submandibular + sublingual glands', TABLE_CELL_STYLE)],
        [Paragraph('Glossopharyngeal nerve', TABLE_CELL_STYLE),
         Paragraph('IX', TABLE_CELL_STYLE),
         Paragraph('Posterior 1/3 incl. vallate papillae', TABLE_CELL_STYLE),
         Paragraph('Taste + general sensation', TABLE_CELL_STYLE),
         Paragraph('Includes circumvallate (vallate) papillae just anterior to sulcus terminalis', TABLE_CELL_STYLE)],
        [Paragraph('Superior laryngeal nerve', TABLE_CELL_STYLE),
         Paragraph('X (Vagus)', TABLE_CELL_STYLE),
         Paragraph('Root + epiglottis area', TABLE_CELL_STYLE),
         Paragraph('General sensation', TABLE_CELL_STYLE),
         Paragraph('Via internal branch of superior laryngeal nerve', TABLE_CELL_STYLE)],
    ]
    t4 = Table(nerve_data, colWidths=[3.2*cm, 1.6*cm, 3.2*cm, 3.0*cm, 5.2*cm])
    t4.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_DARK_BLUE),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 5),
        ('RIGHTPADDING', (0, 0), (-1, -1), 5),
    ]))
    story.append(t4)
    story.append(Spacer(1, 0.4*cm))

    # Clinical note box
    story.append(Paragraph(
        "<b>Clinical Pearl:</b> CN XII lesion causes tongue deviation TOWARD the side of the lesion on protrusion "
        "(genioglossus on intact side unopposed). "
        "Chorda tympani carries BOTH taste fibres AND parasympathetic secretomotor fibres — "
        "damage affects taste (anterior 2/3) AND salivary secretion (submandibular + sublingual glands).",
        NOTE_STYLE))
    story.append(Spacer(1, 0.4*cm))

    # ── SECTION 7: Visceral Arch Diagram ─────────────────────────────────────
    story.append(Paragraph("7. Visceral Arch Derivations of Tongue Muscles", H1_STYLE))
    story.append(Spacer(1, 0.2*cm))

    fig3 = make_visceral_arch_diagram()
    img3 = fig_to_rl_image(fig3, width_cm=16.5, height_cm=7.0)
    story.append(img3)
    story.append(Paragraph(
        "Fig. 3 – Tongue muscle derivations from visceral arches. "
        "1st arch (mandibular): protrusion/flattening. "
        "2nd arch: retraction/shortening. "
        "3rd arch: depression/narrowing.",
        CAPTION_STYLE))

    # ── SECTION 8: Blood + Lymph Supply ───────────────────────────────────────
    story.append(Paragraph("8. Vascular &amp; Lymphatic Supply", H1_STYLE))
    story.append(Spacer(1, 0.15*cm))

    vasc_data = [
        [Paragraph('<b>Feature</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Details</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Arterial supply', TABLE_CELL_STYLE),
         Paragraph('A. lingualis (from a. carotis externa)', TABLE_CELL_STYLE)],
        [Paragraph('Venous drainage', TABLE_CELL_STYLE),
         Paragraph('Lingual vein → Internal jugular vein', TABLE_CELL_STYLE)],
        [Paragraph('Lymph – Tip', TABLE_CELL_STYLE),
         Paragraph('Submental lymph nodes', TABLE_CELL_STYLE)],
        [Paragraph('Lymph – Body', TABLE_CELL_STYLE),
         Paragraph('Submandibular lymph nodes + superior/inferior deep cervical nodes', TABLE_CELL_STYLE)],
        [Paragraph('Lymph – Middle + posterior 1/3', TABLE_CELL_STYLE),
         Paragraph('Lymphatics INTERSECT (cross midline) – important for cancer spread bilaterally', TABLE_CELL_STYLE)],
    ]
    t5 = Table(vasc_data, colWidths=[4.5*cm, W - 4.5*cm])
    t5.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_GREEN),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 5),
        ('RIGHTPADDING', (0, 0), (-1, -1), 5),
    ]))
    story.append(t5)
    story.append(Spacer(1, 0.4*cm))

    # ── SECTION 9: Papillae Quick Reference ───────────────────────────────────
    story.append(Paragraph("9. Tongue Papillae – Quick Reference", H1_STYLE))
    story.append(Spacer(1, 0.15*cm))

    pap_data = [
        [Paragraph('<b>Type</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Size/Number</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Location</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Function</b>', TABLE_HEADER_STYLE),
         Paragraph('<b>Taste buds?</b>', TABLE_HEADER_STYLE)],
        [Paragraph('Filiform &amp; Conical', TABLE_CELL_STYLE),
         Paragraph('Smallest; most numerous', TABLE_CELL_STYLE),
         Paragraph('Superior surface, anterior tongue', TABLE_CELL_STYLE),
         Paragraph('Tactile', TABLE_CELL_STYLE),
         Paragraph('No', TABLE_CELL_STYLE)],
        [Paragraph('Fungiform', TABLE_CELL_STYLE),
         Paragraph('Scattered', TABLE_CELL_STYLE),
         Paragraph('Apex + margins', TABLE_CELL_STYLE),
         Paragraph('Taste', TABLE_CELL_STYLE),
         Paragraph('Yes', TABLE_CELL_STYLE)],
        [Paragraph('Vallate (Circumvallate)', TABLE_CELL_STYLE),
         Paragraph('7-12; largest', TABLE_CELL_STYLE),
         Paragraph('V-row, just anterior to sulcus terminalis', TABLE_CELL_STYLE),
         Paragraph('Taste (very many taste buds)', TABLE_CELL_STYLE),
         Paragraph('Yes (many)', TABLE_CELL_STYLE)],
        [Paragraph('Foliate', TABLE_CELL_STYLE),
         Paragraph('Folds on margins', TABLE_CELL_STYLE),
         Paragraph('Lateral margins', TABLE_CELL_STYLE),
         Paragraph('Taste', TABLE_CELL_STYLE),
         Paragraph('Yes', TABLE_CELL_STYLE)],
    ]
    t6 = Table(pap_data, colWidths=[3.2*cm, 3.0*cm, 3.7*cm, 3.5*cm, 2.8*cm])
    t6.setStyle(TableStyle([
        ('BACKGROUND', (0, 0), (-1, 0), C_PURPLE),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT_GREY, C_WHITE]),
        ('GRID', (0, 0), (-1, -1), 0.5, C_MID_GREY),
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('TOPPADDING', (0, 0), (-1, -1), 5),
        ('BOTTOMPADDING', (0, 0), (-1, -1), 5),
        ('LEFTPADDING', (0, 0), (-1, -1), 5),
        ('RIGHTPADDING', (0, 0), (-1, -1), 5),
    ]))
    story.append(t6)
    story.append(Spacer(1, 0.5*cm))

    # ── FOOTER NOTE ───────────────────────────────────────────────────────────
    story.append(HRFlowable(width="100%", thickness=1, color=C_MID_GREY, spaceAfter=6))
    story.append(Paragraph(
        "Source: Splanchnology – Digestive System lecture notes | "
        "All diagrams are schematic representations for educational purposes.",
        CAPTION_STYLE))

    doc.build(story)
    print(f"PDF saved to: {OUTPUT_PDF}")


if __name__ == "__main__":
    build_pdf()
Running Command

cd /home/daytona/workspace/splanchnology-pdf && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/splanchnology-pdf/Splanchnology_Tongue_Summary.pd…

Your PDF is ready (600 KB, 3 pages):

Splanchnology Tongue Summary

PDF Document · PDF


What's inside the PDF:
Page 1
  • Cover header with title
  • Tongue overview table (parts, landmarks, functions)
  • Fig. 1 - Tongue Muscles Diagram (sagittal/coronal schematic): colour-coded arrows for all 7 muscles - blue for extrinsic (genioglossus, styloglossus, hyoglossus), green for intrinsic (superior/inferior longitudinals, transversus, verticalis); skull base, mandible, hyoid, and epiglottis all labelled
  • Extrinsic muscles table (origin, insertion, action, arch derivation)
  • Intrinsic muscles table (fibre direction, action, arch derivation)
Page 2
  • Fig. 2 - Neural Pathways Diagram (superior/schematic view of tongue): 5 colour-coded nerve territories with arrows from named cranial nerves to their tongue regions; vallate papillae row marked; sulcus terminalis dividing line shown
  • Full nerve supply reference table (CN XII, V3, VII/chorda tympani, IX, X)
  • Clinical pearl box (CN XII lesion = tongue deviation toward lesion side; chorda tympani dual role)
  • Vascular + lymphatic supply table (note on bilateral lymphatic crossing in posterior 1/3)
Page 3
  • Fig. 3 - Visceral Arch Derivations chart: all 3 arches with origin, muscles, and action in colour-coded columns
  • Papillae quick reference table (all 4 types with taste bud status)
This is a shared conversation. Sign in to Orris to start your own chat.