= LaTeχ == document classes cas-sc.cls / cas-dc.cls:: https://support.stmdocs.in/wiki/index.php?title=Elsarticle_-_CAS memoir:: https://www.ctan.org/pkg/memoir == caption/label order # LaTeX floats caption/label order \begin{figure} % whatever \caption{Caption} \label{referenceid} \end{figure} == font loading packages do not use fontenc and fontspec together. LuaLaTeX, XeLaTeX: use fontspec pdflatex: use fontenc = LuaLaTeχ • https://wiki.luatex.org/index.php/Main_Page • Writing Lua in Teχ: https://wiki.luatex.org/index.php/Writing_Lua_in_TeX • Attributes: https://wiki.luatex.org/index.php/Attributes • Callbacks: https://wiki.luatex.org/index.php/Callbacks • Practical use of Lua: https://tex.stackexchange.com/q/197485 • https://wiki.luatex.org/index.php/TeX_without_TeX • https://wiki.luatex.org/index.php/TeX_without_TeX_revised_and_expanded == Control sequences and relations to nodes cs node explanation \hbox hlist horizontal box \vbox vlist vertical box with the baseline at the bottom \vtop vlist vertical box with the baseline at the top \hskip glue horizontal skip with optional stretch and shrink \vskip glue vertical skip with optional stretch and shrink \kern kern horizontal or vertical fixed skip \discretionary disc hyphenation point (pre, post, replace) \char glyph a character \hrule rule a horizontal rule \vrule rule a vertical rule \textdir(ection) dir a change in text direction == LuaTeχ node types node.id ∈ hlist (0) vlist (1) rule (2) ins (3) mark (4) adjust (5) boundary (6) disc (7) whatsit (8) local_par (9) dir (10) math (11) glue (12) kern (13) penalty (14) unset (15) style (16) choice (17) noad (18) radical (19) fraction (20) accent (21) fence (22) math_char (23) sub_box (24) sub_mlist (25) math_text_char (26) delim (27) margin_kern (28) glyph (29) align_record (30) pseudo_file (31) pseudo_line (32) page_insert (33) split_insert (34) expr_stack (35) nested_list (36) span (37) attribute (38) glue_spec (39) attribute_list (40) temp (41) align_stack (42) movement_stack (43) if_stack (44) unhyphenated (45) hyphenated (46) delta (47) passive (48) shape (49) node.fields() node.subtypes() node.next of type node: the next node in a list, or nil node.id of type number: the node’s type (id) number node.subtype of type number: the node subtype identifier CTAN package nodetree dumps the nodes present in the document to the CLI == LuaLaTeχ-specific control sequences \directluaname{C}{L} execute Lua code L in chunk C \catcode`\^^M=12 prevents Lua code to collapse into one line in \directlua \attribute INT=NUM set 16bit attribute ID INT to 32-bit value NUM \attributedef\CS=INT define \CS as synonym of attribute INT \CS=NUM set attribute to vallue == Lua API texio.write_nl(X) write X to logfile tex.print{"a", "b"} equals "a\nb" in Teχ (start-new-line mode) tex.sprint{"a", "b"} equals "ab" in Teχ (middle-of-line mode) tex.tprint(X, Y) calls tex.sprint(X) and then tex.sprint(Y) tex.count counters table tex.box boxes table tex.attribute attributes table tex.getattribute(INT) get value of attribute, equals tex.attribute[INT] tex.setattribute(INT, NUM) set value of attribute to NUM tex.setattribute("global", INT, NUM) set value of attribute to NUM globally callback.register(NAME, FN) register FN as callback for NAME callback.register(NAME, false) unregister callback for NAME callback.list() get table of callbacks callback.find(NAME) get existing callback for NAME (or false or nil) = Teχ == List of primitives https://www.tug.org/utilities/plain/cseq.html https://www.overleaf.com/learn/latex/TeX_primitives_listed_by_TeX_engine == units pt 1/72.27in mm cm in ex em mu 1/18em sp 65536sp=1pt == common lengths → https://www.overleaf.com/learn/latex/Lengths_in_LaTeX \setlength{\name}{value} \name semantics --------------- ------------------------------------------------------------------------ \baselineskip Vertical distance between lines in a paragraph \columnsep Distance between columns \columnwidth The width of a column \evensidemargin Margin of even pages, commonly used in two-sided documents such as books \linewidth Width of the line in the current environment. \oddsidemargin Margin of odd pages, commonly used in two-sided documents such as books \paperwidth Width of the page \paperheight Height of the page \parindent Paragraph indentation \parskip Vertical space between paragraphs \tabcolsep Separation between columns in a table (tabular environment) \textheight Height of the text area in the page \textwidth Width of the text area in the page \topmargin Length of the top margin == LaTeχ math environment naming $…$ \(…\) \begin{math}…\end{math} inline math \[…\] \begin{equation}…\end{equation} \begin{displaymath}…\end{displaymath} display math block == box primitives → https://en.wikibooks.org/wiki/LaTeX/Boxes \mbox{T} box which fits text T, robust command enters LR mode (which e.g. does not ignore spaces and never creates a new line) to process T \fbox{T} \mbox with a frame around it \fbox{\mbox{T}} equals \fbox{T} \makebox{T} box which fits text T, fragile command \makebox[W]{T} box which fits text T with T aligned horizontally and vertically centered, fragile command text might overflow the width, you can visualize the overflow by wrapping \makebox by \fbox \makebox[W][P]{T} box of width W with text T aligned by P P ∈ {l, r, s} where l = flushleft, r = flushright, s = interword space adjusted so text fills box exactly \framebox… like \makebox, but adds a frame. The thickness of the frame is defined by \fboxrule. The space between box and frame by \fboxsep \parbox[P]{W}{T} box of width W with text T aligned by P, fragile command enters paragraph mode to process T P ∈ {t, b} instructing to align with top or bottom line use only for short text, use minipage for more complex content \parbox[P][H][I]{W}{T} box of width W and height H with text T vertically aligned by P and horizontally aligned by I, fragile command enters paragraph mode to process T P ∈ {c, t, b} instructing to align with center or top line or bottom line I ∈ {c, t, b, s} instructing to align with top or bottom line \raisebox{D}[A][B]{T} box which fits text T by raising text T by distance D above the baseline (neg. value to lower it), fragile command A makes LaTeX think that the text extends above the current line by the amount specified B makes LaTeX think that the text extends below the current line by the amount specified \newsavebox{C} declares command C to be a bin storing boxes, global semantics, fragile command \sbox{C}{text} \mbox, but store result in C and don't typeset it like \mbox usually does, robust command \savebox{C}[W][P]{T} \makebox, but store result in C and don't typeset it like \makebox usually does, fragile command \usebox{C} typesets the box stored in command C, robust command \documentclass[a4paper]{article} \usepackage{lipsum} \begin{document} \parindent0pt \parskip10pt \lipsum[1-3] %\makebox[200pt][r]{X Kello WonlrdY} \fbox{X fbox Hello World Y} \fbox{\mbox{X fbox(mbox) Hello World Y}} \makebox{X makebox Y} \rule{30pt}{0.4pt} rule 30pt 0.4pt \rule{4em}{0.4pt} rule 4em 0.4pt \framebox[10em][s]{X framebox 10em s Y} \framebox[10em][l]{X framebox 10em l Y} \framebox[4em][s]{X framebox 4em Y} \framebox[4em][l]{X framebox 4em l Y} \framebox[4em][r]{X framebox 4em r Y} \fbox{\parbox[t]{4em}{Hello World}} savebox tests, we can render twice: \newsavebox{\boxname} \savebox{\boxname}{some content} \usebox{\boxname} \usebox{\boxname} \fbox{\parbox[t][30pt][c]{10pt}{hello world}} {% \setlength\fboxsep{20pt}% \fbox{\parbox[t][30pt][c]{10pt}{hello world}}% } \end{document}