[{"data":1,"prerenderedAt":1377},["ShallowReactive",2],{"navigation_docs":3,"-programming-creating-packages":351,"-programming-creating-packages-surround":1372},[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":268,"body":353,"description":1366,"extension":1367,"links":1368,"meta":1369,"navigation":419,"path":269,"seo":1370,"stem":270,"__hash__":1371},"docs\u002F09.programming\u002F03.creating-packages.md",{"type":354,"value":355,"toc":1351},"minimark",[356,360,363,366,371,379,391,461,465,472,475,696,771,778,821,824,832,838,841,845,848,857,860,1027,1065,1069,1072,1077,1097,1101,1116,1120,1135,1139,1154,1158,1165,1213,1217,1290,1294,1340,1347],[357,358,359],"p",{},"If you define a lot of new environments and commands, the preamble of your document will get quite long. In this situation, it is a good idea to create a LaTeX package or class containing all your command and environment definitions. It can be made dynamic enough to fit to all your future documents.",[357,361,362],{},"Classes are .cls files; packages are stored in .sty files. They are very similar, the main difference being that you can load only one class per document.",[357,364,365],{},"After deciding to create your own package or class, you should think about which license the package\u002Fclass has. A license is of great importance, either to protect your file, or to make it available for others.",[367,368,370],"h2",{"id":369},"makeatletter-and-makeatother","makeatletter and makeatother",[357,372,373,374,378],{},"By default, LaTeX will allow the use of the '@' characters for control sequences from within package and class files, but not from within an end-user document. This way it is possible to ",[375,376,377],"em",{},"protect"," commands, i.e. to make them accessible from packages only.",[357,380,381,382,386,387,390],{},"However it is possible to override this security with the duo ",[383,384,385],"code",{},"\\makeatletter"," and ",[383,388,389],{},"\\makeatother",". These commands only make sense in a regular document, they are not needed in package or class files.",[392,393,398],"pre",{"className":394,"code":395,"language":396,"meta":397,"style":397},"language-latex shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\\documentclass{...}\n%...\n\n\\begin{document}\n\n\\makeatletter\n\\@author\n\\makeatother\n\n\\end{document}\n","latex","",[383,399,400,408,414,421,427,432,438,444,450,455],{"__ignoreMap":397},[401,402,405],"span",{"class":403,"line":404},"line",1,[401,406,407],{},"\\documentclass{...}\n",[401,409,411],{"class":403,"line":410},2,[401,412,413],{},"%...\n",[401,415,417],{"class":403,"line":416},3,[401,418,420],{"emptyLinePlaceholder":419},true,"\n",[401,422,424],{"class":403,"line":423},4,[401,425,426],{},"\\begin{document}\n",[401,428,430],{"class":403,"line":429},5,[401,431,420],{"emptyLinePlaceholder":419},[401,433,435],{"class":403,"line":434},6,[401,436,437],{},"\\makeatletter\n",[401,439,441],{"class":403,"line":440},7,[401,442,443],{},"\\@author\n",[401,445,447],{"class":403,"line":446},8,[401,448,449],{},"\\makeatother\n",[401,451,453],{"class":403,"line":452},9,[401,454,420],{"emptyLinePlaceholder":419},[401,456,458],{"class":403,"line":457},10,[401,459,460],{},"\\end{document}\n",[367,462,464],{"id":463},"creating-your-own-package","Creating your own package",[357,466,467,468,471],{},"Your package can be made available in your document just like any other package: using the ",[383,469,470],{},"\\usepackage"," command. Writing a package basically consists of copying the contents of your document preamble into a separate file with a name ending in .sty.",[357,473,474],{},"Let's write a first custom.sty file as an example package:",[392,476,478],{"className":394,"code":477,"language":396,"meta":397,"style":397},"\\NeedsTeXFormat{LaTeX2e}[1994\u002F06\u002F01]\n\\ProvidesPackage{custom}[2013\u002F01\u002F13 Custom Package]\n\n\\RequirePackage{lmodern}\n\n%% 'sans serif' option\n\\DeclareOption{sans}{\n  \\renewcommand{\\familydefault}{\\sfdefault}\n}\n\n%% 'roman' option\n\\DeclareOption{roman}{\n  \\renewcommand{\\familydefault}{\\rmdefault}\n}\n\n%% Global indentation option\n\\newif\\if@neverindent\\@neverindentfalse\n\\DeclareOption{neverindent}{\n  \\@neverindenttrue\n}\n\n\\ExecuteOptions{roman}\n\n\\ProcessOptions\\relax\n\n%% Traditional LaTeX or TeX follows...\n% ...\n\n\\newlength{\\pardefault}\n\\setlength{\\pardefault}{\\parindent}\n\\newcommand{\\neverindent}{ \\setlength{\\parindent}{0pt} }\n\\newcommand{\\autoindent}{ \\setlength{\\parindent}{\\pardefault} }\n\n\\if@neverindent\n\\neverindent\n\\fi\n\n% ...\n\n\\endinput\n",[383,479,480,485,490,494,499,503,508,513,518,523,527,533,539,545,550,555,561,567,573,579,584,589,595,600,606,611,617,623,628,634,640,646,652,657,663,669,675,680,685,690],{"__ignoreMap":397},[401,481,482],{"class":403,"line":404},[401,483,484],{},"\\NeedsTeXFormat{LaTeX2e}[1994\u002F06\u002F01]\n",[401,486,487],{"class":403,"line":410},[401,488,489],{},"\\ProvidesPackage{custom}[2013\u002F01\u002F13 Custom Package]\n",[401,491,492],{"class":403,"line":416},[401,493,420],{"emptyLinePlaceholder":419},[401,495,496],{"class":403,"line":423},[401,497,498],{},"\\RequirePackage{lmodern}\n",[401,500,501],{"class":403,"line":429},[401,502,420],{"emptyLinePlaceholder":419},[401,504,505],{"class":403,"line":434},[401,506,507],{},"%% 'sans serif' option\n",[401,509,510],{"class":403,"line":440},[401,511,512],{},"\\DeclareOption{sans}{\n",[401,514,515],{"class":403,"line":446},[401,516,517],{},"  \\renewcommand{\\familydefault}{\\sfdefault}\n",[401,519,520],{"class":403,"line":452},[401,521,522],{},"}\n",[401,524,525],{"class":403,"line":457},[401,526,420],{"emptyLinePlaceholder":419},[401,528,530],{"class":403,"line":529},11,[401,531,532],{},"%% 'roman' option\n",[401,534,536],{"class":403,"line":535},12,[401,537,538],{},"\\DeclareOption{roman}{\n",[401,540,542],{"class":403,"line":541},13,[401,543,544],{},"  \\renewcommand{\\familydefault}{\\rmdefault}\n",[401,546,548],{"class":403,"line":547},14,[401,549,522],{},[401,551,553],{"class":403,"line":552},15,[401,554,420],{"emptyLinePlaceholder":419},[401,556,558],{"class":403,"line":557},16,[401,559,560],{},"%% Global indentation option\n",[401,562,564],{"class":403,"line":563},17,[401,565,566],{},"\\newif\\if@neverindent\\@neverindentfalse\n",[401,568,570],{"class":403,"line":569},18,[401,571,572],{},"\\DeclareOption{neverindent}{\n",[401,574,576],{"class":403,"line":575},19,[401,577,578],{},"  \\@neverindenttrue\n",[401,580,582],{"class":403,"line":581},20,[401,583,522],{},[401,585,587],{"class":403,"line":586},21,[401,588,420],{"emptyLinePlaceholder":419},[401,590,592],{"class":403,"line":591},22,[401,593,594],{},"\\ExecuteOptions{roman}\n",[401,596,598],{"class":403,"line":597},23,[401,599,420],{"emptyLinePlaceholder":419},[401,601,603],{"class":403,"line":602},24,[401,604,605],{},"\\ProcessOptions\\relax\n",[401,607,609],{"class":403,"line":608},25,[401,610,420],{"emptyLinePlaceholder":419},[401,612,614],{"class":403,"line":613},26,[401,615,616],{},"%% Traditional LaTeX or TeX follows...\n",[401,618,620],{"class":403,"line":619},27,[401,621,622],{},"% ...\n",[401,624,626],{"class":403,"line":625},28,[401,627,420],{"emptyLinePlaceholder":419},[401,629,631],{"class":403,"line":630},29,[401,632,633],{},"\\newlength{\\pardefault}\n",[401,635,637],{"class":403,"line":636},30,[401,638,639],{},"\\setlength{\\pardefault}{\\parindent}\n",[401,641,643],{"class":403,"line":642},31,[401,644,645],{},"\\newcommand{\\neverindent}{ \\setlength{\\parindent}{0pt} }\n",[401,647,649],{"class":403,"line":648},32,[401,650,651],{},"\\newcommand{\\autoindent}{ \\setlength{\\parindent}{\\pardefault} }\n",[401,653,655],{"class":403,"line":654},33,[401,656,420],{"emptyLinePlaceholder":419},[401,658,660],{"class":403,"line":659},34,[401,661,662],{},"\\if@neverindent\n",[401,664,666],{"class":403,"line":665},35,[401,667,668],{},"\\neverindent\n",[401,670,672],{"class":403,"line":671},36,[401,673,674],{},"\\fi\n",[401,676,678],{"class":403,"line":677},37,[401,679,420],{"emptyLinePlaceholder":419},[401,681,683],{"class":403,"line":682},38,[401,684,622],{},[401,686,688],{"class":403,"line":687},39,[401,689,420],{"emptyLinePlaceholder":419},[401,691,693],{"class":403,"line":692},40,[401,694,695],{},"\\endinput\n",[697,698,699,706,728,731,740,746,752,758,761],"ul",{},[700,701,702,705],"li",{},[383,703,704],{},"\\NeedsTeXFormat{...}"," specifies which version of TeX or LaTeX is required at least to run your package. The optional date may be used to specify the version more precisely.",[700,707,708,711,712,715,716,719,720,723,724,727],{},[383,709,710],{},"\\ProvidesPackage{\u003Cname>}[\u003Cversion>]"," A package introduces itself using this command. ",[383,713,714],{},"\u003Cname>"," should be identical to the ",[375,717,718],{},"basename"," of the file itself. The ",[383,721,722],{},"\u003Cversion>"," should begin with a date in the format ",[375,725,726],{},"YYYY\u002FMM\u002FDD",". Version information should be kept updated while developing a package.",[700,729,730],{},"Next you may write some TeX or LaTeX code like loading package, but write only the bare minimum needed for the package options set below.",[700,732,733,736,737,739],{},[383,734,735],{},"\\RequirePackage"," is equivalent to ",[383,738,470],{},".",[700,741,742,745],{},[383,743,744],{},"\\DeclareOptions"," are end-user parameters. Each option is declared by one such command.",[700,747,748,751],{},[383,749,750],{},"\\ExecuteOptions{...}"," tells which are the default.",[700,753,754,757],{},[383,755,756],{},"\\ProcessOptions\\relax"," terminates the option processing.",[700,759,760],{},"Write whatever you want in it using all the LaTeX commands you know. Normally you should define new commands or import other packages.",[700,762,763,766,767,770],{},[383,764,765],{},"\\endinput",": this ",[375,768,769],{},"must"," be the last command.",[357,772,773,774,777],{},"Once your package is ready, we can use it in any document. Import your new package with the known command ",[383,775,776],{},"\\usepackage{mypack}",". The file custom.sty and the LaTeX source you are compiling must be in the same directory.",[392,779,781],{"className":394,"code":780,"language":396,"meta":397,"style":397},"\\documentclass{...}\n\\usepackage[neverindent,sans]{custom}\n%...\n\n\\begin{document}\n\nBlah...\n\n\\end{document}\n",[383,782,783,787,792,796,800,804,808,813,817],{"__ignoreMap":397},[401,784,785],{"class":403,"line":404},[401,786,407],{},[401,788,789],{"class":403,"line":410},[401,790,791],{},"\\usepackage[neverindent,sans]{custom}\n",[401,793,794],{"class":403,"line":416},[401,795,413],{},[401,797,798],{"class":403,"line":423},[401,799,420],{"emptyLinePlaceholder":419},[401,801,802],{"class":403,"line":429},[401,803,426],{},[401,805,806],{"class":403,"line":434},[401,807,420],{"emptyLinePlaceholder":419},[401,809,810],{"class":403,"line":440},[401,811,812],{},"Blah...\n",[401,814,815],{"class":403,"line":446},[401,816,420],{"emptyLinePlaceholder":419},[401,818,819],{"class":403,"line":452},[401,820,460],{},[357,822,823],{},"For a more convenient use, it is possible to place the package within $TEXMFHOME (which is ~\u002Ftexmf by default) according to the TeX Directory Structure (TDS). That would be",[392,825,830],{"className":826,"code":828,"language":829,"meta":397},[827],"language-text","$TEXMFHOME\u002Ftex\u002Flatex\u002Fcustom\u002Fcustom.sty\n","text",[383,831,828],{"__ignoreMap":397},[357,833,834,835,739],{},"On Windows '~' is often ",[383,836,837],{},"C:\\Users\\username",[357,839,840],{},"You may have to run texhash (or equivalent) to make your TeX distribution index the new file, thus making it available for use for any document. It will allow you to use your package as detailed above, but without it needing to be in the same directory as your document.",[367,842,844],{"id":843},"creating-your-own-class","Creating your own class",[357,846,847],{},"It is also possible to create your own class file. The process is similar to the creation of your own package, you can call your own class file in the preamble of any document by the command:",[392,849,851],{"className":394,"code":850,"language":396,"meta":397,"style":397},"\\documentclass{myclass}\n",[383,852,853],{"__ignoreMap":397},[401,854,855],{"class":403,"line":404},[401,856,850],{},[357,858,859],{},"The name of the class file is then myclass.cls. Let's write a simple example, where we also make use of custom.sty that we defined above:",[392,861,863],{"className":394,"code":862,"language":396,"meta":397,"style":397},"\\NeedsTeXFormat{LaTeX2e}\n\\ProvidesClass{myclass}[2011\u002F12\u002F23 My Class]\n\n%% Article options\n\\DeclareOption{10pt}{\n  \\PassOptionsToClass{\\CurrentOption}{article}\n}\n\n%% Custom package options\n\\DeclareOption{sans}{\n  \\PassOptionsToPackage{\\CurrentOption}{custom}\n}\n\\DeclareOption{neverindent}{\n  \\PassOptionsToPackage{\\CurrentOption}{custom}\n}\n\n%% Fallback\n\\DeclareOption*{\n  \\ClassWarning{myclass}{Unknown option '\\CurrentOption'}\n}\n\n%% Execute default options\n\\ExecuteOptions{10pt}\n\n%% Process given options\n\\ProcessOptions\\relax\n\n%% Load base\n\\LoadClass[a4paper]{article}\n\n%% Load additional packages and commands.\n\\RequirePackage{custom}\n\n%% Additional TeX\u002FLaTeX code...\n\n\\endinput\n",[383,864,865,870,875,879,884,889,894,898,902,907,911,916,920,924,928,932,936,941,946,951,955,959,964,969,973,978,982,986,991,996,1000,1005,1010,1014,1019,1023],{"__ignoreMap":397},[401,866,867],{"class":403,"line":404},[401,868,869],{},"\\NeedsTeXFormat{LaTeX2e}\n",[401,871,872],{"class":403,"line":410},[401,873,874],{},"\\ProvidesClass{myclass}[2011\u002F12\u002F23 My Class]\n",[401,876,877],{"class":403,"line":416},[401,878,420],{"emptyLinePlaceholder":419},[401,880,881],{"class":403,"line":423},[401,882,883],{},"%% Article options\n",[401,885,886],{"class":403,"line":429},[401,887,888],{},"\\DeclareOption{10pt}{\n",[401,890,891],{"class":403,"line":434},[401,892,893],{},"  \\PassOptionsToClass{\\CurrentOption}{article}\n",[401,895,896],{"class":403,"line":440},[401,897,522],{},[401,899,900],{"class":403,"line":446},[401,901,420],{"emptyLinePlaceholder":419},[401,903,904],{"class":403,"line":452},[401,905,906],{},"%% Custom package options\n",[401,908,909],{"class":403,"line":457},[401,910,512],{},[401,912,913],{"class":403,"line":529},[401,914,915],{},"  \\PassOptionsToPackage{\\CurrentOption}{custom}\n",[401,917,918],{"class":403,"line":535},[401,919,522],{},[401,921,922],{"class":403,"line":541},[401,923,572],{},[401,925,926],{"class":403,"line":547},[401,927,915],{},[401,929,930],{"class":403,"line":552},[401,931,522],{},[401,933,934],{"class":403,"line":557},[401,935,420],{"emptyLinePlaceholder":419},[401,937,938],{"class":403,"line":563},[401,939,940],{},"%% Fallback\n",[401,942,943],{"class":403,"line":569},[401,944,945],{},"\\DeclareOption*{\n",[401,947,948],{"class":403,"line":575},[401,949,950],{},"  \\ClassWarning{myclass}{Unknown option '\\CurrentOption'}\n",[401,952,953],{"class":403,"line":581},[401,954,522],{},[401,956,957],{"class":403,"line":586},[401,958,420],{"emptyLinePlaceholder":419},[401,960,961],{"class":403,"line":591},[401,962,963],{},"%% Execute default options\n",[401,965,966],{"class":403,"line":597},[401,967,968],{},"\\ExecuteOptions{10pt}\n",[401,970,971],{"class":403,"line":602},[401,972,420],{"emptyLinePlaceholder":419},[401,974,975],{"class":403,"line":608},[401,976,977],{},"%% Process given options\n",[401,979,980],{"class":403,"line":613},[401,981,605],{},[401,983,984],{"class":403,"line":619},[401,985,420],{"emptyLinePlaceholder":419},[401,987,988],{"class":403,"line":625},[401,989,990],{},"%% Load base\n",[401,992,993],{"class":403,"line":630},[401,994,995],{},"\\LoadClass[a4paper]{article}\n",[401,997,998],{"class":403,"line":636},[401,999,420],{"emptyLinePlaceholder":419},[401,1001,1002],{"class":403,"line":642},[401,1003,1004],{},"%% Load additional packages and commands.\n",[401,1006,1007],{"class":403,"line":648},[401,1008,1009],{},"\\RequirePackage{custom}\n",[401,1011,1012],{"class":403,"line":654},[401,1013,420],{"emptyLinePlaceholder":419},[401,1015,1016],{"class":403,"line":659},[401,1017,1018],{},"%% Additional TeX\u002FLaTeX code...\n",[401,1020,1021],{"class":403,"line":665},[401,1022,420],{"emptyLinePlaceholder":419},[401,1024,1025],{"class":403,"line":671},[401,1026,695],{},[697,1028,1029,1038,1047,1053,1059],{},[700,1030,1031,1034,1035,739],{},[383,1032,1033],{},"\\ProvidesClass"," is the counterpart of ",[383,1036,1037],{},"\\ProvidesPackage",[700,1039,1040,386,1043,1046],{},[383,1041,1042],{},"\\PassOptionsToClass",[383,1044,1045],{},"\\PassOptionsToPackage"," are used to automatically invoke the corresponding options when the class or the package is loaded.",[700,1048,1049,1052],{},[383,1050,1051],{},"\\DeclareOption*",": the starred version lets you handle non-implemented options.",[700,1054,1055,1058],{},[383,1056,1057],{},"\\ClassWarning"," will show the corresponding message in the TeX compiler output.",[700,1060,1061,1064],{},[383,1062,1063],{},"\\LoadClass"," specifies the unique parent class, if any.",[367,1066,1068],{"id":1067},"hooks","Hooks",[357,1070,1071],{},"The LaTeX kernel provides a powerful hook management system (introduced in 2020). Hooks let you execute code at specific points in the document processing:",[1073,1074,1076],"h3",{"id":1075},"document-hooks","Document Hooks",[392,1078,1080],{"className":394,"code":1079,"language":396,"meta":397,"style":397},"\\AddToHook{begindocument}{Code to run at begin document}\n\\AddToHook{enddocument}{Code to run at end document}\n\\AddToHook{begindocument\u002Fend}{Code after all packages load}\n",[383,1081,1082,1087,1092],{"__ignoreMap":397},[401,1083,1084],{"class":403,"line":404},[401,1085,1086],{},"\\AddToHook{begindocument}{Code to run at begin document}\n",[401,1088,1089],{"class":403,"line":410},[401,1090,1091],{},"\\AddToHook{enddocument}{Code to run at end document}\n",[401,1093,1094],{"class":403,"line":416},[401,1095,1096],{},"\\AddToHook{begindocument\u002Fend}{Code after all packages load}\n",[1073,1098,1100],{"id":1099},"environment-hooks","Environment Hooks",[392,1102,1104],{"className":394,"code":1103,"language":396,"meta":397,"style":397},"\\AddToHook{env\u002Ftabular\u002Fbegin}{Code before every tabular}\n\\AddToHook{env\u002Ftabular\u002Fend}{Code after every tabular}\n",[383,1105,1106,1111],{"__ignoreMap":397},[401,1107,1108],{"class":403,"line":404},[401,1109,1110],{},"\\AddToHook{env\u002Ftabular\u002Fbegin}{Code before every tabular}\n",[401,1112,1113],{"class":403,"line":410},[401,1114,1115],{},"\\AddToHook{env\u002Ftabular\u002Fend}{Code after every tabular}\n",[1073,1117,1119],{"id":1118},"file-hooks","File Hooks",[392,1121,1123],{"className":394,"code":1122,"language":396,"meta":397,"style":397},"\\AddToHook{file\u002Fbefore}{Code before file is input}\n\\AddToHook{file\u002Fafter}{Code after file is input}\n",[383,1124,1125,1130],{"__ignoreMap":397},[401,1126,1127],{"class":403,"line":404},[401,1128,1129],{},"\\AddToHook{file\u002Fbefore}{Code before file is input}\n",[401,1131,1132],{"class":403,"line":410},[401,1133,1134],{},"\\AddToHook{file\u002Fafter}{Code after file is input}\n",[1073,1136,1138],{"id":1137},"packageclass-hooks","Package\u002FClass Hooks",[392,1140,1142],{"className":394,"code":1141,"language":396,"meta":397,"style":397},"\\AtEndOfPackage{Code to run after package loads}\n\\AtEndOfClass{Code to run after class loads}\n",[383,1143,1144,1149],{"__ignoreMap":397},[401,1145,1146],{"class":403,"line":404},[401,1147,1148],{},"\\AtEndOfPackage{Code to run after package loads}\n",[401,1150,1151],{"class":403,"line":410},[401,1152,1153],{},"\\AtEndOfClass{Code to run after class loads}\n",[367,1155,1157],{"id":1156},"key-value-options-modern","Key-Value Options (Modern)",[357,1159,1160,1161,1164],{},"Since June 2022, the LaTeX kernel supports key-value options via ",[383,1162,1163],{},"\\DeclareKeys",":",[392,1166,1168],{"className":394,"code":1167,"language":396,"meta":397,"style":397},"\\DeclareKeys{\n  mypackage.color .initial = blue,\n  mypackage.color .default = red,\n  mypackage.verbose .Boolean = false,\n  mypackage.size .store_in = \\mypkg@size,\n  mypackage.size .initial = 10pt,\n}\n\n\\ProcessKeyOptions[mypackage]\n",[383,1169,1170,1175,1180,1185,1190,1195,1200,1204,1208],{"__ignoreMap":397},[401,1171,1172],{"class":403,"line":404},[401,1173,1174],{},"\\DeclareKeys{\n",[401,1176,1177],{"class":403,"line":410},[401,1178,1179],{},"  mypackage.color .initial = blue,\n",[401,1181,1182],{"class":403,"line":416},[401,1183,1184],{},"  mypackage.color .default = red,\n",[401,1186,1187],{"class":403,"line":423},[401,1188,1189],{},"  mypackage.verbose .Boolean = false,\n",[401,1191,1192],{"class":403,"line":429},[401,1193,1194],{},"  mypackage.size .store_in = \\mypkg@size,\n",[401,1196,1197],{"class":403,"line":434},[401,1198,1199],{},"  mypackage.size .initial = 10pt,\n",[401,1201,1202],{"class":403,"line":440},[401,1203,522],{},[401,1205,1206],{"class":403,"line":446},[401,1207,420],{"emptyLinePlaceholder":419},[401,1209,1210],{"class":403,"line":452},[401,1211,1212],{},"\\ProcessKeyOptions[mypackage]\n",[1073,1214,1216],{"id":1215},"key-types","Key Types",[1218,1219,1220,1233],"table",{},[1221,1222,1223],"thead",{},[1224,1225,1226,1230],"tr",{},[1227,1228,1229],"th",{},"Type",[1227,1231,1232],{},"Description",[1234,1235,1236,1247,1260,1270,1280],"tbody",{},[1224,1237,1238,1244],{},[1239,1240,1241],"td",{},[383,1242,1243],{},".initial",[1239,1245,1246],{},"Sets initial value",[1224,1248,1249,1254],{},[1239,1250,1251],{},[383,1252,1253],{},".default",[1239,1255,1256,1257],{},"Value when key is used without ",[383,1258,1259],{},"=",[1224,1261,1262,1267],{},[1239,1263,1264],{},[383,1265,1266],{},".store_in",[1239,1268,1269],{},"Stores value in a command",[1224,1271,1272,1277],{},[1239,1273,1274],{},[383,1275,1276],{},".Boolean",[1239,1278,1279],{},"True\u002Ffalse key",[1224,1281,1282,1287],{},[1239,1283,1284],{},[383,1285,1286],{},".choice",[1239,1288,1289],{},"Multiple choice key",[1073,1291,1293],{"id":1292},"example-with-choices","Example with Choices",[392,1295,1297],{"className":394,"code":1296,"language":396,"meta":397,"style":397},"\\DeclareKeys{\n  mypkg.alignment .choices = {\n    left, center, right\n  },\n  mypkg.alignment .initial = center,\n  mypkg.alignment .code = \\def\\mypkg@align{#1},\n}\n\n\\ProcessKeyOptions[mypackage]\n",[383,1298,1299,1303,1308,1313,1318,1323,1328,1332,1336],{"__ignoreMap":397},[401,1300,1301],{"class":403,"line":404},[401,1302,1174],{},[401,1304,1305],{"class":403,"line":410},[401,1306,1307],{},"  mypkg.alignment .choices = {\n",[401,1309,1310],{"class":403,"line":416},[401,1311,1312],{},"    left, center, right\n",[401,1314,1315],{"class":403,"line":423},[401,1316,1317],{},"  },\n",[401,1319,1320],{"class":403,"line":429},[401,1321,1322],{},"  mypkg.alignment .initial = center,\n",[401,1324,1325],{"class":403,"line":434},[401,1326,1327],{},"  mypkg.alignment .code = \\def\\mypkg@align{#1},\n",[401,1329,1330],{"class":403,"line":440},[401,1331,522],{},[401,1333,1334],{"class":403,"line":446},[401,1335,420],{"emptyLinePlaceholder":419},[401,1337,1338],{"class":403,"line":452},[401,1339,1212],{},[357,1341,1342,1343,1346],{},"This is the recommended approach for modern package development, replacing the older ",[383,1344,1345],{},"\\DeclareOption"," pattern for complex options.",[1348,1349,1350],"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":397,"searchDepth":410,"depth":410,"links":1352},[1353,1354,1355,1356,1362],{"id":369,"depth":410,"text":370},{"id":463,"depth":410,"text":464},{"id":843,"depth":410,"text":844},{"id":1067,"depth":410,"text":1068,"children":1357},[1358,1359,1360,1361],{"id":1075,"depth":416,"text":1076},{"id":1099,"depth":416,"text":1100},{"id":1118,"depth":416,"text":1119},{"id":1137,"depth":416,"text":1138},{"id":1156,"depth":410,"text":1157,"children":1363},[1364,1365],{"id":1215,"depth":416,"text":1216},{"id":1292,"depth":416,"text":1293},"Learn how to create your own LaTeX packages and classes to organize commands and environments.","md",null,{},{"title":268,"description":1366},"Y8BIdyuNdRPa9JRx2iwIKzbb0LXV82AfIZI2yDUp6Ew",[1373,1375],{"title":264,"path":265,"stem":266,"description":1374,"children":-1},"Learn the Plain TeX programming language, including catcodes, macros, registers, conditionals, and loops.",{"title":272,"path":273,"stem":274,"description":1376,"children":-1},"Learn how to create documentation for LaTeX packages using .dtx files.",1785155513307]