[{"data":1,"prerenderedAt":2178},["ShallowReactive",2],{"navigation_docs":3,"-programming-modular-documents":351,"-programming-modular-documents-surround":2173},[4,31,45,83,109,147,197,215,253,291,329],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":30},"Getting Started","i-lucide-play","\u002Fgetting-started","01.getting-started",[10,14,18,22,26],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","01.getting-started\u002F01.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","01.getting-started\u002F02.installation",{"title":19,"path":20,"stem":21},"Installing Extra Packages","\u002Fgetting-started\u002Finstalling-extra-packages","01.getting-started\u002F03.installing-extra-packages",{"title":23,"path":24,"stem":25},"Basics","\u002Fgetting-started\u002Fbasics","01.getting-started\u002F04.basics",{"title":27,"path":28,"stem":29},"How to Get Help","\u002Fgetting-started\u002Fhow-to-get-help","01.getting-started\u002F05.how-to-get-help",false,{"title":32,"icon":33,"path":34,"stem":35,"children":36,"page":30},"AI Integration","i-lucide-bot","\u002Fai-integration","02.ai-integration",[37,41],{"title":38,"path":39,"stem":40},"Model Context Protocol (MCP)","\u002Fai-integration\u002Fmcp","02.ai-integration\u002F01.mcp",{"title":42,"path":43,"stem":44},"Agent Skills","\u002Fai-integration\u002Fskills","02.ai-integration\u002F02.skills",{"title":46,"icon":47,"path":48,"stem":49,"children":50,"page":30},"Document Fundamentals","i-lucide-file-text","\u002Fdocument-fundamentals","03.document-fundamentals",[51,55,59,63,67,71,75,79],{"title":52,"path":53,"stem":54},"Document Structure","\u002Fdocument-fundamentals\u002Fdocument-structure","03.document-fundamentals\u002F01.document-structure",{"title":56,"path":57,"stem":58},"Text Formatting","\u002Fdocument-fundamentals\u002Ftext-formatting","03.document-fundamentals\u002F02.text-formatting",{"title":60,"path":61,"stem":62},"Paragraph Formatting","\u002Fdocument-fundamentals\u002Fparagraph-formatting","03.document-fundamentals\u002F03.paragraph-formatting",{"title":64,"path":65,"stem":66},"Fonts","\u002Fdocument-fundamentals\u002Ffonts","03.document-fundamentals\u002F04.fonts",{"title":68,"path":69,"stem":70},"Colors","\u002Fdocument-fundamentals\u002Fcolors","03.document-fundamentals\u002F05.colors",{"title":72,"path":73,"stem":74},"List Structures","\u002Fdocument-fundamentals\u002Flist-structures","03.document-fundamentals\u002F06.list-structures",{"title":76,"path":77,"stem":78},"Special Characters","\u002Fdocument-fundamentals\u002Fspecial-characters","03.document-fundamentals\u002F07.special-characters",{"title":80,"path":81,"stem":82},"Internationalization","\u002Fdocument-fundamentals\u002Finternationalization","03.document-fundamentals\u002F08.internationalization",{"title":84,"icon":85,"path":86,"stem":87,"children":88,"page":30},"Page Design","i-lucide-layout","\u002Fpage-design","04.page-design",[89,93,97,101,105],{"title":90,"path":91,"stem":92},"Page Layout","\u002Fpage-design\u002Fpage-layout","04.page-design\u002F01.page-layout",{"title":94,"path":95,"stem":96},"Page Headers and Footers","\u002Fpage-design\u002Fcustomizing-page-headers-and-footers","04.page-design\u002F02.customizing-page-headers-and-footers",{"title":98,"path":99,"stem":100},"Title Creation","\u002Fpage-design\u002Ftitle-creation","04.page-design\u002F03.title-creation",{"title":102,"path":103,"stem":104},"Footnotes and Margin Notes","\u002Fpage-design\u002Ffootnotes-and-margin-notes","04.page-design\u002F04.footnotes-and-margin-notes",{"title":106,"path":107,"stem":108},"Rotations","\u002Fpage-design\u002Frotations","04.page-design\u002F05.rotations",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":30},"Tables and Graphics","i-lucide-table","\u002Ftables-and-graphics","05.tables-and-graphics",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Tables","\u002Ftables-and-graphics\u002Ftables","05.tables-and-graphics\u002F01.tables",{"title":120,"path":121,"stem":122},"Floats, Figures and Captions","\u002Ftables-and-graphics\u002Ffloats-figures-and-captions","05.tables-and-graphics\u002F02.floats-figures-and-captions",{"title":124,"path":125,"stem":126},"Importing Graphics","\u002Ftables-and-graphics\u002Fimporting-graphics","05.tables-and-graphics\u002F03.importing-graphics",{"title":128,"path":129,"stem":130},"Introducing Procedural Graphics","\u002Ftables-and-graphics\u002Fintroducing-procedural-graphics","05.tables-and-graphics\u002F04.introducing-procedural-graphics",{"title":132,"path":133,"stem":134},"PGF\u002FTikZ","\u002Ftables-and-graphics\u002Fpgf-tikz","05.tables-and-graphics\u002F05.pgf-tikz",{"title":136,"path":137,"stem":138},"PSTricks","\u002Ftables-and-graphics\u002Fpstricks","05.tables-and-graphics\u002F06.pstricks",{"title":140,"path":141,"stem":142},"MetaPost","\u002Ftables-and-graphics\u002Fmetapost","05.tables-and-graphics\u002F07.metapost",{"title":144,"path":145,"stem":146},"Picture","\u002Ftables-and-graphics\u002Fpicture","05.tables-and-graphics\u002F08.picture",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":30},"Technical Writing","i-lucide-flask-conical","\u002Ftechnical-writing","06.technical-writing",[153,157,161,165,169,173,177,181,185,189,193],{"title":154,"path":155,"stem":156},"Mathematics","\u002Ftechnical-writing\u002Fmathematics","06.technical-writing\u002F01.mathematics",{"title":158,"path":159,"stem":160},"Advanced Mathematics","\u002Ftechnical-writing\u002Fadvanced-mathematics","06.technical-writing\u002F02.advanced-mathematics",{"title":162,"path":163,"stem":164},"Theorems","\u002Ftechnical-writing\u002Ftheorems","06.technical-writing\u002F03.theorems",{"title":166,"path":167,"stem":168},"Algorithms","\u002Ftechnical-writing\u002Falgorithms","06.technical-writing\u002F04.algorithms",{"title":170,"path":171,"stem":172},"Source Code Listings","\u002Ftechnical-writing\u002Fsource-code-listings","06.technical-writing\u002F05.source-code-listings",{"title":174,"path":175,"stem":176},"Chemical Graphics","\u002Ftechnical-writing\u002Fchemical-graphics","06.technical-writing\u002F06.chemical-graphics",{"title":178,"path":179,"stem":180},"Linguistics","\u002Ftechnical-writing\u002Flinguistics","06.technical-writing\u002F07.linguistics",{"title":182,"path":183,"stem":184},"Bibliography Management","\u002Ftechnical-writing\u002Fbibliography-management","06.technical-writing\u002F08.bibliography-management",{"title":186,"path":187,"stem":188},"More Bibliographies","\u002Ftechnical-writing\u002Fmore-bibliographies","06.technical-writing\u002F09.more-bibliographies",{"title":190,"path":191,"stem":192},"Indexing","\u002Ftechnical-writing\u002Findices","06.technical-writing\u002F10.indices",{"title":194,"path":195,"stem":196},"Glossary","\u002Ftechnical-writing\u002Fglossary","06.technical-writing\u002F11.glossary",{"title":198,"icon":199,"path":200,"stem":201,"children":202,"page":30},"Cross-References and Links","i-lucide-link","\u002Fcross-references","07.cross-references",[203,207,211],{"title":204,"path":205,"stem":206},"Labels and Cross Referencing","\u002Fcross-references\u002Flabels-and-cross-referencing","07.cross-references\u002F01.labels-and-cross-referencing",{"title":208,"path":209,"stem":210},"Hyperlinks","\u002Fcross-references\u002Fhyperlinks","07.cross-references\u002F02.hyperlinks",{"title":212,"path":213,"stem":214},"Initials","\u002Fcross-references\u002Finitials","07.cross-references\u002F03.initials",{"title":216,"icon":217,"path":218,"stem":219,"children":220,"page":30},"Specialized Documents","i-lucide-file-badge","\u002Fspecialized-documents","08.specialized-documents",[221,225,229,233,237,241,245,249],{"title":222,"path":223,"stem":224},"Scientific Reports","\u002Fspecialized-documents\u002Fscientific-reports","08.specialized-documents\u002F01.scientific-reports",{"title":226,"path":227,"stem":228},"Letters","\u002Fspecialized-documents\u002Fletters","08.specialized-documents\u002F02.letters",{"title":230,"path":231,"stem":232},"Presentations","\u002Fspecialized-documents\u002Fpresentations","08.specialized-documents\u002F03.presentations",{"title":234,"path":235,"stem":236},"Teacher's Corner","\u002Fspecialized-documents\u002Fteachers-corner","08.specialized-documents\u002F04.teachers-corner",{"title":238,"path":239,"stem":240},"Curriculum Vitae","\u002Fspecialized-documents\u002Fcurriculum-vitae","08.specialized-documents\u002F05.curriculum-vitae",{"title":242,"path":243,"stem":244},"Academic Journals","\u002Fspecialized-documents\u002Facademic-journals","08.specialized-documents\u002F06.academic-journals",{"title":246,"path":247,"stem":248},"Xy-pic","\u002Fspecialized-documents\u002Fxy-pic","08.specialized-documents\u002F07.xy-pic",{"title":250,"path":251,"stem":252},"Creating 3D Graphics","\u002Fspecialized-documents\u002Fcreating-3d-graphics","08.specialized-documents\u002F08.creating-3d-graphics",{"title":254,"icon":255,"path":256,"stem":257,"children":258,"page":30},"Programming LaTeX","i-lucide-code","\u002Fprogramming","09.programming",[259,263,267,271,275,279,283,287],{"title":260,"path":261,"stem":262},"Macros","\u002Fprogramming\u002Fmacros","09.programming\u002F01.macros",{"title":264,"path":265,"stem":266},"Plain TeX","\u002Fprogramming\u002Fplain-tex","09.programming\u002F02.plain-tex",{"title":268,"path":269,"stem":270},"Creating Packages","\u002Fprogramming\u002Fcreating-packages","09.programming\u002F03.creating-packages",{"title":272,"path":273,"stem":274},"Creating Package Documentation","\u002Fprogramming\u002Fcreating-package-documentation","09.programming\u002F04.creating-package-documentation",{"title":276,"path":277,"stem":278},"Themes","\u002Fprogramming\u002Fthemes","09.programming\u002F05.themes",{"title":280,"path":281,"stem":282},"Modular Documents","\u002Fprogramming\u002Fmodular-documents","09.programming\u002F06.modular-documents",{"title":284,"path":285,"stem":286},"Collaborative Writing of LaTeX Documents","\u002Fprogramming\u002Fcollaborative-writing","09.programming\u002F07.collaborative-writing",{"title":288,"path":289,"stem":290},"Export To Other Formats","\u002Fprogramming\u002Fexport-to-other-formats","09.programming\u002F08.export-to-other-formats",{"title":292,"icon":293,"path":294,"stem":295,"children":296,"page":30},"Reference and Help","i-lucide-book-open","\u002Freference","10.reference",[297,301,305,309,313,317,321,325],{"title":298,"path":299,"stem":300},"FAQ","\u002Freference\u002Ffaq","10.reference\u002F01.faq",{"title":302,"path":303,"stem":304},"Tips and Tricks","\u002Freference\u002Ftips-and-tricks","10.reference\u002F02.tips-and-tricks",{"title":306,"path":307,"stem":308},"Errors and Warnings","\u002Freference\u002Ferrors-and-warnings","10.reference\u002F03.errors-and-warnings",{"title":310,"path":311,"stem":312},"Lengths","\u002Freference\u002Flengths","10.reference\u002F04.lengths",{"title":314,"path":315,"stem":316},"Counters","\u002Freference\u002Fcounters","10.reference\u002F05.counters",{"title":318,"path":319,"stem":320},"Boxes","\u002Freference\u002Fboxes","10.reference\u002F06.boxes",{"title":322,"path":323,"stem":324},"Rules and Struts","\u002Freference\u002Frules-and-struts","10.reference\u002F07.rules-and-struts",{"title":326,"path":327,"stem":328},"Command Glossary","\u002Freference\u002Fcommand-glossary","10.reference\u002F08.command-glossary",{"title":330,"icon":331,"path":332,"stem":333,"children":334,"page":30},"Appendices","i-lucide-bookmark","\u002Fappendices","11.appendices",[335,339,343,347],{"title":336,"path":337,"stem":338},"Package Reference","\u002Fappendices\u002Fpackage-reference","11.appendices\u002F01.package-reference",{"title":340,"path":341,"stem":342},"Sample LaTeX Documents","\u002Fappendices\u002Fsample-latex-documents","11.appendices\u002F02.sample-latex-documents",{"title":344,"path":345,"stem":346},"Links","\u002Fappendices\u002Flinks","11.appendices\u002F03.links",{"title":348,"path":349,"stem":350},"Authors","\u002Fappendices\u002Fauthors","11.appendices\u002F04.authors",{"id":352,"title":280,"body":353,"description":2167,"extension":2168,"links":2169,"meta":2170,"navigation":1095,"path":281,"seo":2171,"stem":282,"__hash__":2172},"docs\u002F09.programming\u002F06.modular-documents.md",{"type":354,"value":355,"toc":2151},"minimark",[356,360,365,368,397,400,411,414,418,421,435,438,447,452,459,483,486,539,542,545,549,552,562,571,582,591,594,603,611,641,650,657,666,669,678,681,690,705,708,723,727,735,738,790,793,797,804,813,816,822,865,868,873,895,903,908,911,917,947,967,971,979,983,991,994,1003,1011,1020,1023,1037,1040,1048,1062,1068,1134,1140,1182,1209,1215,1220,1223,1226,1277,1280,1307,1311,1314,1351,1354,1421,1425,1428,1522,1526,1534,1536,1545,1552,1555,1583,1587,1621,1625,1659,1663,1671,1674,1683,1686,1706,1709,1718,1725,1730,1741,1760,1765,1771,1776,1779,1784,1804,1809,1816,1819,1834,1841,1844,1853,1861,1865,1868,1901,1905,1916,1919,1928,1935,1938,1945,1952,1956,1967,2101,2114,2117,2120,2124,2147],[357,358,359],"p",{},"During this guide we have seen what is possible to do and how this can be achieved, but the question is: I want to write a proper text with LaTeX, what to do then? Where should I start from? This is a short step-by-step guide about how to start a document properly, keeping a good high-level structure. This is all about organizing your files using the modular capabilities of LaTeX. This way it will be very easy to make modifications even when the document is almost finished. These are all just suggestions, but you might take inspiration from that to create your own document.",[361,362,364],"h2",{"id":363},"project-structure","Project structure",[357,366,367],{},"Create a clear structure of the whole project this way:",[369,370,371,379,390],"ol",{},[372,373,374,375],"li",{},"Create a directory only for the project. We'll refer to that in the following parts as the ",[376,377,378],"em",{},"root directory",[372,380,381,382,385,386,389],{},"Create two other directories inside the root, one for LaTeX documents, the other one for images. Since you'll have to write their name quite often, choose short names. A suggestion would be simply ",[376,383,384],{},"tex"," and ",[376,387,388],{},"img",".",[372,391,392,393,396],{},"Create your document (we'll call it document.tex, but you can use the name you prefer) and your own package (for example ",[376,394,395],{},"mystyle.sty","); this second file will help you keep the code cleaner.",[357,398,399],{},"If you followed all those steps, these files should be in your root directory, using \"\u002F\" for each directory:",[401,402,408],"pre",{"className":403,"code":405,"language":406,"meta":407},[404],"language-text",".\u002Fdocument.tex\n.\u002Fmystyle.sty\n.\u002Ftex\u002F\n.\u002Fimg\u002F\n","text","",[409,410,405],"code",{"__ignoreMap":407},[357,412,413],{},"nothing else.",[361,415,417],{"id":416},"getting-latex-to-process-multiple-files","Getting LaTeX to process multiple files",[357,419,420],{},"As your work grows, your LaTeX file can become unwieldy and confusing, especially if you are writing a long article with substantial, discrete sections, or a full-length book. In such cases it is good practice to split your work into several files. For example, if you are writing a book, it makes a lot of sense to write each chapter in a separate .tex file. LaTeX makes this very easy thanks to two commands:",[401,422,426],{"className":423,"code":424,"language":425,"meta":407,"style":407},"language-latex shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\\input{filename}\n","latex",[409,427,428],{"__ignoreMap":407},[429,430,433],"span",{"class":431,"line":432},"line",1,[429,434,424],{},[357,436,437],{},"and",[401,439,441],{"className":423,"code":440,"language":425,"meta":407,"style":407},"\\include{filename}\n",[409,442,443],{"__ignoreMap":407},[429,444,445],{"class":431,"line":432},[429,446,440],{},[448,449,451],"h3",{"id":450},"input-vs-include","input vs include",[357,453,454,455,458],{},"What they have in common is that they process the contents of ",[376,456,457],{},"filename.tex"," before continuing with the rest of the base file (the file that contains these statements). Similar to preprocessor of C or C++ language.",[357,460,461,462,465,466,469,470,465,472,474,475,478,479,482],{},"When the compiler processes your base file and reaches one of the commands ",[409,463,464],{},"\\input"," or ",[409,467,468],{},"\\include",", it reads filename.tex and processes its content in accordance with the formatting commands specified in the base file. This way you can put all the formatting options in your base file and write the contents using ",[409,471,464],{},[409,473,468],{}," in the files which contain the actual content of your work. This means that the important part of your working process, i.e. writing, is kept largely separate from formatting choices. This is one of the main reasons why LaTeX is so good for serious writing! You will thus be dealing solely with text and very basic commands such as ",[409,476,477],{},"\\section",", ",[409,480,481],{},"\\emph"," etc. Your document will be uncluttered and much easier to work with.",[357,484,485],{},"The two methods differ from each other in some important ways:",[487,488,489,518],"ul",{},[372,490,491,494,495],{},[409,492,493],{},"\\include{texfile}",":\n",[487,496,497,502,508,511],{},[372,498,499,500,389],{},"Cannot have nested statements of ",[409,501,468],{},[372,503,504,505,507],{},"The file can contain ",[409,506,464],{}," statements however.",[372,509,510],{},"Forces a page break, which makes it ideal for a book's chapters.",[372,512,513,514,517],{},"Expects ",[409,515,516],{},".tex"," file name without extension, otherwise the project won't compile the additional file.",[372,519,520,494,523],{},[409,521,522],{},"\\input{textfile}",[487,524,525,531,534],{},[372,526,527,528,530],{},"Can have nested ",[409,529,464],{},"s. Consider it as concatenation across the files.",[372,532,533],{},"Does not force page break — makes it ideal for use within a long article with discrete sections, which of course are not normally set on a new page.",[372,535,536,538],{},[409,537,516],{}," extension of the input file is optional.",[357,540,541],{},"Nesting files has to be done carefully, keeping the complexity of the project structure as simple as possible, having in mind the growth\u002Fscale of the content.",[357,543,544],{},"Working on discrete parts of your documents has consequences for how the base file is compiled; these will be dealt with below.",[448,546,548],{"id":547},"external-file-paths","External file paths",[357,550,551],{},"Compiler references external files from the directory of the base tex file. You can use both absolute and relative paths. Per OS file paths will differ, keep that in mind for absolute addresses.",[357,553,554,555,558,559,561],{},"An ",[376,556,557],{},"absolute"," path is a full path- and filename with every element specified. So, ",[409,560,457],{}," might have the full path,",[401,563,565],{"className":423,"code":564,"language":425,"meta":407,"style":407},"\\input{\u002Fhome\u002Fuser\u002Ftexfiles\u002Ffilename.tex}\n",[409,566,567],{"__ignoreMap":407},[429,568,569],{"class":431,"line":432},[429,570,564],{},[357,572,573,574,577,578,581],{},"If you had created the directory ",[409,575,576],{},"myfiles"," for your writing project, in your ",[409,579,580],{},"texfiles"," directory, its full path would be,",[401,583,585],{"className":423,"code":584,"language":425,"meta":407,"style":407},"\\input{\u002Fhome\u002Fuser\u002Ftexfiles\u002Fmyfiles\u002Ffilename.tex}\n",[409,586,587],{"__ignoreMap":407},[429,588,589],{"class":431,"line":432},[429,590,584],{},[357,592,593],{},"Obviously, using absolute paths is inefficient if you are referring to a file in the current directory. If, however, you need to include a file which is always kept at a specific place in your system, you may refer to it with an absolute path, for example,",[401,595,597],{"className":423,"code":596,"language":425,"meta":407,"style":407},"\\input{\u002Fhome\u002Fuser\u002Fdocuments\u002Fuseful\u002Ffoo.tex}\n",[409,598,599],{"__ignoreMap":407},[429,600,601],{"class":431,"line":432},[429,602,596],{},[357,604,605,606,610],{},"In practice, an absolute file path is generally used when one has to refer to a file which is quite some way away in the file system (or perhaps even on a different server!). One word of warning: do not leave empty spaces in the filenames, they can cause ambiguous behaviour. Either leave no spaces or use underscores ",[607,608,609],"strong",{},"_"," instead.",[357,612,613,614,617,618,620,621,624,625,628,629,632,633,636,637,640],{},"You may, however, need to make your source portable (to another computer or to a different location of your hard disk), in which case ",[376,615,616],{},"relative"," paths should be used if you wish to avoid unnecessary rewriting of pathnames. Or, a relative path may simply be a more efficient and elegant way of referring to a file. A relative path is one which is defined in relation to the current directory, in our case the one which contains the base file. LaTeX uses the standard UNIX notation: with a simple dot ",[409,619,389],{}," you refer to the current directory and by two dots ",[409,622,623],{},".."," you refer to the previous directory, that is the one above the current directory in the file system tree. The slash ",[409,626,627],{},"\u002F"," is used to separate the different components of a pathname: directories and filenames. So by ",[409,630,631],{},".\u002F"," you refer to the current directory, by ",[409,634,635],{},"..\u002F"," you refer to the previous directory, by ",[409,638,639],{},"..\u002F..\u002F"," you refer to a directory which is two steps upwards in the filesystem tree. Writing",[401,642,644],{"className":423,"code":643,"language":425,"meta":407,"style":407},"\\input{.\u002Ffilename.tex}\n",[409,645,646],{"__ignoreMap":407},[429,647,648],{"class":431,"line":432},[429,649,643],{},[357,651,652,653,656],{},"will have ",[376,654,655],{},"exactly"," the same effect as writing",[401,658,660],{"className":423,"code":659,"language":425,"meta":407,"style":407},"\\input{filename.tex}\n",[409,661,662],{"__ignoreMap":407},[429,663,664],{"class":431,"line":432},[429,665,659],{},[357,667,668],{},"but if you found it more convenient to put all your files in a sub-directory of your current directory, called myfiles, you would refer to that file by specifying",[401,670,672],{"className":423,"code":671,"language":425,"meta":407,"style":407},"\\input{.\u002Fmyfiles\u002Ffilename.tex}\n",[409,673,674],{"__ignoreMap":407},[429,675,676],{"class":431,"line":432},[429,677,671],{},[357,679,680],{},"Indeed, in our example of the absolute path above, you could refer to that file relatively, too:",[401,682,684],{"className":423,"code":683,"language":425,"meta":407,"style":407},"\\input{..\u002F..\u002Fdocuments\u002Fuseful\u002Ffoo.tex}\n",[409,685,686],{"__ignoreMap":407},[429,687,688],{"class":431,"line":432},[429,689,683],{},[357,691,692,693,478,695,697,698,700,701,704],{},"Of course, all commonly used file systems — Linux, Mac OS X and Windows — also feature the UNIX ",[409,694,631],{},[409,696,635],{}," facility outlined above. Do note, however, that LaTeX uses forward slashes ",[409,699,627],{}," even on Microsoft Windows platforms, which use backslashes ",[409,702,703],{},"\\"," in pathnames. LaTeX implementations for Windows systems perform this conversion for you, which ensures that your document will be valid across all installations.",[357,706,707],{},"This flexibility, inherent in the way in which LaTeX is integrated with modern file systems, lets you input files in a way which suits your particular set-up.",[357,709,710,711,465,713,715,716,718,719,722],{},"When using relative paths within a LaTeX file imported by ",[409,712,464],{},[409,714,468],{},", it is important to note that the paths are relative to the directory in which the main .tex file resides, not to the directory in which the included (or input) file is found. This is likely to be an issue if using a folder per chapter, with the figures in each chapter's folder, and using ",[409,717,468],{}," to read the chapter source into the main LaTeX file in a parent folder. This problem can be solved by using the package import (See below). This package adds the command ",[409,720,721],{},"\\subimport",", which allows importing files relative to the file where the command is.",[448,724,726],{"id":725},"compiling-the-base-file","Compiling the base file",[357,728,729,730,385,732,734],{},"When you compile your document, page references and the like will change according to your use of the ",[409,731,464],{},[409,733,468],{}," commands. Normally LaTeX users only run the compiler on parts of the document to check that an individual chapter is syntactically correct and looks as the writer intended. A full run is generally only performed for producing a full draft or the final version. In such cases, it is invariably necessary to run LaTeX twice or more to resolve all the page numbers, references, etc. (especially if you are using bibliographic software such as BiBTeX, too).",[357,736,737],{},"The simplest way to check that one or more of the various components of your work is syntactically robust, is to comment out the command with a percentage sign, for example:",[401,739,741],{"className":423,"code":740,"language":425,"meta":407,"style":407},"\\documentclass{article}\n\\begin{document}\n%\\input{Section_1}\n%\\input{Section_2}\n%\\input{Section_3}\n\\input{Section_4}\n%\\input{Section_5}\n\\end{document}\n",[409,742,743,748,754,760,766,772,778,784],{"__ignoreMap":407},[429,744,745],{"class":431,"line":432},[429,746,747],{},"\\documentclass{article}\n",[429,749,751],{"class":431,"line":750},2,[429,752,753],{},"\\begin{document}\n",[429,755,757],{"class":431,"line":756},3,[429,758,759],{},"%\\input{Section_1}\n",[429,761,763],{"class":431,"line":762},4,[429,764,765],{},"%\\input{Section_2}\n",[429,767,769],{"class":431,"line":768},5,[429,770,771],{},"%\\input{Section_3}\n",[429,773,775],{"class":431,"line":774},6,[429,776,777],{},"\\input{Section_4}\n",[429,779,781],{"class":431,"line":780},7,[429,782,783],{},"%\\input{Section_5}\n",[429,785,787],{"class":431,"line":786},8,[429,788,789],{},"\\end{document}\n",[357,791,792],{},"This code will process your base file with the article conventions but only the material in the file Section_4.tex will be processed. If that was, say, the last thing you needed to check before sending off to that major journal, you would then simply remove all the percentage signs and rerun LaTeX, repeating the compiling process as necessary to resolve all references, page numbers and so on.",[448,794,796],{"id":795},"using-includeonly","Using includeonly",[357,798,799,800,803],{},"Using this command provides more complex, and hence more useful possibilities. If you include the following command in your preamble, i.e. before ",[409,801,802],{},"\\begin{document}",",",[401,805,807],{"className":423,"code":806,"language":425,"meta":407,"style":407},"\\includeonly{filename1,filename2,...}\n",[409,808,809],{"__ignoreMap":407},[429,810,811],{"class":431,"line":432},[429,812,806],{},[357,814,815],{},"only the files specified between the curly braces will be included. Note that you can have one or more files as the argument to this command: separate them with a comma, no spaces. If you are using absolute or relative paths to the files, type in the complete reference.",[357,817,818,819,821],{},"This requires that there are ",[409,820,468],{}," commands in the document which specify these files. The filename should be written without the .tex file extension:",[401,823,825],{"className":423,"code":824,"language":425,"meta":407,"style":407},"\\documentclass{book}\n\\includeonly{Chapter_1,Chapter_4}  % compile just chapters 1 and 4, space characters not permitted\n\\begin{document}\n\\include{Chapter_1}                % omit the '.tex' extension\n\\include{Chapter_2}\n\\include{Chapter_3}\n\\include{Chapter_4}\n\\end{document}\n",[409,826,827,832,837,841,846,851,856,861],{"__ignoreMap":407},[429,828,829],{"class":431,"line":432},[429,830,831],{},"\\documentclass{book}\n",[429,833,834],{"class":431,"line":750},[429,835,836],{},"\\includeonly{Chapter_1,Chapter_4}  % compile just chapters 1 and 4, space characters not permitted\n",[429,838,839],{"class":431,"line":756},[429,840,753],{},[429,842,843],{"class":431,"line":762},[429,844,845],{},"\\include{Chapter_1}                % omit the '.tex' extension\n",[429,847,848],{"class":431,"line":768},[429,849,850],{},"\\include{Chapter_2}\n",[429,852,853],{"class":431,"line":774},[429,854,855],{},"\\include{Chapter_3}\n",[429,857,858],{"class":431,"line":780},[429,859,860],{},"\\include{Chapter_4}\n",[429,862,863],{"class":431,"line":786},[429,864,789],{},[357,866,867],{},"This code would process the base file but only include the content of the author's first and fourth chapters (Chapter_1.tex and Chapter_4.tex). Importantly, this alternative retains as much of the .aux information as possible from the previous run, so messes up your cross-references much less than the makeshift suggestion above.",[869,870,872],"h4",{"id":871},"import","Import",[357,874,875,876,883,884,385,887,889,890,385,892,894],{},"The ",[877,878,882],"a",{"href":879,"rel":880},"http:\u002F\u002Fctan.org\u002Fpkg\u002Fimport",[881],"nofollow","import package"," provides two commands, ",[409,885,886],{},"\\import",[409,888,721],{}," that are very similar to the built-in ",[409,891,464],{},[409,893,468],{}," commands but has two additional features: 1. allows for nested importing of sub-documents and 2. allows for relative directories of imported documents.",[357,896,897,898,385,900,902],{},"Similar to ",[409,899,464],{},[409,901,468],{},", it uses the preamble in the main document for all sub-documents.",[357,904,905],{},[607,906,907],{},"Example:",[357,909,910],{},"We have the following directory tree",[401,912,915],{"className":913,"code":914,"language":406,"meta":407},[404],"main.tex\nparagraphs\u002F\n  paragraph1.tex\n  paragraph2.tex\n  subparagraphs\u002F\n    subparagraph1.tex\n",[409,916,914],{"__ignoreMap":407},[357,918,919,920,923,924,927,928,931,932,934,935,938,939,942,943,946],{},"The file ",[409,921,922],{},"paragraph1.tex"," file is included in the main file ",[409,925,926],{},"main.tex"," by means of the command ",[409,929,930],{},"\\input{paragraphs\u002Fparagraph1.tex}",", and a problem arises when the file ",[409,933,922],{}," includes another file with a relative path, for example, ",[409,936,937],{},"\\input{subparagraphs\u002Fsubparagraph1.tex}",". In that case, we will become an error, because the path ",[409,940,941],{},"subparagraphs\u002F"," is relative to the subfolder ",[409,944,945],{},"paragraphs",", which is a subfolder of the main file.",[357,948,949,950,953,954,956,957,960,961,963,964,966],{},"We can solve the error by adding the package import, ",[409,951,952],{},"\\usepackage{import}"," in the main file, ",[409,955,926],{},", and the command ",[409,958,959],{},"\\subimport{paragraphs\u002F}{paragraph1.tex}"," instead of ",[409,962,930],{}," in order to include the file ",[409,965,922],{},". In that way, we can specify relatives paths when including files in that file.",[448,968,970],{"id":969},"separate-compilation-of-child-documents","Separate compilation of child documents",[357,972,973,974,385,976,978],{},"A disadvantage of solely using ",[409,975,464],{},[409,977,468],{}," is that only the base document can be compiled. However, you may decide that you work better on individual sections of text and wish to edit and compile those separate from the main file. There are a few packages available to address this problem.",[869,980,982],{"id":981},"subfiles","Subfiles",[357,984,875,985,990],{},[877,986,989],{"href":987,"rel":988},"http:\u002F\u002Fwww.ctan.org\u002Fpkg\u002Fsubfiles",[881],"subfiles package"," provides a way to compile sections of a document using the same preamble as the main document.",[357,992,993],{},"In the main document, the package must be loaded as:",[401,995,997],{"className":423,"code":996,"language":425,"meta":407,"style":407},"\\usepackage{subfiles}\n",[409,998,999],{"__ignoreMap":407},[429,1000,1001],{"class":431,"line":432},[429,1002,996],{},[357,1004,1005,1006,385,1008,1010],{},"Instead of using ",[409,1007,464],{},[409,1009,468],{},", child documents must be loaded as follows:",[401,1012,1014],{"className":423,"code":1013,"language":425,"meta":407,"style":407},"\\subfile{filename}\n",[409,1015,1016],{"__ignoreMap":407},[429,1017,1018],{"class":431,"line":432},[429,1019,1013],{},[357,1021,1022],{},"The child documents must start with the following statements:",[401,1024,1026],{"className":423,"code":1025,"language":425,"meta":407,"style":407},"\\documentclass[main.tex]{subfiles}\n\\begin{document}\n",[409,1027,1028,1033],{"__ignoreMap":407},[429,1029,1030],{"class":431,"line":432},[429,1031,1032],{},"\\documentclass[main.tex]{subfiles}\n",[429,1034,1035],{"class":431,"line":750},[429,1036,753],{},[357,1038,1039],{},"and end with:",[401,1041,1042],{"className":423,"code":789,"language":425,"meta":407,"style":407},[409,1043,1044],{"__ignoreMap":407},[429,1045,1046],{"class":431,"line":432},[429,1047,789],{},[357,1049,1050,1051,1054,1055,1057,1058,1061],{},"It is possible to add parts that will only be applied if the child document is compiled by its own, by defining an \"identity\" command ",[409,1052,1053],{},"\\newcommand{\\onlyinsubfile}[1]{#1}"," in the main document and then overwriting it after ",[409,1056,802],{}," using ",[409,1059,1060],{},"\\renewcommand{\\onlyinsubfile}[1]{}",". Similarly, the same can be done for parts to appear only if compiled by the main document.",[357,1063,1064,1065,1067],{},"In summary, the base document (",[409,1066,926],{},") looks like:",[401,1069,1071],{"className":423,"code":1070,"language":425,"meta":407,"style":407},"\\documentclass{book}\n\\usepackage{subfiles}\n\\newcommand{\\onlyinsubfile}[1]{#1}\n\\newcommand{\\notinsubfile}[1]{}\n\n\\begin{document}\n\\renewcommand{\\onlyinsubfile}[1]{}\n\\renewcommand{\\notinsubfile}[1]{#1}\n%% my document content\n\\subfile{chapter1}\n%% more of my document content\n\\end{document}\n",[409,1072,1073,1077,1081,1086,1091,1097,1101,1106,1111,1117,1123,1129],{"__ignoreMap":407},[429,1074,1075],{"class":431,"line":432},[429,1076,831],{},[429,1078,1079],{"class":431,"line":750},[429,1080,996],{},[429,1082,1083],{"class":431,"line":756},[429,1084,1085],{},"\\newcommand{\\onlyinsubfile}[1]{#1}\n",[429,1087,1088],{"class":431,"line":762},[429,1089,1090],{},"\\newcommand{\\notinsubfile}[1]{}\n",[429,1092,1093],{"class":431,"line":768},[429,1094,1096],{"emptyLinePlaceholder":1095},true,"\n",[429,1098,1099],{"class":431,"line":774},[429,1100,753],{},[429,1102,1103],{"class":431,"line":780},[429,1104,1105],{},"\\renewcommand{\\onlyinsubfile}[1]{}\n",[429,1107,1108],{"class":431,"line":786},[429,1109,1110],{},"\\renewcommand{\\notinsubfile}[1]{#1}\n",[429,1112,1114],{"class":431,"line":1113},9,[429,1115,1116],{},"%% my document content\n",[429,1118,1120],{"class":431,"line":1119},10,[429,1121,1122],{},"\\subfile{chapter1}\n",[429,1124,1126],{"class":431,"line":1125},11,[429,1127,1128],{},"%% more of my document content\n",[429,1130,1132],{"class":431,"line":1131},12,[429,1133,789],{},[357,1135,1136,1137,1067],{},"and Chapter 1 (",[409,1138,1139],{},"chapter1.tex",[401,1141,1143],{"className":423,"code":1142,"language":425,"meta":407,"style":407},"\\documentclass[main.tex]{subfiles}\n\\begin{document}\n%% my chapter 1 content\n\\onlyinsubfile{this only appears if chapter1.tex is compiled (not when main.tex is compiled)}\n\\notinsubfile{this only appears if main.tex is compiled (not when chapter1.tex is compiled)}\n%% more of my chapter 1 content\n%%\n\\end{document}\n",[409,1144,1145,1149,1153,1158,1163,1168,1173,1178],{"__ignoreMap":407},[429,1146,1147],{"class":431,"line":432},[429,1148,1032],{},[429,1150,1151],{"class":431,"line":750},[429,1152,753],{},[429,1154,1155],{"class":431,"line":756},[429,1156,1157],{},"%% my chapter 1 content\n",[429,1159,1160],{"class":431,"line":762},[429,1161,1162],{},"\\onlyinsubfile{this only appears if chapter1.tex is compiled (not when main.tex is compiled)}\n",[429,1164,1165],{"class":431,"line":768},[429,1166,1167],{},"\\notinsubfile{this only appears if main.tex is compiled (not when chapter1.tex is compiled)}\n",[429,1169,1170],{"class":431,"line":774},[429,1171,1172],{},"%% more of my chapter 1 content\n",[429,1174,1175],{"class":431,"line":780},[429,1176,1177],{},"%%\n",[429,1179,1180],{"class":431,"line":786},[429,1181,789],{},[357,1183,1184,1185,1190,1191,385,1194,1197,1198,1200,1201,1204,1205,1208],{},"Some linux distributions don't have subfiles package in their latex distributions, since it was not included until TeXLive 2012. You can download ",[877,1186,1189],{"href":1187,"rel":1188},"http:\u002F\u002Fmirrors.ctan.org\u002Finstall\u002Fmacros\u002Flatex\u002Fcontrib\u002Fsubfiles.tds.zip",[881],"subfiles.tds.zip"," from CTAN. This package will contain two files ",[409,1192,1193],{},"subfiles.cls",[409,1195,1196],{},"subfiles.sty",". Move these files to a directory under the name ",[409,1199,981],{}," in the path ",[409,1202,1203],{},"\u002Fusr\u002Fshare\u002Ftexmf\u002Ftex\u002Flatex",". This still won't make the package available; the ",[409,1206,1207],{},"texhash"," program must be executed first. Now you are good to go!",[357,1210,1211,1212,1214],{},"While subfiles fails to have a way of a subfile itself having references relative to its own directory, the ",[409,1213,721],{}," command provides this functionality.",[1216,1217,1219],"h5",{"id":1218},"subfiles-and-bibtex","Subfiles and bibtex",[357,1221,1222],{},"It is a bit tricky to include a bibtex bibliography in the main and the subfiles. Here is a solution:",[357,1224,1225],{},"Main file:",[401,1227,1229],{"className":423,"code":1228,"language":425,"meta":407,"style":407},"\\documentclass[11pt,reqno]{amsart}\n\\usepackage{subfiles}\n\\def\\biblio{\\bibliographystyle{amsalpha}\\bibliography{bibgraf} }\n\\begin{document}\n\\def\\biblio{}\n\n\\subfile{sub.tex}\n\\bibliographystyle{amsalpha}\n\\bibliography{bibgraf}\n\\end{document}\n",[409,1230,1231,1236,1240,1245,1249,1254,1258,1263,1268,1273],{"__ignoreMap":407},[429,1232,1233],{"class":431,"line":432},[429,1234,1235],{},"\\documentclass[11pt,reqno]{amsart}\n",[429,1237,1238],{"class":431,"line":750},[429,1239,996],{},[429,1241,1242],{"class":431,"line":756},[429,1243,1244],{},"\\def\\biblio{\\bibliographystyle{amsalpha}\\bibliography{bibgraf} }\n",[429,1246,1247],{"class":431,"line":762},[429,1248,753],{},[429,1250,1251],{"class":431,"line":768},[429,1252,1253],{},"\\def\\biblio{}\n",[429,1255,1256],{"class":431,"line":774},[429,1257,1096],{"emptyLinePlaceholder":1095},[429,1259,1260],{"class":431,"line":780},[429,1261,1262],{},"\\subfile{sub.tex}\n",[429,1264,1265],{"class":431,"line":786},[429,1266,1267],{},"\\bibliographystyle{amsalpha}\n",[429,1269,1270],{"class":431,"line":1113},[429,1271,1272],{},"\\bibliography{bibgraf}\n",[429,1274,1275],{"class":431,"line":1119},[429,1276,789],{},[357,1278,1279],{},"Sub file:",[401,1281,1283],{"className":423,"code":1282,"language":425,"meta":407,"style":407},"\\documentclass[main.tex]{subfiles}\n\\begin{document}\nThis is a test \\cite{kato88:_commut_euler_navier_stokes}\n\\biblio\n\\end{document}\n",[409,1284,1285,1289,1293,1298,1303],{"__ignoreMap":407},[429,1286,1287],{"class":431,"line":432},[429,1288,1032],{},[429,1290,1291],{"class":431,"line":750},[429,1292,753],{},[429,1294,1295],{"class":431,"line":756},[429,1296,1297],{},"This is a test \\cite{kato88:_commut_euler_navier_stokes}\n",[429,1299,1300],{"class":431,"line":762},[429,1301,1302],{},"\\biblio\n",[429,1304,1305],{"class":431,"line":768},[429,1306,789],{},[1216,1308,1310],{"id":1309},"subfiles-main-and-sub-files-in-different-subdirectories","Subfiles: Main and sub files in different subdirectories",[357,1312,1313],{},"The solution to that problem is as follows: Main file",[401,1315,1317],{"className":423,"code":1316,"language":425,"meta":407,"style":407},"\\documentclass[12pt]{article}\n\\usepackage{subfiles}\n\\begin{document}\nHallo\n\\subfile{BlattAnalysis\u002Fblatt1}\n\\subfile{BlattAnalysis\u002Fblatt2}\n\\end{document}\n",[409,1318,1319,1324,1328,1332,1337,1342,1347],{"__ignoreMap":407},[429,1320,1321],{"class":431,"line":432},[429,1322,1323],{},"\\documentclass[12pt]{article}\n",[429,1325,1326],{"class":431,"line":750},[429,1327,996],{},[429,1329,1330],{"class":431,"line":756},[429,1331,753],{},[429,1333,1334],{"class":431,"line":762},[429,1335,1336],{},"Hallo\n",[429,1338,1339],{"class":431,"line":768},[429,1340,1341],{},"\\subfile{BlattAnalysis\u002Fblatt1}\n",[429,1343,1344],{"class":431,"line":774},[429,1345,1346],{},"\\subfile{BlattAnalysis\u002Fblatt2}\n",[429,1348,1349],{"class":431,"line":780},[429,1350,789],{},[357,1352,1353],{},"and the sub file in BlattAnalysis looks like:",[401,1355,1357],{"className":423,"code":1356,"language":425,"meta":407,"style":407},"\\makeatletter\n\\def\\input@path{ {..\u002F} }\n\\makeatother\n\\documentclass[..\u002Fmain.tex]{subfiles}\n\n\\begin{document}\nHallo\nthis is a test\n\\begin{equation}\n\\label{eq:sec1:1}\n\\int dx =0\n\\end{equation}\n\\end{document}\n",[409,1358,1359,1364,1369,1374,1379,1383,1387,1391,1396,1401,1406,1411,1416],{"__ignoreMap":407},[429,1360,1361],{"class":431,"line":432},[429,1362,1363],{},"\\makeatletter\n",[429,1365,1366],{"class":431,"line":750},[429,1367,1368],{},"\\def\\input@path{ {..\u002F} }\n",[429,1370,1371],{"class":431,"line":756},[429,1372,1373],{},"\\makeatother\n",[429,1375,1376],{"class":431,"line":762},[429,1377,1378],{},"\\documentclass[..\u002Fmain.tex]{subfiles}\n",[429,1380,1381],{"class":431,"line":768},[429,1382,1096],{"emptyLinePlaceholder":1095},[429,1384,1385],{"class":431,"line":774},[429,1386,753],{},[429,1388,1389],{"class":431,"line":780},[429,1390,1336],{},[429,1392,1393],{"class":431,"line":786},[429,1394,1395],{},"this is a test\n",[429,1397,1398],{"class":431,"line":1113},[429,1399,1400],{},"\\begin{equation}\n",[429,1402,1403],{"class":431,"line":1119},[429,1404,1405],{},"\\label{eq:sec1:1}\n",[429,1407,1408],{"class":431,"line":1125},[429,1409,1410],{},"\\int dx =0\n",[429,1412,1413],{"class":431,"line":1131},[429,1414,1415],{},"\\end{equation}\n",[429,1417,1419],{"class":431,"line":1418},13,[429,1420,789],{},[1216,1422,1424],{"id":1423},"subfiles-subfiles-and-pictures-in-different-subdirectories","Subfiles: subfiles and pictures in different subdirectories",[357,1426,1427],{},"In order to be able to set a subfile-specific graphics path, and also to be able to build each subfile as standalone document graphicspath has to be provided twice. For the subfile number X using the same setup as above this would result in",[401,1429,1431],{"className":423,"code":1430,"language":425,"meta":407,"style":407},"\\makeatletter\n\\def\\input@path{ {..\u002F} }\n\\makeatother\n\\documentclass[..\u002Fmain.tex]{subfiles}\n\n\\graphicspath{\n  {\"..\u002Fmyfiles\u002FBlatt_X\u002FPictures\u002F\"}\n  {\"..\u002F..\u002Fmyfiles\u002FBlatt_X\u002FPictures\u002F\"}\n}\n\n\\begin{document}\nHallo\nthis is a test\n\n\\begin{figure}[H]\n    \\includegraphics{example.png}\n\\end{figure}\n\n\\end{document}\n",[409,1432,1433,1437,1441,1445,1449,1453,1458,1463,1468,1473,1477,1481,1485,1489,1494,1500,1506,1512,1517],{"__ignoreMap":407},[429,1434,1435],{"class":431,"line":432},[429,1436,1363],{},[429,1438,1439],{"class":431,"line":750},[429,1440,1368],{},[429,1442,1443],{"class":431,"line":756},[429,1444,1373],{},[429,1446,1447],{"class":431,"line":762},[429,1448,1378],{},[429,1450,1451],{"class":431,"line":768},[429,1452,1096],{"emptyLinePlaceholder":1095},[429,1454,1455],{"class":431,"line":774},[429,1456,1457],{},"\\graphicspath{\n",[429,1459,1460],{"class":431,"line":780},[429,1461,1462],{},"  {\"..\u002Fmyfiles\u002FBlatt_X\u002FPictures\u002F\"}\n",[429,1464,1465],{"class":431,"line":786},[429,1466,1467],{},"  {\"..\u002F..\u002Fmyfiles\u002FBlatt_X\u002FPictures\u002F\"}\n",[429,1469,1470],{"class":431,"line":1113},[429,1471,1472],{},"}\n",[429,1474,1475],{"class":431,"line":1119},[429,1476,1096],{"emptyLinePlaceholder":1095},[429,1478,1479],{"class":431,"line":1125},[429,1480,753],{},[429,1482,1483],{"class":431,"line":1131},[429,1484,1336],{},[429,1486,1487],{"class":431,"line":1418},[429,1488,1395],{},[429,1490,1492],{"class":431,"line":1491},14,[429,1493,1096],{"emptyLinePlaceholder":1095},[429,1495,1497],{"class":431,"line":1496},15,[429,1498,1499],{},"\\begin{figure}[H]\n",[429,1501,1503],{"class":431,"line":1502},16,[429,1504,1505],{},"    \\includegraphics{example.png}\n",[429,1507,1509],{"class":431,"line":1508},17,[429,1510,1511],{},"\\end{figure}\n",[429,1513,1515],{"class":431,"line":1514},18,[429,1516,1096],{"emptyLinePlaceholder":1095},[429,1518,1520],{"class":431,"line":1519},19,[429,1521,789],{},[869,1523,1525],{"id":1524},"standalone","Standalone",[357,1527,875,1528,1533],{},[877,1529,1532],{"href":1530,"rel":1531},"http:\u002F\u002Fwww.ctan.org\u002Fpkg\u002Fstandalone",[881],"standalone package"," is designed for moving more of the opposite direction than subfiles. It provides a means for importing the preamble of child documents into the main document, allowing for a flexible way to include text or images in multiple documents (e.g. an article and a presentation).",[357,1535,993],{},[401,1537,1539],{"className":423,"code":1538,"language":425,"meta":407,"style":407},"\\usepackage{standalone}\n",[409,1540,1541],{"__ignoreMap":407},[429,1542,1543],{"class":431,"line":432},[429,1544,1538],{},[357,1546,1547,1548,465,1550,389],{},"Child documents are loaded using ",[409,1549,464],{},[409,1551,468],{},[357,1553,1554],{},"The child documents contain, for example, the following statements:",[401,1556,1558],{"className":423,"code":1557,"language":425,"meta":407,"style":407},"\\documentclass{standalone}\n% Load any packages needed for this document\n\\begin{document}\n% Your document or picture\n\\end{document}\n",[409,1559,1560,1565,1570,1574,1579],{"__ignoreMap":407},[429,1561,1562],{"class":431,"line":432},[429,1563,1564],{},"\\documentclass{standalone}\n",[429,1566,1567],{"class":431,"line":750},[429,1568,1569],{},"% Load any packages needed for this document\n",[429,1571,1572],{"class":431,"line":756},[429,1573,753],{},[429,1575,1576],{"class":431,"line":762},[429,1577,1578],{},"% Your document or picture\n",[429,1580,1581],{"class":431,"line":768},[429,1582,789],{},[357,1584,1064,1585,1067],{},[409,1586,926],{},[401,1588,1590],{"className":423,"code":1589,"language":425,"meta":407,"style":407},"\\documentclass{book}\n\\usepackage{standalone}\n\\begin{document}\n%% my document content\n\\input{chapter1}\n%% more of my document content\n\\end{document}\n",[409,1591,1592,1596,1600,1604,1608,1613,1617],{"__ignoreMap":407},[429,1593,1594],{"class":431,"line":432},[429,1595,831],{},[429,1597,1598],{"class":431,"line":750},[429,1599,1538],{},[429,1601,1602],{"class":431,"line":756},[429,1603,753],{},[429,1605,1606],{"class":431,"line":762},[429,1607,1116],{},[429,1609,1610],{"class":431,"line":768},[429,1611,1612],{},"\\input{chapter1}\n",[429,1614,1615],{"class":431,"line":774},[429,1616,1128],{},[429,1618,1619],{"class":431,"line":780},[429,1620,789],{},[357,1622,1136,1623,1067],{},[409,1624,1139],{},[401,1626,1628],{"className":423,"code":1627,"language":425,"meta":407,"style":407},"\\documentclass{standalone}\n% Preamble\n\\begin{document}\n%% my chapter 1 content\n%%\n%% more of my chapter 1 content\n\\end{document}\n",[409,1629,1630,1634,1639,1643,1647,1651,1655],{"__ignoreMap":407},[429,1631,1632],{"class":431,"line":432},[429,1633,1564],{},[429,1635,1636],{"class":431,"line":750},[429,1637,1638],{},"% Preamble\n",[429,1640,1641],{"class":431,"line":756},[429,1642,753],{},[429,1644,1645],{"class":431,"line":762},[429,1646,1157],{},[429,1648,1649],{"class":431,"line":768},[429,1650,1177],{},[429,1652,1653],{"class":431,"line":774},[429,1654,1172],{},[429,1656,1657],{"class":431,"line":780},[429,1658,789],{},[361,1660,1662],{"id":1661},"including-complete-pdf-documents-or-single-pages","Including complete pdf documents or single pages",[357,1664,1665,1670],{},[877,1666,1669],{"href":1667,"rel":1668},"http:\u002F\u002Fwww.ctan.org\u002Ftex-archive\u002Fmacros\u002Flatex\u002Fcontrib\u002Fpdfpages",[881],"pdfpages"," can be used for inserting ready PDF files or separate pages and more pages per one page in any layout (e.g. 2 x 3).",[357,1672,1673],{},"The package has several options:",[401,1675,1677],{"className":423,"code":1676,"language":425,"meta":407,"style":407},"\\usepackage[ options ]{pdfpages}\n",[409,1678,1679],{"__ignoreMap":407},[429,1680,1681],{"class":431,"line":432},[429,1682,1676],{},[357,1684,1685],{},"Options:",[487,1687,1688,1694,1700],{},[372,1689,1690,1693],{},[607,1691,1692],{},"final",": Inserts pages. This is the default.",[372,1695,1696,1699],{},[607,1697,1698],{},"draft",": Does not insert pages, but prints a box and the filename instead.",[372,1701,1702,1705],{},[607,1703,1704],{},"enable-survey",": Activates survey functionalities. (Experimental, subject to change.)",[357,1707,1708],{},"Including pdf document:",[401,1710,1712],{"className":423,"code":1711,"language":425,"meta":407,"style":407},"\\includepdf[ key=val ]{ filename }\n",[409,1713,1714],{"__ignoreMap":407},[429,1715,1716],{"class":431,"line":432},[429,1717,1711],{},[357,1719,1720,1721,1724],{},"Options for ",[607,1722,1723],{},"key=val"," — comma separated list of options using the key = value syntax. Below follows few commonly used parameters:",[357,1726,1727],{},[607,1728,1729],{},"pages",[357,1731,1732,1733,1736,1737,1740],{},"Selects pages to insert. The argument is a comma separated list, containing page numbers (pages={3,5,6,8}), ranges of page numbers (pages={4-9}) or any combination. To insert empty pages use ",[409,1734,1735],{},"{}",". For instance ",[409,1738,1739],{},"pages={3,{},8-11,15}"," will insert page 3, an empty page, and pages 8, 9, 10, 11, and 15.",[357,1742,1743,1744,1747,1748,1751,1752,1755,1756,1759],{},"Actually not only links but all kinds of PDF annotations will get lost. Page ranges are specified by the following syntax: ",[376,1745,1746],{},"m - n",". This selects all pages from ",[376,1749,1750],{},"m to n",". Omitting m defaults to the first page; omitting n defaults to the last page of the document. Another way to select the last page of the document, is to use the keyword last. (This is only permitted in a page range.) E.g.: ",[376,1753,1754],{},"pages=-"," will insert all pages of the document, and ",[376,1757,1758],{},"pages=last-1"," will insert all pages in reverse order. (Default: pages=1)",[357,1761,1762],{},[607,1763,1764],{},"angle",[357,1766,1767,1768],{},"You can use the angle-option for turning the included page, for example for turning a landscape document when the latex-document is portrait. Example: ",[409,1769,1770],{},"angle=90",[357,1772,1773],{},[607,1774,1775],{},"addtolist",[357,1777,1778],{},"Adds an entry to the list of figures, the list of tables, or any other list (e.g. from float.sty). This option requires four arguments, separated by commas:",[357,1780,1781],{},[409,1782,1783],{},"addtolist={ page number , type , heading , label }",[487,1785,1786,1789,1792,1795],{},[372,1787,1788],{},"page number: Page number of the inserted page.",[372,1790,1791],{},"type: Name of a floating environment. (figure, table, etc.)",[372,1793,1794],{},"heading: Title inserted into LoF, LoT, etc.",[372,1796,1797,1798,385,1801,389],{},"label: Name of the label. This label can be referred to with ",[409,1799,1800],{},"\\ref",[409,1802,1803],{},"\\pageref",[357,1805,1806],{},[607,1807,1808],{},"pagecommand",[357,1810,1811,1812,1815],{},"Declares LaTeX-commands, which are executed on each sheet of paper. (Default: ",[376,1813,1814],{},"pagecommand={\\thispagestyle{empty} }",")",[357,1817,1818],{},"For example to include a pdf and refer to the page number of some of its pages, you can increase a counter and create a new label for each page of the included pdf:",[401,1820,1822],{"className":423,"code":1821,"language":425,"meta":407,"style":407},"\\newcounter{inclPDFpage}\n\\includepdf[pages=-,pagecommand={\\refstepcounter{inclPDFpage}\\label{test.\\theinclPDFpage} }]{toInclude.pdf}\n",[409,1823,1824,1829],{"__ignoreMap":407},[429,1825,1826],{"class":431,"line":432},[429,1827,1828],{},"\\newcounter{inclPDFpage}\n",[429,1830,1831],{"class":431,"line":750},[429,1832,1833],{},"\\includepdf[pages=-,pagecommand={\\refstepcounter{inclPDFpage}\\label{test.\\theinclPDFpage} }]{toInclude.pdf}\n",[357,1835,1836,1837,1840],{},"The fourth page of toInclude.pdf is page ",[409,1838,1839],{},"\\pageref{test.4}"," in the compiled document.",[357,1842,1843],{},"You can also insert pages of several external PDF documents.",[401,1845,1847],{"className":423,"code":1846,"language":425,"meta":407,"style":407},"\\includepdfmerge[ key=val ]{ file-page-list }\n",[409,1848,1849],{"__ignoreMap":407},[429,1850,1851],{"class":431,"line":432},[429,1852,1846],{},[357,1854,1855,1856,389],{},"Several PDFs can be placed table-like on one page. See more information in its ",[877,1857,1860],{"href":1858,"rel":1859},"http:\u002F\u002Fwww.ctan.org\u002Ftex-archive\u002Fmacros\u002Flatex\u002Fcontrib\u002Fpdfpages\u002Fpdfpages.pdf",[881],"documentation",[448,1862,1864],{"id":1863},"produce-a-single-tex-from-modular-documents","Produce a single .tex from modular documents",[357,1866,1867],{},"If you need to produce a single tex file from a modular document, several scripts are available:",[487,1869,1870,1878,1886,1893],{},[372,1871,1872,1873],{},"a perl script ",[877,1874,1877],{"href":1875,"rel":1876},"http:\u002F\u002Fmirrors.ircam.fr\u002Fpub\u002FCTAN\u002Fsupport\u002Flatexpand\u002Flatexpand",[881],"latexpand",[372,1879,1880,1881],{},"a C script ",[877,1882,1885],{"href":1883,"rel":1884},"http:\u002F\u002Fwww.ctan.org\u002Fpkg\u002Fflatex",[881],"flatex",[372,1887,1888,1889],{},"a python version of the script ",[877,1890,1885],{"href":1891,"rel":1892},"https:\u002F\u002Fgithub.com\u002Fjohnjosephhorton\u002Fflatex",[881],[372,1894,1895,1896],{},"another C script ",[877,1897,1900],{"href":1898,"rel":1899},"http:\u002F\u002Fwww.ctan.org\u002Fpkg\u002Fflatten",[881],"flatten",[361,1902,1904],{"id":1903},"the-file-mystylesty","The file mystyle.sty",[357,1906,1907,1908,1911,1912,1915],{},"Instead of putting all the packages you need at the beginning of your document as you could, the best way is to load all the packages you need inside another dummy package called ",[376,1909,1910],{},"mystyle"," you will create just for your document. The good point of doing this is that you will just have to add one single ",[409,1913,1914],{},"\\usepackage"," in your main.tex document, keeping your code much cleaner. Moreover, all the info about your style will be within one file, so when you will start another document you'll just have to copy that file and include it properly, so you'll have exactly the same style you have used.",[357,1917,1918],{},"Creating your own style is very simple: create a file called mystyle.sty (you could name it as you wish, but it has to end with \".sty\"). Write at the beginning of the mystyle.sty file:",[401,1920,1922],{"className":423,"code":1921,"language":425,"meta":407,"style":407},"\\ProvidesPackage{mystyle}\n",[409,1923,1924],{"__ignoreMap":407},[429,1925,1926],{"class":431,"line":432},[429,1927,1921],{},[357,1929,1930,1931,1934],{},"Then add all the packages you want with the standard command ",[409,1932,1933],{},"\\usepackage{...}"," as you would do normally, change the value of all the variables you want, etc. It will work like the code you put here would be copied and pasted within your document.",[357,1936,1937],{},"While writing, whenever you have to take a decision about formatting, define your own command for it and add it to your mystyle.sty: let LaTeX work for you. If you do so, it will be very easy to change it if you change your mind.",[357,1939,1940,1941,1944],{},"This is actually the beginning of the process of writing a package. See ",[877,1942,1943],{"href":261},"LaTeX\u002FMacros"," for more details.",[357,1946,1947,1948,1951],{},"For a list of several packages you can use, see the ",[877,1949,1950],{"href":337},"List of Packages"," section.",[361,1953,1955],{"id":1954},"the-main-document-documenttex","The main document document.tex",[357,1957,1958,1959,1962,1963,1966],{},"Then create a file called document.tex; this will be the main file, the one you will compile, even if you shouldn't need to edit it very often because you will be working on other files. It should look like this (it's the sample code for a ",[376,1960,1961],{},"report",", but you might easily change it to ",[376,1964,1965],{},"article"," or whatever else):",[401,1968,1970],{"className":423,"code":1969,"language":425,"meta":407,"style":407},"\\documentclass[12pt,a4paper]{report}\n\\usepackage{graphicx}\n% put all the other packages here:\n\n\\usepackage{mystyle}\n\\usepackage{hyperref}\n\\begin{document}\n\n\\input{.\u002Ftex\u002Ftitle.tex}\n%\\maketitle\n\\tableofcontents\n\\listoffigures\n\\listoftables\n\n\\input{.\u002Ftex\u002Fintro.tex}\n\\input{.\u002Ftex\u002Fmain_part.tex}\n\\input{.\u002Ftex\u002Fconclusions.tex}\n\n\\appendix\n\\input{.\u002Ftex\u002Fmyappendix.tex}\n\n% Bibliography:\n\\clearpage\n\\input{.\u002Ftex\u002Fmybibliography.tex}\n\n\\end{document}\n",[409,1971,1972,1977,1982,1987,1991,1996,2001,2005,2009,2014,2019,2024,2029,2034,2038,2043,2048,2053,2057,2062,2068,2073,2079,2085,2091,2096],{"__ignoreMap":407},[429,1973,1974],{"class":431,"line":432},[429,1975,1976],{},"\\documentclass[12pt,a4paper]{report}\n",[429,1978,1979],{"class":431,"line":750},[429,1980,1981],{},"\\usepackage{graphicx}\n",[429,1983,1984],{"class":431,"line":756},[429,1985,1986],{},"% put all the other packages here:\n",[429,1988,1989],{"class":431,"line":762},[429,1990,1096],{"emptyLinePlaceholder":1095},[429,1992,1993],{"class":431,"line":768},[429,1994,1995],{},"\\usepackage{mystyle}\n",[429,1997,1998],{"class":431,"line":774},[429,1999,2000],{},"\\usepackage{hyperref}\n",[429,2002,2003],{"class":431,"line":780},[429,2004,753],{},[429,2006,2007],{"class":431,"line":786},[429,2008,1096],{"emptyLinePlaceholder":1095},[429,2010,2011],{"class":431,"line":1113},[429,2012,2013],{},"\\input{.\u002Ftex\u002Ftitle.tex}\n",[429,2015,2016],{"class":431,"line":1119},[429,2017,2018],{},"%\\maketitle\n",[429,2020,2021],{"class":431,"line":1125},[429,2022,2023],{},"\\tableofcontents\n",[429,2025,2026],{"class":431,"line":1131},[429,2027,2028],{},"\\listoffigures\n",[429,2030,2031],{"class":431,"line":1418},[429,2032,2033],{},"\\listoftables\n",[429,2035,2036],{"class":431,"line":1491},[429,2037,1096],{"emptyLinePlaceholder":1095},[429,2039,2040],{"class":431,"line":1496},[429,2041,2042],{},"\\input{.\u002Ftex\u002Fintro.tex}\n",[429,2044,2045],{"class":431,"line":1502},[429,2046,2047],{},"\\input{.\u002Ftex\u002Fmain_part.tex}\n",[429,2049,2050],{"class":431,"line":1508},[429,2051,2052],{},"\\input{.\u002Ftex\u002Fconclusions.tex}\n",[429,2054,2055],{"class":431,"line":1514},[429,2056,1096],{"emptyLinePlaceholder":1095},[429,2058,2059],{"class":431,"line":1519},[429,2060,2061],{},"\\appendix\n",[429,2063,2065],{"class":431,"line":2064},20,[429,2066,2067],{},"\\input{.\u002Ftex\u002Fmyappendix.tex}\n",[429,2069,2071],{"class":431,"line":2070},21,[429,2072,1096],{"emptyLinePlaceholder":1095},[429,2074,2076],{"class":431,"line":2075},22,[429,2077,2078],{},"% Bibliography:\n",[429,2080,2082],{"class":431,"line":2081},23,[429,2083,2084],{},"\\clearpage\n",[429,2086,2088],{"class":431,"line":2087},24,[429,2089,2090],{},"\\input{.\u002Ftex\u002Fmybibliography.tex}\n",[429,2092,2094],{"class":431,"line":2093},25,[429,2095,1096],{"emptyLinePlaceholder":1095},[429,2097,2099],{"class":431,"line":2098},26,[429,2100,789],{},[357,2102,2103,2104,2106,2107,2110,2111,2113],{},"Here a lot of code expressed in previous sections has been used. You import the only package you need, that is your ",[376,2105,395],{}," (note that in the code it has to be imported without the extension), then your document starts. Then it inserts the title: we don't like the output of ",[409,2108,2109],{},"\\maketitle"," so we created our own, the code for it will be in a file called title.tex in the folder called tex we created before. How to write it is explained in the ",[877,2112,98],{"href":99}," section. Then tables of contents, figure and tables are inserted. If you don't want them, just comment out those lines. Then the main part of the document is inserted. As you can see, there is no text in document.tex: everything is in other files in the tex directory so that you can easily edit them. We are separating our text from the structural code, so we are improving the \"What You See is What You Mean\" nature of LaTeX. Then we can see the appendix and finally the Bibliography. It is in a separate file.",[357,2115,2116],{},"Once you have created your document.tex you won't need to edit it anymore, unless you want to add other files in the tex directory, but this is not going to happen very often. Now you can write your document, separating it into as many files as you want and adding many pictures without getting confused: thanks to the rigid structure you gave to the project, you will be able to keep track of all your edits clearly.",[357,2118,2119],{},"A suggestion: do not give your files names like \"chapter_01.tex\" or \"figure_03.png\", i.e. try to avoid using numbers in file-names: if the numbering LaTeX gives them automatically, is different from the one you gave (and this will likely happen) you will get really confused. When naming a file, stop for a second, think about a short name that can fully explain what is inside the file without being ambiguous, it will let you save a lot of time as soon as the document gets larger.",[361,2121,2123],{"id":2122},"external-links","External Links",[487,2125,2126,2133,2140],{},[372,2127,2128],{},[877,2129,2132],{"href":2130,"rel":2131},"http:\u002F\u002Fmirrors.ctan.org\u002Fmacros\u002Flatex\u002Fcontrib\u002Fsubfiles\u002Fsubfiles.pdf",[881],"Subfiles package documentation",[372,2134,2135],{},[877,2136,2139],{"href":2137,"rel":2138},"http:\u002F\u002Fmirrors.ctan.org\u002Fmacros\u002Flatex\u002Fcontrib\u002Fstandalone\u002Fstandalone.pdf",[881],"Standalone package documentation",[372,2141,2142],{},[877,2143,2146],{"href":2144,"rel":2145},"http:\u002F\u002Fmirrors.ctan.org\u002Fmacros\u002Flatex\u002Fcontrib\u002Fpdfpages\u002Fpdfpages.pdf",[881],"pdfpages package documentation",[2148,2149,2150],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":407,"searchDepth":750,"depth":750,"links":2152},[2153,2154,2161,2164,2165,2166],{"id":363,"depth":750,"text":364},{"id":416,"depth":750,"text":417,"children":2155},[2156,2157,2158,2159,2160],{"id":450,"depth":756,"text":451},{"id":547,"depth":756,"text":548},{"id":725,"depth":756,"text":726},{"id":795,"depth":756,"text":796},{"id":969,"depth":756,"text":970},{"id":1661,"depth":750,"text":1662,"children":2162},[2163],{"id":1863,"depth":756,"text":1864},{"id":1903,"depth":750,"text":1904},{"id":1954,"depth":750,"text":1955},{"id":2122,"depth":750,"text":2123},"How to organize LaTeX projects by splitting work into multiple files using modular document structures.","md",null,{},{"title":280,"description":2167},"14aFAAVRTKmlSpBwVK3fcxPLlV_Ok0AOFQvOggqpbTg",[2174,2176],{"title":276,"path":277,"stem":278,"description":2175,"children":-1},"Learn how to create custom LaTeX themes to change the visual appearance of your documents.",{"title":284,"path":285,"stem":286,"description":2177,"children":-1},"Methods and tools for organizing collaborative preparation of LaTeX documents, including version control systems and online solutions.",1785155513766]