### Format numbers and units Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Examples of spacing for units and using the siunitx package for consistent formatting. ```latex 12~kB ``` ```latex 3.6~GHz ``` ```latex 123\,456 ``` ```latex \SI{90}{\percent} ``` ```latex \SI{45}{\degreeCelsius} ``` ```latex \SI{16}{\gibi\byte} ``` ```latex \SIlist{5; 10; 15}{\milli\metre} ``` ```latex \SI{9.81}{\metre\per\second\squared} ``` ```latex \SIrange{512}{1024}{\mebi\byte} ``` ```latex \num{1234566} ``` -------------------------------- ### Label naming convention example Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Example of a self-descriptive label name using the 'tab:' prefix for tables. ```latex tab:statResults ``` -------------------------------- ### Semantic Line Breaks Example Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Demonstrates splitting text into logical phrases and structural units to improve readability and version control diffs. ```latex Obtaining metrics from large code bodies is difficult for technical and operational reasons~\cite{Moc09,GS13}. On the technical side, code dependencies make it difficult to establish the full context needed in order to parse and semantically analyse the code. This is especially true for C code, where the compilation depends on system header files, compiler-defined macros, search paths, and compile-time flags passed through the build process~\cite{Spi03r,LKA11,GG12}. The operational reasons are associated with the required throughput, though due to the relatively small number of releases we examined, this was not a major issue in this study. ``` -------------------------------- ### Balanced \left and \right pairs Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Example of balanced markup using \left and \right for parentheses in a mathematical expression. ```latex \left(\cos(x) + i \sin(x)\right)^n ``` -------------------------------- ### BibTeX @Misc schema field reference Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/schema-bib.md A comprehensive example of a @Misc entry demonstrating all supported fields in the BibTeX schema. ```bibtex @Misc{Key, Address="Publishers address. For major ones just the city", Annote="Annotation", Author="First Last or Last, First. Multiple are separated by and", Booktitle="Title properly capitalised", Chapter="A chapter number", Edition="Edition of the book, e.g. second", Editor="First Last or Last, First. Multiple are separated by and", HowPublished="If it was published in a strange way", Institution="Institution that published it", Journal="Journal name. Abreviations may exist in TEXINPUTS/*.bst", Key="Used for alphabetizing and creating a label when no author", Month="Month of publication, usual abbreviations", Note="Additional information to help the reader", Number="Number of a journal magazine to TR.", Organization="Organization sponsoring the conference.", Pages="Page numbers or range.", Publisher="Publisher's name.", DOI="Digital Object Identifier (without the DOI prefix)", URL="Uniform Resource Locator", School="Name of the school where the thesis was written.", Series="The name of a series or set of books.", Title="The work's title.", Type="Type of a technical report e.g. Research Note", Volume="The volume of a journal or multivolume book.", Date="Date is yyyy-mm-dd format. Supported by BibLaTeX", Eid="Electronic identifier, e.g. article number. Supported by JabRef.", Year="The year of publication. Numerals only." } ``` -------------------------------- ### siunitx commands for numbers and units Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Use these siunitx commands to format numbers and units with proper spacing and symbols. The commands include \qty for quantities with units and \num for numbers. ```latex \qty{7146}{s} ``` ```latex \qty{134}{\gibi\byte} ``` ```latex \qty{200}{\mebi\bit} ``` ```latex \qty{9500}{\km} ``` ```latex \num{12345} ``` ```latex \qty{-35}{\degreeCelsius} ``` -------------------------------- ### Copy schema.bib as authoring template Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/schema-bib.md Use this shell command to copy schema.bib to a new file (e.g., myrefs.bib) as the README-prescribed workflow for authoring. The command is taken from README.md:238-241. ```sh cp schema.bib myrefs.bib ``` -------------------------------- ### Fold Mark Comment Example Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Uses a level-3 fold comment to help editors organize and collapse document sections. ```latex % Advantages of model-based development {{{3 ``` -------------------------------- ### Use description environment for itemized lists Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Prefer the description environment over itemize for better formatting of labeled elements. ```latex \begin{itemize} \item \textbf{RQ1} What is the meaning of life? \end{itemize} ``` ```latex \begin{description} \item[RQ1] What is the meaning of life? \end{description} ``` -------------------------------- ### Display math delimiters Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Preferred delimiters for display math mode, using \[ ... \] instead of TeX's $ ... $. ```latex \[ ... \] ``` -------------------------------- ### Format complex mathematical formulas Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Indent elements and break lines to express the logical structure of a formula, keeping operators at the start of lines. ```latex F_{n} = \cfrac{1}{\sqrt{5}} \left(\cfrac{1 + \sqrt{5}}{2}\right)^n - \cfrac{1}{\sqrt{5}} \left(\cfrac{1 - \sqrt{5}}{2}\right)^n ``` -------------------------------- ### Declare new command for finding formatting Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Defines a new command \finding that renders its argument in boldface, used for repeated special formatting. ```latex \newcommand{\finding}[1]{\textbf{#1}} ``` -------------------------------- ### Declare new environment for license text Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Defines a new environment 'license' that renders its content in verbatim small font, used for repeated special formatting. ```latex \newenvironment{license}{\verbatim\scriptsize}{\normalsize\endverbatim} ``` -------------------------------- ### Use small caps for abbreviations Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Use \textsc for abbreviations instead of standard capital letters. ```latex \textsc{sql} ``` ```latex SQL ``` -------------------------------- ### Format numbers and units with siunitx Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Use the siunitx package to correctly format numbers, units, and negative signs according to NIST standards. ```latex It took \qty{7146}{s} to load a \qty{134}{\gibi\byte} file over a \qty{200}{\mebi\bit} connection over a distance of \qty{9500}{\km}. During the transfer \num{12345} packets were dropped. The ambient temperature was \qty{-35}{\degreeCelsius}. ``` -------------------------------- ### Inline math delimiters Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Preferred delimiters for inline math mode, using \( ... \) instead of TeX's $ ... $. ```latex \( ... \) ``` -------------------------------- ### Alternative multi-character variable in math Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Use \mathit or \mathrm for multi-character variables, as shown with 'Delta'. ```latex \mathrm{Delta} ``` -------------------------------- ### Use \Cref for symbolic references Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Reference environments with \Cref instead of explicit figure references, as recommended by the cleveref package. ```latex see~\Cref{fig:foo} ``` -------------------------------- ### Display mathematical formulas Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Use display math mode for equations and include in-text references to variables using inline math mode. ```latex \[ E = mc^2 \] This formula states that the equivalent energy (\(E\)) can be calculated as the mass (\(m\)) multiplied by the speed of light (\(c\)) squared. ``` -------------------------------- ### Punctuate equations correctly Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Ensure equations are punctuated according to the sentence structure, using a comma or period prefixed by \, for proper spacing. ```latex The atomic age started with the establishment of the mass–energy equivalence, \[ E = mc^2 \,. \] ``` -------------------------------- ### Multi-character variable in math Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Use \mathit or \mathrm for multi-character variables, as shown with 'Delta'. ```latex \mathit{Delta} ``` -------------------------------- ### booktabs rules for tables Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/readme.md Use booktabs commands for horizontal rules in tables when required, instead of \hline and vertical lines. ```latex \toprule ``` ```latex \midrule ``` ```latex \bottomrule ``` -------------------------------- ### Create an en-dash Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Use two dashes to create an en-dash for number ranges. ```latex -- ``` ```latex 2009--2015 ``` -------------------------------- ### Create an em-dash Source: https://github.com/dspinellis/latex-advice/blob/master/README.md Use three dashes to create an em-dash for parenthetical phrases. ```latex --- ``` -------------------------------- ### @InProceedings BibTeX entry template Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/types.md Template for an @InProceedings entry in schema.bib. Required fields are Title, Author, Booktitle, and Year. Note that URL appears twice in the source (lines 133 and 148). ```bibtex @InProceedings{Key, Title="Required", URL="Optional", DOI="Optional", Author="Required", Booktitle="Required", Location="Optional", Month="Optional", Date="Optional", Eid="Optional", Year="Required", Organization="Optional", Pages="Optional", Editor="Optional", Address="Optional", Publisher="Optional", Note="Optional", URL="Optional" } ``` -------------------------------- ### @Manual BibTeX entry template Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/types.md Template for an @Manual entry in schema.bib. Only Title is required; Key is needed if no Author is present. Annote is the only field with an Annotation requirement. ```bibtex @Manual{Key, Address="Optional", Annote="Annotation", Author="Optional", Edition="Optional", Key="Optional (needed if no Author)", Month="Optional", Note="Optional", Organization="Optional", Title="Required", URL="Optional", Date="Optional", Eid="Optional", Year="Optional" } ``` -------------------------------- ### Minimal @Article entry following Required fields Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/api-reference/schema-bib.md Construct a minimal journal article entry by following the @Article template's Required fields (schema.bib:45-61). Values are shaped per the master entry's documentation; note that Required/Optional markers are advisory and not enforced by a tool. ```bibtex @Article{Ker08, Title="The Elements of Programming Style", Author="Kernighan, Brian", Journal="The Bell System Technical Journal", Year="2008", URL="Optional", DOI="Optional", Volume="Optional" } ``` -------------------------------- ### BibTeX @Book entry template Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/types.md Template for a BibTeX @Book entry. Required fields are Title, Author or Editor, Publisher, and Year. All other fields are optional, including URL, Edition, Series, Volume, Address, Month, Date, Eid, Note, and ISBN. ```bibtex @Book{Key, Title="Required", URL="Optional", Edition="Optional", Series="Optional", Volume="Optional", Author="Required or Editor", Editor="Required or Author", Publisher="Required", Address="Optional", Month="Optional", Date="Optional", Eid="Optional", Year="Required", Note="Optional", ISBN="Optional" } ``` -------------------------------- ### @InBook BibTeX entry template Source: https://github.com/dspinellis/latex-advice/blob/master/_autodocs/types.md Template for the @InBook entry type. Required fields: Publisher, Title, Year, and either Author or Editor, and either Chapter or Pages. Optional fields include Address, Edition, Month, Note, Series, URL, Volume, Date, and Eid. ```bibtex @InBook{Key, Address="Optional", Author="Required or Editor", Chapter="Required or Pages", Edition="Optional", Editor="Required or Author", Month="Optional", Note="Optional", Pages="Required or Chapter", Publisher="Required", Series="Optional", Title="Required", URL="Optional", Volume="Optional", Date="Optional", Eid="Optional", Year="Required" } ```