• What is the reason for starting preamble comment with a space in TeX and MF?
    by Igor Liferenko on October 19, 2026 at 2:35 am

    Run commands: tex 'story \end' dvitype story Preamble comment is: ' TeX output 2026.10.18:0927' The leading space is added in §617 of tex.web. Why? Run commands: mf '\nodisplays; input cmr10' gftype cmr10.2602gf Preamble comment is: ' METAFONT output 2026.10.18:0928'

  • On the Numerical Justification of Table of Contents Entries
    by Jethro on October 18, 2026 at 6:46 pm

    MWE: \documentclass[openany]{book} \usepackage{tocloft} \renewcommand{\thechapter}{\Roman{chapter}} \setlength{\cftchapnumwidth}{3em}% Width of chapter numbers in ToC \renewcommand{\cftchapaftersnum}{.} % Add a period after each chapter number in ToC \renewcommand{\cftchapleader}{\dotfill} \begin{document} \tableofcontents \chapter{This is the First Chapter} \chapter{This is the Second Chapter} \chapter{This is the Third Chapter} \end{document} Hence, the Table of Contents: Notice that the three Contents entries are left justified according to the beginning of each Roman numeral. How may I produce these entries right justified according to the periods immediately after the Roman numerals?

  • Table lines and alignment
    by azetina on October 18, 2026 at 3:57 pm

    Consider the following MWE: \documentclass[11pt,border=6pt]{standalone} \usepackage{mathptmx} \usepackage{booktabs} \usepackage{array} \usepackage{multirow} \renewcommand{\arraystretch}{1.15} \begin{document} \setlength{\tabcolsep}{7pt} \begin{tabular}{c|cc|cc|cc|cc|cc} \toprule[1.2pt] \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\textbf{Line}\\\textbf{number}\end{tabular}} & \multicolumn{10}{c}{\textbf{Column number}} \\ \cmidrule(l){2-11} & \multicolumn{2}{c|}{\textit{00--09}} & \multicolumn{2}{c|}{\textit{10--19}} & \multicolumn{2}{c|}{\textit{20--29}} & \multicolumn{2}{c|}{\textit{30--39}} & \multicolumn{2}{c}{\textit{40--49}} \\ \midrule \textit{00} & 15544 & 80712 & 97742 & 21500 & 97081 & 42451 & 50623 & 56071 & 28882 & 28739 \\ \textit{01} & 01011 & 21285 & 04729 & 39986 & 73150 & 31548 & 30168 & 76189 & 56996 & 19210 \\ \textit{02} & 47435 & 53308 & 40718 & 29050 & 74858 & 64517 & 93573 & 51058 & 68501 & 42723 \\ \textit{03} & 91312 & 75137 & 86274 & 59834 & 69844 & 19853 & 06917 & 17413 & 44474 & 86530 \\ \textit{04} & 12775 & 08768 & 80791 & 16298 & 22934 & 09630 & 98862 & 39746 & 64623 & 32768 \\ \addlinespace[4pt] \textit{05} & 31466 & 43761 & 94872 & 92230 & 52367 & 13205 & 38634 & 55882 & 77518 & 36252 \\ \textit{06} & 09300 & 43847 & 40881 & 51243 & 97810 & 18903 & 53914 & 31688 & 06220 & 40422 \\ \textit{07} & 73582 & 13810 & 57784 & 72454 & 68997 & 72229 & 30340 & 08844 & 53924 & 89630 \\ \textit{08} & 11092 & 81392 & 58189 & 22697 & 41063 & 09451 & 09789 & 00637 & 06450 & 85990 \\ \textit{09} & 93322 & 98567 & 00116 & 35605 & 66790 & 52965 & 62877 & 21740 & 56476 & 49296 \\ \addlinespace[4pt] \textit{10} & 80134 & 12484 & 67089 & 08674 & 70753 & 90959 & 45842 & 59844 & 45214 & 36505 \\ \textit{11} & 97888 & 31797 & 95037 & 84400 & 76041 & 96668 & 75920 & 68482 & 56855 & 97417 \\ \textit{12} & 92612 & 27082 & 59459 & 69380 & 98654 & 20407 & 88151 & 56263 & 27126 & 63797 \\ \textit{13} & 72744 & 45586 & 43279 & 44218 & 83638 & 05422 & 00995 & 70217 & 78925 & 39097 \\ \textit{14} & 96256 & 70653 & 45285 & 26293 & 78305 & 80252 & 03625 & 40159 & 68760 & 84716 \\ \addlinespace[4pt] \textit{15} & 07851 & 47452 & 66742 & 83331 & 54701 & 06573 & 98169 & 37499 & 67756 & 68301 \\ \textit{16} & 25594 & 41552 & 96475 & 56151 & 02089 & 33748 & 65289 & 89956 & 89559 & 33687 \\ \textit{17} & 65358 & 15155 & 59374 & 80940 & 03411 & 94656 & 69440 & 47156 & 77115 & 99463 \\ \textit{18} & 09402 & 31008 & 53424 & 21928 & 02198 & 61201 & 02457 & 87214 & 59750 & 51330 \\ \textit{19} & 97424 & 90765 & 01634 & 37328 & 41243 & 33564 & 17884 & 94747 & 93650 & 77668 \\ \bottomrule[1.2pt] \end{tabular} \end{document} How can I: Ensure the vertical lines and horizontal line connect beside "Line number"; that is form like a T. See image. "Line number" should be bottom aligned with 00-09. As is, it is centered vertically using multirow. Everything else should remain the same.

  • Why are end-of-lines commented out, but lines can be indented?
    by ltcomdata on October 17, 2026 at 11:46 pm

    Looking over many examples of LaTeX code in macro definitions, I often find a % at the end of a line --- so that no extraneous spaces are somehow imported into the macro by the end of line character. However, at the same time, I notice that these same macros often have many lines starting wit indentations --- presumably to make the code readable. How come the code can be indented at all? Why should every line in the macro have any opening spaces at all? Isn't the point of % to avoid extraneous spaces? Why do we care about that at the end of the line, but do not care about it at the beginning of the line?

  • How to make the `\ddots` centering of the bounding box?
    by Explorer on October 17, 2026 at 4:37 pm

    This post is similar to this one, but not exactly the same... With the following code: \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{matrix} \setlength{\fboxsep}{0pt} \begin{document} \[ \begin{tikzpicture} \matrix (magic) [ matrix of math nodes, nodes={circle,draw=magenta,minimum size=1cm}, left delimiter=(, right delimiter=) ] { 1 \\ & 1 \\ & & \ddots \\ & & & \fbox{$\ddots$} \\ & & & & 1 \\ }; \draw[teal,dashed] (magic-1-1.center) -- (magic-5-5.center); \end{tikzpicture} \] \end{document} What I want was the following: only typeset three dots, thus \Ddots with nicematrix was not so flexible; I want the "slope" of \ddots was parallel with the teal,dashed line; I want to ellnimate the extra height of the bounding box of \ddots(why?It looks not good...) It recalled the classical \rvdots here, and we know: $ latexdef \ddots \ddots: macro:->\protect \ddots \ddots : macro:->\mathinner {\mkern 1mu\raise 7\p@ \vbox {\kern 7\p@ \hbox {.}}\mkern 2mu \raise 4\p@ \hbox {.}\mkern 2mu\raise \p@ \hbox {.}\mkern 1mu} I guessed slightly modify the commands could help? Any suggestions? \makeatletter % \DeclareRobustCommand{\rvdots}{% % \vbox{ % \baselineskip4\p@\lineskiplimit\z@ % \kern-\p@ % \hbox{.}\hbox{.}\hbox{.} % }} \DeclareRobustCommand{\rddots}{% \mathinner {% \mkern 1mu\raise 7\p@% \vbox{\kern 1\p@ \hbox {.}}% \mkern 0.4mu \raise 4\p@ \hbox {.}% \mkern 0.4mu\raise \p@ \hbox {.}% \mkern 1mu% }% } \makeatother Edit1 If I zoomed in with with cfr's answer: \makeatletter \newcommand\exddots {% \mathinner {% \mkern 1mu\raise 3.5\p@ % 7 -> 3.5 \vbox {\kern 0\p@ \hbox {.}}% 7 -> 0 \mkern 2mu \raise -0.5\p@ \hbox{.}% 4 -> -0.5 \mkern 2mu \raise -4\p@ \hbox{.}% \p@ -> -4 \mkern 1mu }% } \makeatother Edit2 Just to show the example of cfr's comment: Is the content or, at least, the size of the content in the matrix fixed? because the angle of the diagonal obviously will vary if that varies. so unless you want this only as a one-off, you maybe need to think about how this should work. should \exddots really look different each time and different from any use in maths mode? or do you want to fix the matrix dimensions to keep the angle constant? or ...? I don't think it will look so good if the dots look different in different cases. at least, that is not how it usually would work in latex? \documentclass{article} \usepackage{amsmath} \usepackage{nicematrix} \usepackage{tikz} % \usepackage{kpfonts-otf} \begin{document} \[ \begin{pNiceMatrix} 3 & & & \\ & 555 & & \\ & & \ddots & \\ & & & 66666 \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix}\qquad \begin{pNiceMatrix} 3 & & & \\ & 555 & & \\ & & \Ddots & \\ & & & 66666 \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix} \] \[ \begin{pNiceMatrix} a & & & \\ & b & & \\ & & \ddots & \\ & & & d \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix}\qquad \begin{pNiceMatrix} a & & & \\ & b & & \\ & & \Ddots & \\ & & & d \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix} \] \[ \begin{pNiceMatrix} x & & & & \\ & x+y & & & \\ & & \ddots & & \\ & & & \sqrt{x-y} & \\ & & & & \dfrac{x}{y} \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix}\qquad \begin{pNiceMatrix} x & & & & \\ & x+y & & & \\ & & \Ddots & & \\ & & & \sqrt{x-y} & \\ & & & & \dfrac{x}{y} \CodeAfter \tikz{ \draw[teal, ultra thin] (1-1.center) -- (4-4.center); \draw[magenta, ultra thin] (2-2.south east) -- (4-4.north west); } \end{pNiceMatrix} \] \end{document} With latin-modern-math: With kpfonts-otf:

  • How to perform vector operations and print the result directly in luacas?
    by minthao_2011 on October 17, 2026 at 5:29 am

    I am using the luacas package to handle symbolic math and compute coordinates. Currently, to display the vector $\vec{AB}$ from two points $A$ and $B$, I have to subtract and print each component individually like this: \documentclass[12pt]{article} \usepackage{amsthm} \theoremstyle{definition} \newtheorem{ex}{Example} \usepackage{luacas} \usepackage{esvect} \begin{document} \begin{ex} \begin{CAS} A = {sqrt(2), -2/7, 3/5} B = {sqrt(8), -14/29, 3*sqrt(3)} \end{CAS} \[\displaystyle A=\left(\print{A[1]};\print{A[2]};\print{A[3]} \right), \quad B=\left(\print{B[1]};\print{B[2]};\print{B[3]} \right).\] \[ \vv{AB}=\left(\print{simplify(B[1]-A[1])};\print{B[2]-A[2]};\print{B[3]-A[3]} \right) .\] \end{ex} \end{document} This approach makes the code repetitive and messy. I would like to simplify the workflow by computing the vector directly within the CAS environment and printing it in one go, like this: \begin{CAS} A = {sqrt(2), -2/7, 3/5} B = {sqrt(8), -14/29, 3*sqrt(3)} vAB = B - A \end{CAS} \[\vv{AB} = \print{vAB}\] However, doing this directly does not work as expected. I got the massage: [string "A = {sqrt(Integer('2')), -Integer('2')/Intege..."]:1: attempt to perform arithmet ic on a table value (global 'B') stack traceback: [string "A = {sqrt(Integer('2')), -Integer('2')/Intege..."]:1: in local 'exe' ...26/texmf-dist/tex/lualatex/luacas/test/luacas-parser.lua:329: in function ' CASparse' [\directlua]:1: in main chunk. \luacode@dbg@exec ...code@maybe@printdbg {#1} #1 } l.15 \end {CAS} ? Is there a way to define a custom function, a macro, or use a specific luacas command/method so that I can compute $vAB = B - A$ (or simplify it) and print it cleanly without accessing each index manually?

  • \TblrNote eats space
    by user20478285 on October 15, 2026 at 10:32 pm

    \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{booktabs} \begin{document} \begin{table} \centering \small \begin{talltblr}[ note{a} = {Foo!}, caption = {Some Table.} ]{colspec={ll}} \toprule A & B \\ \midrule Foo\TblrNote{a} Bar & 1 \\ Foo\TblrNote{a}~Bar & 2 \\ Foo\TblrNote{a}{} Bar & 3 \\ Foo\TblrNote{a}\ Bar & 4 \\ \bottomrule \end{talltblr} \end{table} \end{document} How can I get normal space between the words Foo and Bar (like I would with \footnote) when using \TblrNote? None of the 3 approaches I tried seems to work.

  • Why is an appendix referenced as chapter in TeXLive 2024 or above?
    by miticollo on October 15, 2026 at 3:21 am

    Let's consider the following MWE \documentclass{report} \usepackage{cleveref} \begin{document} \appendix \chapter{Title}\label{t} This is a \namecref{t} \end{document} Now compile it using TeXLive 2026 and 2023. Then compare them. TeXLive 2026 TeXLive 2023 Well, I don't understand why in TeXLive 2023 (or 2022) appears appendix while in TeXLive 2024 and above is chapter. I also noticed another thing. Inspecting foo.aux I found \newlabel{t@cref}{{[chapter][1][]A}{[1][1][]1}{}{}{}} in TexLive 2026 \newlabel{t@cref}{{[appendix][1][2147483647]A}{[1][1][]1}} in TeXLive 2023 As always I compiled this MWE with latexmk -Werror -halt-on-error -file-line-error -lualatex ./foo.tex I tried also with -pdflatex but I got the same result.

  • Why should I continue learning LaTeX?
    by Sourav on October 13, 2026 at 6:11 pm

    I started learning (and using) LaTeX almost two years ago. But I see now that AI can produce the code for whatever I may want in a few seconds. This has demotivated me to continue learning more about LaTeX. Should I continue learning it ? If yes, why ? Just for the sake of enjoyment ? Or, are there more practical reasons ?

  • Two Greek alphabetical sets: Key 'fontspec-opentype/Language' accepts only a fixed set of choices
    by user41063 on October 13, 2026 at 2:57 pm

    I am working on a font that includes two sets of the Greek alphabet, allowing for the choice between them. The code is as follows: \documentclass{article} \usepackage{fontspec} \usepackage[ancientgreek,italian,provide*=*]{babel} \babelfont[ancientgreek,italian]{rm}[Ligatures=TeX,Numbers={Lining, Proportional},RawFeature=+calt]{ContemporaryGaramond} \usepackage{etoolbox} \newrobustcmd\greekalt[1]{{\addfontfeature{StylisticSet=2}#1}} \begin{document} \begin{otherlanguage}{ancientgreek} Θουκυδίδης Ἀθηναῖος ξυνέγραψε τὸν πόλεμον τῶν Πελοποννησίων καὶ Ἀθηναίων, ὡς ἐπολέμησαν πρὸς ἀλλήλους, ἀρξάμενος εὐθὺς καθισταμένου καὶ ἐλπίσας μέγαν τε ἔσεσθαι καὶ ἀξιολογώτατον τῶν προγεγενημένων, τεκμαιρόμενος ὅτι ἀκμάζοντές τε ᾖσαν ἐς αὐτὸν ἀμφότεροι παρασκευῇ τῇ πάσῃ καὶ τὸ ἄλλο Ἑλληνικὸν ὁρῶν ξυνιστάμενον πρὸς ἑκατέρους, \end{otherlanguage} \bigskip \begin{otherlanguage}{ancientgreek} \greekalt{Θουκυδίδης Ἀθηναῖος ξυνέγραψε τὸν πόλεμον τῶν Πελοποννησίων καὶ Ἀθηναίων, ὡς ἐπολέμησαν πρὸς ἀλλήλους, ἀρξάμενος εὐθὺς καθισταμένου καὶ ἐλπίσας μέγαν τε ἔσεσθαι καὶ ἀξιολογώτατον τῶν προγεγενημένων, τεκμαιρόμενος ὅτι ἀκμάζοντές τε ᾖσαν ἐς αὐτὸν ἀμφότεροι παρασκευῇ τῇ πάσῃ καὶ τὸ ἄλλο Ἑλληνικὸν ὁρῶν ξυνιστάμενον πρὸς ἑκατέρους,} \end{otherlanguage} \end{document} Compilation halts, and I receive this error: ! LaTeX Error: Key 'fontspec-opentype/Language' accepts only a fixed set of (LaTeX) choices. For immediate help type H <return>. ... l.15 ...ενον πρὸς ἑκατέρους,} ? and: The key 'fontspec-opentype/Language' only accepts predefined values, and 'Ancient Greek' is not one of these. However, if I press "Enter," the file compiles correctly: Is there a way to avoid this error (and the potential consequences it might entail)? Thanks. PS I'm probably mistakenly mixing "classical mode" (which supports ancientgreek) and "modernmode" (which doesn't). But if I modify the code with: \documentclass{article} \usepackage{fontspec} \usepackage[ancientgreek,italian]{babel} \babelfont[ancientgreek,italian]{rm}[Ligatures=TeX,Numbers={Lining, Proportional},RawFeature=+calt]{ContemporaryGaramond} \usepackage{etoolbox} \newrobustcmd\greekalt[1]{{\addfontfeature{StylisticSet=2}#1}} disaster strikes because the LRoman font is searched for: /usr/local/texlive/2026/texmf-dist/tex/generic/hyph-utf8/loadhyph/loadhyph-grc .tex UTF-8 Hyphenation patterns for Ancient Greek (/usr/local/texlive/2026/texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-grc .tex))) Missing character: There is no ο (U+03BF) in font [lmroman10-regular]:+tlig;! Missing character: There is no υ (U+03C5) in font [lmroman10-regular]:+tlig;! Missing character: There is no κ (U+03BA) in font [lmroman10-regular]:+tlig;! Missing character: There is no υ (U+03C5) in font [lmroman10-regular]:+tlig;!

  • default key values and ltx-talk frames
    by David Purton on October 12, 2026 at 1:25 pm

    I want to add some extra keys to the ltx-talk frame environment. In the following MWE, \test does not return true with \begin{frame}[test]. I can get \test to return true if: I use \begin{frame}[test=true] I use \begin{frame}[name=foo, test] I call \keys_set:nn { talk / frame } { test } in the preamble What's going on? \DocumentMetadata{} \documentclass{ltx-talk} \ExplSyntaxOn \keys_define:nn { talk / frame } { test .bool_set:N = \l_dcp_test_bool, test .default:n = true } \cs_new:Npn \test { \bool_if:NTF \l_dcp_test_bool { true } { false } } \ExplSyntaxOff \begin{document} \begin{frame}[test]% works with [test=true] or [name=foo, test] test: \test \end{frame} \end{document}

  • How to create an otf math font?
    by wipet on October 9, 2026 at 6:39 am

    We have a font with almost all math characters and all sizes of braces, fences etc. Ten years ago we worked with pfb format of this font and we divided it to many subfonts and we created TeX metrics for them manually. The project was not completed and stopped. Now, the project is opened again. We decide that the old method (with many fonts and TeX metric) is obsolete and we want to create an OTF math font. Does anyone have any experience with this? What needs to be done? Yes, math font needs to have math tables inside, but how the tables can be created, what tools should be used and where is a specification of this format and good examples?

  • Is it possible to combine T1 and OTF/TTF fonts nicely?
    by Roel on October 8, 2026 at 11:03 pm

    I am trying to combine these two packages in LuaLaTeX, but cannot work out how to get both font encodings to work together nicely. Currently, to my surprise, only the bold bits are shown using the font txtt: \documentclass{article} \usepackage{fourier-otf} \usepackage{newtxtt} \usepackage[T1,TU]{fontenc} \begin{document} This is the main body text in \textbf{Erewhon Roman}. {\ttfamily\fontencoding{T1}This is typewriter text in \textbf{texttt}} \texttt{\fontencoding{T1}This is typewriter text in \textbf{texttt}} \verb|This is typewriter text in texttt| \end{document} Is there a way to make this work, ideally defining in the preamble that Erewhon is TU-encoded and txtt is T1-encoded and not switching encodings manually inside the document?

  • How to show that a sinusoidal function continues indefinitely to the left?
    by Marco Moldenhauer on October 8, 2026 at 4:18 pm

    I plotted a sinusoidal function using the axis environment from the pgfplots package. My code \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ width=50cm, height=0.80\textwidth, axis y line=middle, axis x line=middle, axis on top, % <-- Correct pgfplots key to draw ticks, grid, and lines over plots xmin=-15, xmax=5.8, ymin=-125, ymax=125, xtick={-14,-3*pi,-5*pi/2,-2*pi,-3*pi/2,-pi,-pi/2,0,1,pi/2,pi,3*pi/2,2*pi}, xticklabels={$-\inf$,$-3\cdot\pi$,$-\frac{5}{2}\cdot\pi$,$-2\cdot\pi$,$-\frac{3}{2}\cdot\pi$,$-\pi$,$-\frac{1}{2}\cdot\pi$,$0$,1,$\frac{1}{2}\cdot\pi$,$\pi$,$\frac{3}{2}\cdot\pi$,$2\cdot\pi$}, ytick={-112.5,-112.5/sqrt(2),0,112.5/sqrt(2),112.5}, yticklabels={-112.5,,0,,112.5}, legend cell align={left}, grid=both, grid style={line width=.1pt, draw=gray!10}, major grid style={line width=.2pt, draw=gray!20}, xlabel={$\alpha=\omega\cdot t$ in rad}, ylabel={$p(t)$ in Watt}, xlabel style={at={(ticklabel* cs:1)}, anchor=north west}, ylabel style={at={(ticklabel* cs:1)}, anchor=south west} ] % 1. Colored area between x = 0 and x = 1 \addplot[ domain=0:1, samples=100, fill=green!30, draw=none ] {-112.5*sin(deg(x))} \closedcycle; % 2. Colored area between x = -4*pi and x = 0 \addplot[ domain=-4*pi:0, samples=100, fill=red!30, draw=none ] {-112.5*sin(deg(x))} \closedcycle; % Main curve \addplot[ domain=-4*pi:2*pi, samples=200, smooth, blue, thick ] {-112.5*sin(deg(x))}; \end{axis} \end{tikzpicture} \end{document} My output What I would like to achieve I would like to visually indicate that the sinusoidal function continues to oscillate periodically indefinitely in the negative "x"-direction. I'm totally open to creative ideas or completely different approaches. Any suggestions are very welcome! 🙂

  • How can I depict X-ray beams as wavefronts that interfere above the sample to form a standing wave?
    by user449589 on October 7, 2026 at 7:24 am

    I'm not very skilled using TikZ but I wanted to use it for all the figures in my bachelors thesis. So far I created this TikZ-picture: \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{patterns.meta} \usetikzlibrary{decorations.pathreplacing} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{snakes} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc,patterns,angles,quotes} \usepackage[table]{xcolor} \definecolor{Minzgrün}{RGB}{0,140,79} \definecolor{Fenstergrau}{RGB}{128,128,128} \definecolor{Telegrau 4}{RGB}{230,230,230} \definecolor{Tomatenrot}{RGB}{140,28,0} \begin{document} \begin{tikzpicture} [x=0.35cm,y=0.2cm,line cap=round,line join=round] \draw[line width=1.5pt] (17.5,12.5) arc [start angle=0, end angle=180, x radius=2.5, y radius=1]; \draw [black, line width=1pt] (16,13) -- (21,14) node [align=center,right]{Detector\\window}; \draw[line width=1.5pt] (19,2) arc [start angle=0, end angle=180, x radius=4, y radius=1.5]; \draw[black,line width=1.5pt] (5,0.5) -- (25,0.5) -- (25,2) -- (5,2) -- cycle; \draw[black,line width=1.5pt] (10,25) -- (10,12.5) -- (20,12.5) -- (20,25); \draw[black,line width=1.5pt] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \fill[black,pattern=crosshatch dots] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \draw [black,line width=1pt] (12,20) -- (8.5,21) node[align=center,left] {Energy-dispersive\\detector}; \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (-5,4) -- (10,2) -- (25,4); \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (5,4) -- (20,2) -- (35,4); \node[align=center] at (0,6.5){Incident beam}; \node[align=center] at (30,6.5){Reflected beam}; \draw[black,line width=1pt] (12.5,1.25) -- (10,-2.5) node [below, align=center] {Sample carrier\\(\textit{reflector})}; \draw[black,line width=1pt] (16,2.5) -- (21,-2.5) node [below, align=center] {Sample}; \draw[Minzgrün,line width=1.25pt,->,decorate,decoration={snake,amplitude=0.1cm,segment length=0.4cm, post length=0.2cm}](15,2.5) -- (15,17); \draw [black, line width=1pt] (14,8) -- (9,12) node [align=center, left] {Fluorescence\\radiation}; \end{tikzpicture} \end{document} But I would like to include the X-ray beams as wave fronts which interfere above the sample to form a standing wave like in this image: Sadly this is beyond my TikZ-skills. Maybe somebody can help me or tell me where to look for answers. Thanks a lot!

  • Different math font in inline vs displayed styles doesn't work with \setmainfont and \mathrm: is the mathrm=sym unicode-math option safe?
    by Denis Bitouzé on October 6, 2026 at 9:01 am

    (This is a follow up of this Mico's answer to the quite old question Use different math font in inline-style and display-style formulas) For a LaTeX class I'm currently working on, based on a graphic designer work, I'm asked (but don't agree!) to use different fonts for the maths depending whether they are inline or displayed: Garamond Math for the inline ones, Concrete Math font for the displayed ones. The following MCE: \documentclass{article} \usepackage{unicode-math} \setmainfont{EBGaramond} % EBGaramond or anything else \setmathfont[version=Concrete]{Concrete-Math} \setmathfont[version=Garamond]{Garamond-Math} \mathversion{Garamond} \everymath{\mathversion{Garamond}} \everydisplay{\mathversion{Concrete}} \begin{document} \begin{enumerate} \item $2=\sqrt[4]{16}$ and \begin{equation} 2=\sqrt[4]{16} \end{equation} \item $1 \times 2$ and \begin{equation} 1 \times 2 \end{equation} \item $E=mc^2$, where $E$ stands for energy, and \begin{equation} E=mc^2 \end{equation} % \item $5=17 \pmod{12}$ and % \begin{equation*} % 5=17 \pmod{12} % \end{equation*} \end{enumerate} \end{document} (lualatex) compiles, not nicely (numerous warnings “LaTeX Font Warning: Command \mathversion invalid in math mode on input line…”), but compiles. But, as soon as its commented lines are uncommented, it doesn't compile any more, because of: ! LaTeX Error: Math alphabet identifier \mathrm is undefined in math version ` Garamond'. Note that it compiles again if \setmainfont{…} is commented. As a workaround, one can just load unicode-math with at least the mathrm=sym option. But is it safe?

  • How to display solutions of trigonometric equations in degrees in luacas?
    by minthao_2011 on October 6, 2026 at 8:36 am

    I am trying to solve the equation $\sin(5x)=\frac{1}{2}$, where $x$ is measured in degrees, using the luacas package. I tried: \documentclass{article} \usepackage{fourier-otf} \usepackage{luacas} \usepackage{amsthm} \theoremstyle{definition} \newtheorem{ex}{Example} \begin{document} \begin{ex} $x$ in degree \begin{CAS} vars("x", "k") u = 5*x v = 30 eq1 = Equation(u, v + 360*k):autosimplify() r1 = eq1:solvefor(x) eq2 = Equation(u, 180 - v + 360*k):autosimplify() r2 = eq2:solvefor(x) \end{CAS} \[ \sin(5x) = \frac{1}{2} \Leftrightarrow \sin\left(\print{u}\right)=\sin\left(\print{v}^\circ\right) \Leftrightarrow \left[ \begin{aligned} \print{u} &= \print{v} + 360 k\\ \print{u} &= 180-\print{v}+ 360 k \end{aligned} \right. \Leftrightarrow \left[ \begin{aligned} &\print{r1}\\ &\print{r2} \end{aligned} \right. \] How can I make the solutions produced by luacas be written in the following form? \[ \sin(5x) = \frac{1}{2} \Leftrightarrow \sin\left(\print{u}\right)=\sin\left(\print{v}^\circ\right) \Leftrightarrow \left[ \begin{aligned} \print{u} &= \print{v}^\circ + 360^\circ k\\ \print{u} &= 180^\circ-\print{v}^\circ+ 360^\circ k \end{aligned} \right. \Leftrightarrow \left[ \begin{aligned} &x = 6^\circ + 72^\circ k\\ & x = 30^\circ + 72^\circ k \end{aligned} \right. \] \end{ex} \end{document}

  • lua-unicode-math makes \parbox generate font warnings
    by David Purton on October 1, 2026 at 12:29 pm

    If I select a non-standard font size and then use a \parbox, I get font substitution warnings relating to maths fonts when lua-unicode-math is loaded. This happens even though I do not have any maths in my document. No warnings are produced for normal text (unless I actually include maths, of course). And unicode-math does not do this. Is this expected? Am I doing something wrong? Can I get rid of the warnings? I can use something other than a \parbox, but I have trouble with tagging with boxes… MWE % TeX Program = lualatex \documentclass{article} \usepackage{lua-unicode-math} \usepackage{fontspec} \setmainfont{Noto Serif} \begin{document} \fontsize{16pt}{24pt}\selectfont \parbox{3cm}{Some text} \end{document}

  • Is there any method to invert the even odd rule?
    by D G on October 1, 2026 at 8:37 am

    I want to get rather than Appending (0,0) circle (3.5) is fine but I am wondering whether there are any nicer approaches. odd even rule does not exist too. \documentclass[tikz,border=1cm,12pt]{standalone} \begin{document} \begin{tikzpicture}[ultra thick] \filldraw[fill=red,even odd rule] \foreach \i in {0,0.5,...,3.5}{(0,0) circle (\i)} (0,0) circle (3.5) % just a hack to invert the even odd rule ; \end{tikzpicture} \end{document}

  • Align the equal sign of two groups `aligned` with two tags
    by myhsia on September 27, 2026 at 5:45 pm

    Two aligned environments inside two equation environments (obviously, two tags), now I want to align the 4 = signs. I know I can place the middle text inside the \shortintertext or \intertext provided by the mathtools package, but how to keep only 2 numbered tags keep in the middle of each aligned group vertically? \documentclass{article} \usepackage{mathtools} \begin{document} some text \begin{equation}\label{eq:eta_quantum} \begin{aligned} abc & = defghij\\ & = \int f(x) dx, \end{aligned} \end{equation} some text \begin{equation}\label{eq:eta_classical} \begin{aligned} defghi & = defghij\\ & = \int f(x) dx, \end{aligned} \end{equation} \end{document}

  • Why does combining TikZ `patterns` and `fadings` cause rendering problems in some PDF viewers?
    by kabenyuk on September 27, 2026 at 3:47 pm

    I have come across an interesting difference in how a PDF produced by TikZ is rendered by different PDF viewers. The following MWE isolates the issue: \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns,fadings} \begin{document} \begin{tikzpicture} % Pattern only \fill[draw,pattern=north west lines] (0,0) rectangle (3,.4); % Fading only \fill[draw,path fading=east] (0,-1) rectangle (3,-.6); % Pattern + fading \fill[draw,pattern=north west lines,path fading=east] (0,-2) rectangle (3,-1.6); \end{tikzpicture} \end{document} Left: Adobe Acrobat. Right: WinEdtPDF. The same PDF file is shown in both viewers. In WinEdtPDF the first two rectangles are rendered correctly. The problem appears only in the third one, where pattern=north west lines and path fading=east are used together: the hatching is not rendered correctly. Thus, pattern=north west lines works by itself, and path fading=east works by itself. The rendering difference appears only when the two TikZ mechanisms are combined. The same PDF is rendered correctly in Adobe Acrobat, Microsoft Edge, and Firefox. The same defect as in WinEdtPDF is also visible in Google Drive's PDF preview. I initially reported this to the WinEdt developer. Alex Simonic explained that WinEdtPDF uses PDFium for rendering and that the behavior observed there is a limitation of PDFium rather than of WinEdtPDF itself: https://github.com/WinEdt-Team/WinEdt-Support/discussions/131#discussioncomment-18627725 So my question is about the TikZ/PDF side of this behavior: what does TikZ write into the PDF when a pattern and path fading are combined, and what is special about this construction that makes different PDF rendering engines handle it differently?

  • Adding -\infty and +\infty using nl-interval
    by Sebastiano on September 26, 2026 at 12:40 pm

    Is there a remote possibility to have, -\infty and +\infty, below the real line using only the package nl-interval? \documentclass{article} \usepackage{nl-interval} \begin{document} \begin{tikzpicture} \nlAxisX{-2}{5} \nlnuminf[pattern=north west lines]{1.5}[+3]{c}[.2] \end{tikzpicture} \begin{tikzpicture} \nlAxisX{-2}{5} \nlinfnum[pattern=north west lines]{1}[-5]{o}[.2] \end{tikzpicture} \begin{tikzpicture} \nlAxisX{-2}{5} \nlnumnum{-1}{o}{3}{c}[.2] \end{tikzpicture} \end{document}

  • why is TeX capacity exceeded with \DocumentMetadata{tagging=off}?
    by murray on September 26, 2026 at 1:34 am

    This source compiles just fine with the line \DocumentMetadata{tagging=off} commented out, as shown. Why, if I uncomment that line, do I get a "TeX capacity exceeded" at line 15, and how can this be fixed? \NeedsTeXFormat{LaTeX2e}[2026-06-01] % !TEX program = lualatex %\DocumentMetadata{tagging=off} \documentclass{book} \usepackage{fontspec} \usepackage{lua-unicode-math} \usepackage[thmtools-compat]{keytheorems} \newkeytheoremstyle{thmstyle}{} \AtBeginDocument{\newkeytheorem{theorem}[name=Theorem,style=thmstyle,numberwithin=chapter]} \usepackage{hyperref} \begin{document} \chapter{A chapter} \section{The section} \begin{theorem}[A key theorem] Some theorem text \end{theorem} \end{document}

  • Producing the Thirteen Stars' Distribution on the 1777 American Flag
    by DDS on September 25, 2026 at 11:48 am

    This is an extension of Replacing a Circle of Asterisks with Tikz Colored Stars Consider the code: \documentclass{book} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \definecolor{thisblue}{RGB}{10,49,97} %\definecolor{thisred}{RGB}{179,25,66} \begin{document} \thispagestyle{empty} \pagecolor{thisblue} \noindent {\LARGE\bfseries{\textcolor{white}{Twelve even-spaced stars:}}} \vspace{10pt} \begin{center} \begin{tikzpicture} \foreach \k in {0,30,...,330} \node[ shape=star, star points=5, star point ratio=2.5, minimum size=0.8cm, fill=white, draw=white ] at (\k:3.5cm) {}; \end{tikzpicture} \end{center} \vspace{40pt} \noindent {\LARGE\bfseries{\textcolor{white}{Supposed to be thirteen even-spaced stars:}}} \vspace{10pt} \begin{center} \begin{tikzpicture} \foreach \k in {0,27.69,55.38,...,332.28} \node[ shape=star, star points=5, star point ratio=2.5, minimum size=0.8cm, fill=white, draw=white ] at (\k:3.5cm) {}; \end{tikzpicture} \end{center} \end{document} which produces: The first problem (regarding the second set of stars) is that there are only twelve stars (not thirteen). The second problem should be (the way I thought I have estimated it) should be roughly according to the thirteen (original colonies) represented as stars in the original (Betsy Ross) flag (See: Betsy Ross Flag): QUESTION: What am I doing wrong? How may I replicate the star-distribution on Betsy Ross' flag? (Incidentally, I still do not understand how my code did not display thirteen stars for the second figure.) Thank you.

  • Drawing a rectangular box in three different orientations with TikZ
    by Sebastiano on September 24, 2026 at 7:26 pm

    I am preparing some physics exercises about pressure, and I would like to illustrate a rectangular box that can be placed on each of its three different faces. In this way, the same box would have three different base areas, while its dimensions remain unchanged. For example, my box has dimensions: 23 cm, 24 cm, 46 cm I would like to create the three possible orientations of the box with TikZ, so that in each drawing a different face is touching the ground. At the moment, I have this code for one orientation: \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{tikz} \begin{document} \begin{center} \begin{tikzpicture}[x=0.027cm,y=-0.027cm,line width=0.35pt,draw=black!75] \draw (77,123)--(77,199)--(146,231)--(281,163)--(281,110); \draw (146,156)--(146,231); \draw (212,55)--(212,122); \draw (77,123)--(60,84)--(126,117)--(146,156)--cycle; \draw (77,123)--(51,96)--(186,27)--(212,55)--(109,109); \draw (212,55)--(232,16)--(301,48)--(281,87)--cycle; \draw (146,156)--(281,87)--(319,91)--(184,160)--cycle; \draw[<->] (66,126)--(66,198); \draw[<->] (72,210)--(141,242); \draw[<->] (151,242)--(286,173); \node[rotate=-90,inner sep=0pt,font=\small] at (57,160) {23 cm}; \node[rotate=-25,inner sep=0pt,font=\small] at (101,233) {24 cm}; \node[rotate=27,inner sep=0pt,font=\small] at (227,213) {46 cm}; \end{tikzpicture} \end{center} \end{document} Is there a relatively simple way to modify this code (or to define a reusable TikZ command) so that I can obtain the other two orientations of the same box, with the 23 cm, 24 cm, and 46 cm dimensions exchanged accordingly? Ideally, I would like to be able to write something like \boxorientation{23}{24}{46} and obtain the corresponding drawing, or otherwise have a convenient way to generate the three possible orientations. The purpose is to use the drawings in physics exercises about pressure, where the students have to calculate the pressure exerted by the box when it rests on each of its three possible bases.

  • Modern Scientific illustrations: what can we "show off" now that wasn't possible 12 years ago?
    by DJP on September 23, 2026 at 1:05 am

    There is a highly popular post from 2014 showcasing Nice scientific pictures show off but a lot has changed with LaTeX over the last 12 years. What is your best science picture to show off now that wasn't possible 12 years ago? Constraints for each answer: The Picture & Code: Show off a beautiful scientific illustration that utilizes features, packages, or engine capabilities (e.g., LuaLaTeX memory handling, modern pgfplots limits, Luametafun) that remove barriers which routinely stopped typical users from doing this 12 years ago (such as hard memory crashes, lack of default ecosystem support, or prohibitive manual workarounds). The Evolution: You must explicitly explain what technological progress or package developmentover the last decade made this picture possible today. AI usage is allowed, but must be acknowledged per community guidelines.

  • "restore" booktabs rules above/below spacing in tabularray with `rowsep=0pt`
    by Stefan Pinnow on September 20, 2026 at 6:31 pm

    The title says it all. What needs to be done, thus that \toprule, \midrule, and bottomrule (and maybe other rules from booktabs) in a tblr environment have the additional spacing again, as they have in a regular tabular environment? Here a direct comparison in the MWE \documentclass[border=5pt,varwidth]{standalone} \usepackage{booktabs} \usepackage{tabularray} \UseTblrLibrary{booktabs} \SetTblrInner{rowsep=0pt} \begin{document} \begin{tabular}{@{}llr@{}} \toprule \multicolumn{2}{c}{Item} \\ \cmidrule(r){1-2} Animal & Description & Price (\$) \\ \midrule Gnat & per gram & 13.65 \\ & each & 0.01 \\ Gnu & stuffed & 92.50 \\ Emu & stuffed & 33.33 \\ Armadillo & frozen & 8.99 \\ \bottomrule \end{tabular} \vspace{1ex} \begin{tblr}{@{}llr@{}} \toprule \SetCell[c=2]{c} Item \\ \cmidrule[r]{1-2} Animal & Description & Price (\$) \\ \midrule Gnat & per gram & 13.65 \\ & each & 0.01 \\ Gnu & stuffed & 92.50 \\ Emu & stuffed & 33.33 \\ Armadillo & frozen & 8.99 \\ \bottomrule \end{tblr} \end{document} which results in

  • roman numerals as enumeration in italics font style
    by Rup_LA on September 20, 2026 at 2:59 pm

    I'm writing a lemma with italics font style where I need enumeration in lowercase Roman numerals. I tried different ways and the best I could do is to use the package enumerate like this: \usepackage{enumerate} \begin{document} \begin{lemma} For any graph G, \begin{enumerate}[(i)] \item L(G) is symmetric. \item L(G) is positive semidefinite. \item etc. \end{enumerate} \end{lemma} \end{document} But the problem I'm facing is the tilts of parentheses are more than that I like. Actually I want like this: Any help would be appreciated.

  • biber doesn't compile
    by Epimanes on September 19, 2026 at 8:15 pm

    Today I tried to use biber (within TeXShop) and I got this error in the console: usage: lipo <input_file> <command> [<options> ...] command is one of: -create[_album] -info -detailed_info -thin <arch> -extract <arch> [-extract <arch> ...] -remove <arch> [-remove <arch> ...] -replace <arch> <file_name> [-replace <arch> <file_name> ...] -verify_arch <arch> ... -archs options are one or more of: -arch <arch> <input_file> -o <output_file> -segalign <arch> <alignment> /Library/TeX/texbin/biber: extracting arm64 binary with lipo failed (wstatus=256) All of the error makes no sense to me. But when I google that last line, it says that it "does not contain the arm64 architecture slice." I'm wondering if this is an error having to do with the upcoming updates in the OS (???). If anyone has a solution or even a description of what is going on, I'd appreciate the help.

  • Macro for drawing intervals
    by Fabrice on September 19, 2026 at 6:04 pm

    How to modify this macro to ensure the same spacing between the first mark and the opening delimiter, and between the last mark and the closing delimiter ? \documentclass[border=5mm]{standalone} \usepackage{luatex85} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); vardef interval(expr a, b, c, d) = interim ahangle := 30; numeric u; u = 0.5cm; path l; l = (0,0) -- (8*u,0); drawarrow l; for x = (a + 0.2) step 0.2 until (b - 0.2): draw (3 down -- 3 up rotated -45) shifted (x * u, 0); endfor label(c, (2*u,0)); label(d, (6*u,0)); label.bot("$a$", (a*u,-5)); label.bot("$b$", (b*u,-5)); label.bot("$-\infty$", (0,-5)); label.bot("$+\infty$", (8*u,-5)); enddef; interval(2, 6, "[", "]"); endfig; \end{mplibcode} \end{document}