• How to test a string value with tabularray and functional? (target: coloring table cells according to their text content)
    by quark67 on April 24, 2026 at 10:31 pm

    The tabularray package provides in his manual an example of testing integers values of a table for coloring background according to the value, positive or negative. \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{functional} \begin{document} \IgnoreSpacesOn \prgNewFunction \colorBack {} { \intStepOneInline {1} {\arabic{rowcount}} { \intStepOneInline {1} {\arabic{colcount}} { \intSet \lTmpaInt {\cellGetText {##1} {####1}} \intCompareTF {\lTmpaInt} > {0} {\cellSetStyle {##1} {####1} {bg=purple8}} {\cellSetStyle {##1} {####1} {bg=olive8}} } } } \IgnoreSpacesOff \begin{tblr}{hlines,vlines,cells={r,$},process=\colorBack} -1 & 2 & 3 \\ 4 & 5 & -6 \\ 7 & -8 & 9 \\ \end{tblr} \end{document} But how to do the same, when the table contains the words Yes (light green background) and No (light red background)? First step, replacing \intSet \lTmpaInt {\cellGetText {##1} {####1}} with \strSet \lTmpaStr {\cellGetText {##1} {####1}} Second step, replacing \intCompareTF with \strCase (\strCase and \intCompareTF are described in the functional manual). So, in theory, this is working: \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{functional} \begin{document} \IgnoreSpacesOn \prgNewFunction \colorBack {} { \intStepOneInline {1} {\arabic{rowcount}} { \intStepOneInline {1} {\arabic{colcount}} { \strSet \lTmpaStr {\cellGetText {##1} {####1}} \strCase {\lTmpaStr} { {No} {\cellSetStyle {##1} {####1} {bg=red!20}} {Yes} {\cellSetStyle {##1} {####1} {bg=green!20}} } } } } \IgnoreSpacesOff \begin{tblr}{hlines,vlines,process=\colorBack} Yes & No & No \\ No & No & Yes \\ No & Yes & No \\ \end{tblr} \end{document} But the result is a table with a white background: If I replace: \strSet \lTmpaStr {\cellGetText {##1} {####1}} with the simplier: \strSet \lTmpaStr {No} in theory, all cells have a light red background. This gives this code: \strSet \lTmpaStr {No} \strCase {\lTmpaStr} { But no, they are all white. In the functional manual, I read: So, \lTmpaStr is a string no? And the manual also says: So why isn't the code: \strCase {\lTmpaStr} { {No} {\cellSetStyle {##1} {####1} {bg=red!20}} {Yes} {\cellSetStyle {##1} {####1} {bg=green!20}} correct? Where is the mistake? How coloring background cells according to the value of the cells (obtained with \cellGetText {##1} {####1}) This question is focused to the tabularray package. So I hope that coloring background according to the text content in the cells is possible with tabularray.

  • Improved visualization of the domains of integration in ℝ³
    by Sebastiano on April 24, 2026 at 9:26 pm

    Before of this question, I would like to thank the authors of the answers and everyone who appreciated my question. I had previously created these two figures related to two triple integrals. Is there a better way to improve their presentation and make them clearer and more visually appealing? T={(x, y, z) ∈ ℝ³: (x²+y²)¹/² ≤ z ≤ 1}. \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{60}{130} \begin{tikzpicture}[tdplot_main_coords,scale=3] \pgfmathsetmacro{\h}{0.6} \pgfmathsetmacro{\raggio}{\h} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {\footnotesize$x$}; \draw[dashed] (0,0,0) -- (-1.5,0,0); \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {\footnotesize$y$}; \draw[dashed] (0,0,0) -- (0,-1.5,0); \draw[thick,->] (0,0,1.0) -- (0,0,1.5) node [above] {\footnotesize$z$}; \draw[dashed] (0,0,0) -- (0,0,1.0); \foreach \altura in {0.01,0.02,...,1.0}{ \draw[cyan,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\altura*cos(\t r)},{\altura*sin(\t r)},{\altura}); } \draw[blue,thick,fill=brown!50,opacity=0.6] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[dashed,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},0); \foreach \t in {0,10,30,60,90,120,150,250,280,310}{ \draw[black,dashed,thin,opacity=0.7] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \fill[gray,opacity=0.1] (-1.2,-1.2,\h) -- (1.2,-1.2,\h) -- (1.2,1.2,\h) -- (-1.2,1.2,\h) -- cycle; \draw[red,very thick] (0,0,\h) -- (0,\raggio,\h); \node at (0,1.5,\h) {\small $z=h$}; \node at (0,0.5,0.75) {\small $z$}; \node at (0,0.25,-0.35) {\small $T(z=0)$}; \node at (0,.75,1.3) {\small $T(z=h)=T(z)$}; \end{tikzpicture} \end{center} \end{document} C= {(x,y,z)∈ ℝ³: z∈ [0, 2], x²+ y²≤ z} \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{70}{130} \begin{tikzpicture}[tdplot_main_coords,scale=2.5] \pgfmathsetmacro{\h}{.6} \pgfmathsetmacro{\raggio}{sqrt(\h)} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {$x$}; \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {$y$}; \draw[thick,->] (0,0,0) -- (0,0,1.5) node [above] {$z$}; \draw[red,very thick] plot[domain=-1:1,smooth,variable=\t] (0,{\t},{\t*\t}); \draw[blue,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[fill=yellow,dashed,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{0}) node [above] {\tiny $C(z)$}; \foreach \t in {0,10,...,350}{ \draw[gray, dashed, thin,opacity=0.4] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \foreach \altura in {0.0125,0.025,...,1.0}{ \pgfmathsetmacro{\radio}{sqrt(\altura)} \draw[cyan,thick,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } \fill[orange!30,opacity=0.4] (-1,-1,\h) -- (1,-1,\h) -- (1,1,\h) -- (-1,1,\h) -- cycle; \draw[blue,very thick] (0,0,\h) -- (0,{\raggio},\h); \node[black, above right] at (0,{\raggio/2},\h) {\tiny $\sqrt{z}$}; \draw[blue,fill=yellow,dotted,thick,opacity=0.4] plot[domain=0:360,smooth,variable=\t] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}); \draw[blue!80,thick] plot[domain=0:2*pi,smooth,variable=\t] ({cos(\t r)},{sin(\t r)},{1.0}); \end{tikzpicture} \end{center} \end{document}

  • How are tone letters defined internally in T3?
    by Grzegorz Brzęczyszczykiewicz on April 24, 2026 at 8:34 pm

    There are component parts used to build them in the T3 encoding chart, but how are they exactly built? There are 5 distinct heights, which should means 25 parts used to build tones (or 50 when short variants are included). But there are only 9 (18) parts. This must mean the program that generates the tone letters has to reposition them vertically. But how does it know the exact value of repositioning? If it raises a component piece too much, it will look jagged and uneven.

  • Ungrouped alternatives to \foreach which are still canonical to use with tikz
    by Jasper on April 24, 2026 at 7:51 pm

    Are there ungrouped alternatives to \foreach which are still canonical to use with tikz? I need to define a color in a loop and use it outside. Maybe expl3? \documentclass{article} \usepackage{pgffor,xcolor} \begin{document} \foreach \i in {1,2} {\colorlet{blah}{blue!\i}} \textcolor{blah}{blah} \end{document}

  • Why does babel warn about missing small caps font for an inactive language?
    by niru on April 24, 2026 at 6:14 pm

    With babel's onchar option, one can set fonts for multiple languages as can be seen in the following example: \documentclass{article} \usepackage{babel} \babelprovide[main,import,onchar=ids fonts]{english} \babelfont{rm}{NewCM10-Book.otf} \babelfont{sf}{NewCMSans10-Book.otf} \babelfont{tt}{NewCMMono10-Book.otf} \babelprovide[import,onchar=ids fonts]{malayalam} \babelfont[malayalam]{rm}{RIT-Rachana-Regular.ttf} \babelfont[malayalam]{sf}{RIT-MeeraNew.ttf} \babelfont[malayalam]{tt}{RIT-tnjoy-regular.ttf} \begin{document} \textsc{hii} മലയാളം \end{document} This code produces: LaTeX Font Warning: Font shape `TU/RIT-Rachana-Regular.ttf(0)/m/sc' undefined (Font) using `TU/RIT-Rachana-Regular.ttf(0)/m/n' instead on input line 13. I understand that this font doesn't have small caps which is why the warning is issued, but what I do not understand is that the main language of the document is english. As per the warning, \textsc, on line 13, is issued when there is no way Malayalam would be active; then why does the font warning for Malayalam's font appear? By the way, the warning goes if I add [SmallCapsFont=RIT-Rachana-Regular.ttf] to the font declaration. This warning is quite pointless as despite declaring the small caps font for Malayalam, the actual small caps text is (correctly) printed with English's font. Then... why?

  • AUCTeX/RefTeX: How do I handle labels that are arguments of a macro?
    by jjramsey on April 24, 2026 at 1:12 pm

    I'm working with an employer-provided LaTeX class where the tables and figures are handled in macros rather than environments, i.e, something like this: \ExampleFigMacro{fig:myfiglabel}{myfigure}{mycaption} If this were an environment, I'd try the solution discussed at https://tex.stackexchange.com/a/464901/195164, but this is just a macro. Is there a way to get AUCTeX to recognize that macro and extract fig:myfiglabel so that it can be used by RefTeX?

  • Tikz pie chart with units
    by Thomas on April 24, 2026 at 1:07 pm

    I have a pie chart representing a distribution of hours, and I'm using the option sum=auto to display the chat by these values. But I'd like to add the unit of the values inside the plot. If I type 12~h/Maths it raises error because LaTeX tries to compute the percentages. How could I achieve it ? \documentclass{article} \usepackage{pgf-pie} \begin{document} \begin{tikzpicture} \pie[sum = auto]{ 12/Maths, 9/Physique-Chimie, 2/Informatique, 2/TIPE, 2/Français } \end{tikzpicture} \end{document}

  • Songbook with chords
    by Cupora on April 24, 2026 at 12:58 pm

    I'm about to make a guitar song book with LaTeX, which means, song lyrics with chords written above the lines: Gm Remember when you were young, Gb Bb You shone like the sun. Eb Dm Cm Bb F Shine on you crazy diamond. I found several packages doing this, and also some other ideas for custom LaTeX commands (for example here). However, I do not like the way the chords are added to the lyrics, since one needs to integrate the chord commands into the song lyrics: \chord{Eb}Shine\chords{Dm} y\chord{Cm}ou cr\chord{Bb}azy di\chord{F}amond which is a hell lot of work to format the lyrics copied from some website. I would prefer to be able to format the lines similar to this: \textlinewithchords{Eb Dm Cm Bb F}{^Shine^ y^ou cr^azy di^amond} so that the lyrics just contain the placeholders for the chords, and the chords input is separated. I would be glad if somebody had an idea how I could implement this behaviour 🙂

  • Correct accented characters in pdf with pdflatex/OT1?
    by Alain Stalder on April 24, 2026 at 12:17 pm

    I think this deserves its dedicated question even though the answer might be that it is not possible except with changes to tex sources or postprocessing the pdf, which both would appear to be major projects (at least for me with little specific prior coding knowhow around that)… Example: \DocumentMetadata{lang=en, pdfstandard=ua-2, pdfstandard=a-4f, tagging=on} \documentclass{article} \usepackage[noTeX]{mmap} \usepackage[OT1]{fontenc} \renewcommand{\familydefault}{\sfdefault} \begin{document} The [Loránd] Eötvös experiment was a physics experiment that measured the correlation between inertial mass and gravitational mass, demonstrating that the two were one and the same, something that had long been suspected but never demonstrated with the same accuracy. (Wikipedia) \end{document} When I copy text from the resulting pdf I get a text that starts with this: The [Lora´nd] Eo¨tvo¨s Similarly when I do show-pdf-tags --xml test.pdf I get this in the text with additional linebreaks <br> added for visibility (the fusing of words at end and beginning would be a separate issue): <?MarkedContent page="1" ?>The [Lora´nd] Eo¨tvo¨s experiment was a physics experiment that<br> measured thecorrelation between inertial mass and gravitational mass, <br> demonstrating that thetwo were one and the same, something that had long<brd> been suspected but neverdemonstrated with the same accuracy. (Wikipedia) Since the output is based on the OT1 character encoding, it puts a ¨ above an a to write an ä. (And, yes, with T1 character encoding you don't have that problem, nor with XeLaTeX and LuaLaTeX (Unicode), but since I am also using modes.mf pdflatex/OT1 is the only way so far that gives me sufficiently great typographical results for my purposes and tastes, as far as I can see mainly because anything beyond that lacks the METAFONT mechanisms for giving existing fonts a bit more weight in a sophisticated way.) Is there a way to fix this maybe with existing tex packages? For example, the mmap package I used above in the example (or I could also have used cmap) resolved the issue with ligatures, for example fl would now end up as two letters fl in the resulting pdf. Other than what might already be possible within TeX/LaTeX, I see in principle two ways in which this might be addressed: Provide some mechanism that could be applied in the code that is used by pdflatex/OT1 for rendering a pdf such that in the resulting pdf the two characters would be combined into one, I guess something like wrap them into a /ActualText span in the “normal” pdf text and just replace in the tagged texts, but I suspect that would not be trivial due to the structure of the code, etc. Post-process the resulting pdf with some code in some language. I do not know much about that specifically, but I gather that especially with tagged pdfs and the standards they would have to implement this might not be easy. For now my approach is just to essentially use the above approach from the example, which has the effect (besides the fusing of words) that my articles especially in German will likely not be found so well via search engines (and are less accessible).

  • LaTeX pdf viewer of VS Code refresh seems to kill go to source
    by coxehj4142 on April 24, 2026 at 11:55 am

    I'm a Windows user with miktex (with perl from Git installation) and recently trying to move from texmaker to VS Code Latex Workshop 10.14.0. The "go to source" by ctrl+click(or I've tried changing it to double-click too) seems to have issues related to the internal PDF viewer of VS code. When I open the pdf viewer after the build, both "go to pdf" and "go to source" work fine. But when I refresh my viewer by ctrl+alt+p and choosing "LaTeX Workshop: refresh all LaTeX PDF viewers" option, or re-build while the PDF viewer is opened, then suddenly "go to source" stops working, and only "go to pdf" works. However, at this moment, when I close and re-open the internal PDF viewer tab, then even without further builds the "go to source" begins to work again. I've checked that .synctex.gz (or .synctex on "-synctex=-1") updates even when the viewer is open, but it seems that it is the viewer that is not reading the changed synctex file properly. My build uses latexmk: "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", // tried -1 too "-interaction=nonstopmode", "-file-line-error", "-pdf", // "-recorder", // "-outdir=%OUTDIR%", // tried this without success "%DOCFILE%" //tried "%DOC%" too ] And I've also tried (single and double) pdflatex: "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-recorder", "%DOCFILE%" ] I've also tried changing the following variables, but all true-falses or using defaults didn't fix the problem: "latex-workshop.latex.watch.pdf.delay": 1500, "latex-workshop.synctex.afterBuild.enabled": true, "latex-workshop.view.outline.sync.viewer": true, "latex-workshop.view.pdf.viewer": "tab", // with this fixed "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click" I'd like to stick to the internal viewer as far as possible at this moment, if the problem can be resolved. I’d really appreciate any thoughts on what might be causing this.

  • How to control "Attributes" added by tagpdf?
    by niru on April 24, 2026 at 11:30 am

    I am compiling a document with the following minimal setup: \DocumentMetadata{tagging=on,lang={en-GB}} \documentclass{article} \usepackage{lua-unicode-math} \begin{document} quack \end{document} When I check show-pdf-tags mwe.pdf, it generates: Document (http://iso.org/pdf2/ssn): └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): ┝━━Attributes: │ └/Layout: │ └TextAlign: "Justify" └─Marked content on page 1: quack I want to know what Attributes:, Layout: and TextAlign: "Justify" are and how I can control them. Is there any way I can remove this from the output?

  • Subscripts with capital letters
    by Guran Semiotovic on April 24, 2026 at 9:46 am

    I'm aware that similar questions are addressed elsewhere, but I have not found the answer that I am looking for. I am in a situation where: Even though this is not a choice I enjoy, I must use a capital J as a subscript. Expressions such as $u_J$, $P_J$, $\mu_{J+1}$, $\lambda_{J+1}$ are present in many parts of the paper I am writing, hence in most symbols J appears as a subscript of a lowercase letter. Other subscripts are with lower case letters, so I will also have $u_J(t_n)$, $K_m$, etc. I am looking for good practices to make the document look decent, and to do that consistently, possibly with one or more macros, if that is necessary. As I said, I would rather not take this path, but the compromises above are unavoidable. I have read in several posts about: using scriptsize changing default size for all subscripts keeping things as they are using a ghost superscript such as $u^{}_J$. Would you be up for going again through these choices with me, and expose pros and cons of them, and perhaps proposing alternatives? I can not cope well with how ugly $u_J$, $\mu_{J + 1}$ look. I know that some of these are a matter of taste, but I'm trying to find a decent solution that will make my subscripts look harmonious. You can use this minimal document if you want \documentclass{article} \begin{document} \[ u_J, u_{J+1} \qquad u_J(t_n), \qquad u_{J,M}(t_n) \qquad, P_J, \qquad P_{J, M} \] \end{document}

  • European Computer Modern-like font that allows for bold italic smallcaps (textsc)?
    by canIchangethis on April 24, 2026 at 8:40 am

    I would love to have bold, italicised small caps in my LaTeX document, using T1 encoding and, ideally, a font as close as possible to European Computer Modern. And I would like to only redefine \textbf{\textit{\textsc{}}} so that I can use smallcaps in italic and bold from another font. Related, I found this older question: https://tex.stackexchange.com/a/746482/114622 Thus, this is my MWE, which doesn't work, as in, it produces the warning: Font shape `T1/cmr/bx/scit' undefined \documentclass{article} \usepackage[T1]{fontenc} begin{document} \begin{center} \textbf{\textit{\textsc{my text}}} \end{center} \end{document}

  • Error from tikz-cd in beamer [duplicate]
    by Christian on April 24, 2026 at 8:26 am

    I have a curious problem with tikz-cd in beamer. When I am trying to compile the following code \documentclass{beamer} \usepackage{tikz-cd} \begin{document} \begin{frame} \begin{tikzcd} A & B \end{tikzcd} \end{frame} \end{document} I am getting the following error message which is quite unclear to me. ERROR: Undefined control sequence. --- TeX said --- <argument> \pgf@matrix@last@nextcell@options l.11 \end{frame} Is this a compatibility issue between beamer and tikz-cd? I am using TeX Live 2023/Debian and did not yet have this issue before.

  • Why the note is wrongly placed?
    by iago on April 24, 2026 at 8:00 am

    Why the F note is wrongly placed, taking into account as documentation specifies? My code (removing spaces after ovbkt and wh, or including 6 in {} does not changes the output): \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[left=2.5cm, right=2.5cm]{geometry} \usepackage[english]{babel} \usepackage{musixtex} \def\nnotes{\vnotes1.6\elemskip} \begin{document} \begin{music} \parindent10mm% \instrumentnumber{1}% \setstaffs1{1}% \setclef1{60}% \nobarnumbers% \startextract% \nnotes\ovbkt {{'E}}{1}6\cchar{-5}{$F2$}\wh {F}\en% \zendextract \end{music} \end{document} And the output: But, I would expect the note an octave below, the same as where F is placed in page 148 of https://mirrors.ctan.org/macros/generic/musixtex/doc/musixdoc.pdf, If I use L instead of 'E for the overline, it compiles as it is expected. But I understand both are interchangeable.

  • How to define new babel strings for a custom document class, if I can't load babel twice?
    by Alessandro Bertulli on April 24, 2026 at 7:40 am

    I thought this would be trivial but apparently I can't find the idiomatic answer. I am writing a custom class using modern LuaLaTeX, and searching online and on the babel manual I understood that the "modern" way that babel uses to define new captions is something like: \StartBabelCommands*{english}{captions} \SetString{\attachmentsname}{Attachments} \SetString{\changesname}{List of changes} \StartBabelCommands*{italian}{captions} \SetString{\attachmentsname}{Allegati} \SetString{\changesname}{Lista di modifiche} \EndBabelCommands However, I couldn't find online how to let the user use it: if I don't load \RequirePackage{babel} in the .cls file, the command \StartBabelCommands is not defined if I do load it, then the \usepackage[english]{babel} in the .tex file triggers an error LaTeX Error: Option clash for package babel. So I am stuck: how should I allow both the .cls and the .tex file load babel? And more generally, is this the correct, modern and idiomatic way to provide localization for a new LaTeX class/package?

  • coding a book cover color and title
    by Nate on April 24, 2026 at 2:45 am

    I am planning to write a book (using the book class) that has both a physical and digital version. In the physical version I am planning to use the bookcover package to create the following: while having the front cover as the first page of the pdf: What is the best way to code this flexibly so it can be adapted to both versions? (I used Word to create these examples.)

  • pgf-PeriodicTable: produce a gap at La and Ac
    by cis on April 24, 2026 at 1:36 am

    How could I create a gap here (as seen sometimes)? \documentclass[landscape]{article} \usepackage[margin=11mm]{geometry} \usepackage{pgf-PeriodicTable} \tikzset{every picture/.append style={remember picture}} \begin{document} \pgfPT[ show title=false, show legend=false, IUPAC=false,% puts La and Ac above ] % Test \begin{tikzpicture}[remember picture, overlay] \node[fill, inner sep=0pt, minimum size=2mm, cyan, text=red] at (3.center) {UL}; \end{tikzpicture} \end{document}

  • Is \textit now long, instead of short?
    by rallg on April 24, 2026 at 1:25 am

    In the past, something such as \textit{this\par that} would throw an error, because the \textit command was "short" (it could not span paragraphs). But I now see (TeXlive 2026) that is is "long" (can span paragraphs). This is verified by inspecting code in file latex.ltx even though that file is not necessarily loaded. Even AI did not know that! Or did I hack something, and forgot about it?

  • Next odd-numbered physical page
    by Elayson Abreu on April 23, 2026 at 7:19 pm

    I need to create a page break command called \nextoddphysicalpage that moves the current point to the next odd-numbered page, considering the physical numbering of the document, not the logical numbering. My near-solution was based on the \checkoddpage command, but it takes into account the logical numbering, not the physical one: \documentclass{article} \usepackage[strict]{changepage} \def\checkifodd{\checkoddpage \ifoddpage Odd\else Even\fi} \addtocounter{page}{1} \begin{document} Logical page: \checkifodd. \end{document}

  • Interaction (?) of AtBeginDocument hooks
    by campa on April 23, 2026 at 6:55 pm

    In trying to boil down my problem to a MWE, I came to the following code: \begin{filecontents}[overwrite]{foo.cls} \ProvidesClass{foo} \LoadClass{article} \AtBeginDocument{\relax}% <-- comment this line out \RequirePackage{icomma} \AtBeginDocument{\show\mathcomma} \end{filecontents} \documentclass{foo} \begin{document} Hello world! \end{document} Running pdftex on this yields > \mathcomma=undefined. \__hook begindocument ->\relax \show \mathcomma \mathchardef \mathcomma \mat... l.9 \begin{document} while commenting out the first \AtBeginDocument one gets (./mwe.aux) > \mathcomma=\mathchar"613B. \__hook begindocument ...,="8000 \show \mathcomma \__hook_toplevel begindocu... l.9 \begin{document} Background (in case it matters) After loading icomma I'd like to calculate the math code of a \mathord comma, something along the lines of \RequirePackage{icomma}% this defines \mathcomma \AtBeginDocument \AtBeginDocument{\edef\ordcomma{\the\numexpr\mathcomma-4096*(\mathcomma/4096)\relax}} and this kept failing until I found out something seems to interact with the hook used before loading icomma.

  • how to embed a domain curve in a parametric surface using lua
    by Jasper on April 23, 2026 at 12:07 pm

    Here's what I'm thinking. Let's take a rectangular parameter domain, and embed a curve in it. Then, let's break it apart into triangles, and keep the subpaths inside each triangle, relative to it's affine coordinate system. Then, after partitioning and occlusion sorting, we can draw each triangle, and then it's embedded path(s). This technique would make the following diagram more beautiful. I'm open to alternative approaches too, as I'm aware that it's possible in other ways (see Howard Anton's calculus). I believe this should be achievable in TeX, using Lua. Look how improperly occluded the following diagram is in this regard: Notice: I wrote this package \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \begin{tikzpicture} \setobject[ name = view, object = {Matrix.zyzrotation3(pi/2, pi/3, pi/6)} ] \appendlight[ v = {return Vector:new{1, 1, 1, 1}} ] \foreach \i in {0,1} { \appendsurface[ ustart = 0, ustop = tau, vstart = -tau, vstop = tau, usamples = 30, vsamples = 10, v = {return Vector:new{cos(u), sin(u), v, 1}:multiply(Matrix.zyzrotation3(0,\i*pi/2,0))}, transformation = {view}, fill options = {fill = white!50!ltdtbrightness} ] \appendcurve[ ustart = 0, ustop = tau, usamples = 100, transformation = view, v = {return Vector:new{cos(3*u), sin(3*u), 2*u - tau, 1}:multiply(Matrix.zyzrotation3(0,\i*pi/2,0))}, draw options = { line join = round, line cap = round, line width = 2pt, draw = red } ]} \displaysimplices \end{tikzpicture} \end{document} edit: I would like to embed line segments in triangles, causing the machine to output something like this: \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture}[scale = 5] % magnification to see better % I want to start with a triangle \filldraw[ fill = red, line width = 5pt, line join = round ] (0,0) -- (1,0) -- (1,1) -- cycle; % then dray sub-paths in it, cleanly \draw[ line width = 3pt, line cap = round ] (0.5,0) -- (0.75,0.6) (0.75,0.6) -- (1,0.5) ; \end{tikzpicture} \end{document} Edit 2: I was working on this on my own a bit, but the line segment thickness causes problems with overlapping nearby triangles.

  • Footnotes in longtblr with rows generated by macro
    by mw2015 on April 23, 2026 at 10:56 am

    I used longtblr tables from tabularray package. Rows are generated using a macro mentioned in expand option in outer specifications of the table. I would like to use footnotes in such table. Notes from tabularray package (note option and \TblrNote command) are not adequate bacause: inside the macro generating the row it is unknown note's number, note options should be placed inside outer specification part, so they cannot be generated by the macro. Therefore I would like to use footnotes, described in Tabularray with footnotes. There is example code: \documentclass[a4paper]{article} \usepackage[margin=2cm]{geometry} \usepackage{tabularray} \UseTblrLibrary{counter} \UseTblrLibrary{functional} \makeatletter \IgnoreSpacesOn \tlNew \gFootNoteTl \intNew \gFootNoteInt \prgNewFunction \footNote {m} { \tlPutRight \gFootNoteTl { \stepcounter{footnote} \footnotetext{#1} } \prgReturn {\footnotemark{}} } \AddToHook{env/longtblr/before}{ \intSetEq \gFootNoteInt \c@footnote \tlClear \gFootNoteTl } \AddToHook{env/longtblr/after}{ \intSetEq \c@footnote \gFootNoteInt \tlUse \gFootNoteTl } \IgnoreSpacesOff \makeatother \usepackage{ipsum} \newcommand{\tablerow}[2]{#1 & #2 \\} \begin{document} \ipsum<Type=sent>[1-4]\footnote{Note before table} \begin{longtblr}[ caption=Long table, evaluate=\footNote, expand=\tablerow, ]{ colspec={lX}, width=\linewidth,row{1}={font=\bf} } Item & Description \\ item 1\footNote{First note from table body} & \ipsum[1] \\ item 2\footNote{Second note from table body} & \ipsum[2] \\ item 3 & \ipsum<Type=sent>[3] \\ \tablerow{item 4\footNote{First note from macro}}{\ipsum[4]} \tablerow{item 5\footNote{Second note from macro}}{\ipsum[5]} \end{longtblr} \ipsum<Type=sent>[1-5]\footnote{Note after table} \end{document} Result is as follows: Unfortunately, this solution works fine when footnote is placed directly in table body (footnotes with text First note from table body and Second note from table body) but not together with macro generating rows (footnotes with text First note from macro and Second note from macro), which are shown multiple times. I tryed to fix the problem using approach described in The footnote text is repeated several times at the bottom of the page, but after definition of function \footNote as follows \prgNewFunction \footNote {m} { \IfBooleanF { \lTblrMeasuringBool } { \tlPutRight \gFootNoteTl { \stepcounter{footnote} \footnotetext{#1} } \prgReturn {\footnotemark{}} } } the results are also wrong.

  • package ebproof, left label usage
    by Jasper on April 23, 2026 at 10:46 am

    I am trying to typeset the forall introduction rule using ebproof, as suggested here: https://tex.stackexchange.com/a/762165/319072. I am reading the manual, but the left label key is not producing the expected result. I am getting this: and what I expect is this (credit Constructivism in Mathematics): \documentclass[letterpaper]{article} \usepackage{microtype} \usepackage{mathtools} \usepackage{unicode-math} \usepackage{ebproof} \begin{document} \[ \begin{prooftree} \hypo[left label=\forall I]{\overset{D_1}{A}} \infer1{\forall yA[x/y]} \end{prooftree} \] \end{document}

  • calculating tangent vectors with partial derivatives
    by Jasper on April 23, 2026 at 1:57 am

    I wanted to try calculating some tangent vectors for a picture, just for fun. This requires taking partial derivatives. It will be some time before I can automate partial derivatives algebraically for illustrations, even though it is a long term goal of mine. In the meantime, I want to see how people would suggest I approximate them. \documentclass[tikz,border=3.14mm]{standalone} \usepackage[3d]{luadraw}%https://github.com/pfradin/luadraw \begin{document} \begin{luadraw}{name=tangent} local g = graph3d:new{viewdir={30,60}, window={-4,4,-3,7}, size={12,12}, bbox=false} local f = function(u, v) return M( 3*math.cos(u)+math.cos(u)*math.sin(v), 3*math.sin(u)+math.sin(u)*math.sin(v), u+math.cos(v)) end -- local dfdu = ??? -- local dfdv = ??? local S = surface(f, 0, 2*math.pi, 0, 2*math.pi) g:Dfacet(S, {mode=mShadedOnly,color="blue"}) g:Show() \end{luadraw} \end{document}

  • Separate cases for real part and imaginary part [closed]
    by Tom Huntington on April 22, 2026 at 11:38 pm

    I am trying to recreate I want it working in github markdown, but github markdown doesn't support this trick Missing or unrecognized delimiter for \right \left. aaaa \right\} Edit Github requires you to use \lbrace and \rbrace \left. aaaa \right\rbrace

  • Help matching a Garamond math font
    by Jean Dubois on April 22, 2026 at 10:17 pm

    I am trying to match the style of a document (a French math exam, see the first image below). While I have identified the main text font as EB Garamond, I am struggling to reproduce the mathematical rendering (my current attempt is the second image). I am interested in knowing the name of the math font used in the document, as I do not think Garamond-Math is used (the symbols are different). I have also noticed that the original uses ligatures for internal "s" characters in italic (for example, "question" on the second line or "descente" on the third one), which I haven't been able to replicate. The reference (original): My current attempt (using EB Garamond and Garamond-Math): My code (I downloaded EB Garamond and Garamond-Math in the font folder), intended to work with XeLaTeX. \documentclass{article} \usepackage[fontsize=13pt]{scrextend} \usepackage[a4paper, margin=3.5cm]{geometry} \usepackage[french]{babel} \usepackage{fontspec} \setmainfont{EBGaramond}[ Path=./font/, Extension=.otf, UprightFont=*12-Regular, ItalicFont=*12-Italic, RawFeature={ +cv06, % narrow guillemets +calt, % Contextual alternates +clig, % Final s +liga, % f+letter, and Q, j in italic +dlig, % T+h +lnum % Numbers }, ItalicFeatures={ RawFeature={ +hlig, % st, ct, sp, sk +lnum % Numbers } } ] \usepackage[math-style=ISO, bold-style=ISO]{unicode-math} \setmathfont{Garamond-Math.otf}[Path=./font/,StylisticSet={ 1, % \mathbb 2, % \partial 9 % \tilde }] \begin{document} \frenchspacing \noindent\textit{Cette partie porte sur les fonctions convexes dont les gradients sont lipschitziens, établit le théorème de Baillon-Haddad à la question 21), lequel permet enfin d’étudier la convergence de la descente de gradient en l’interprétant comme une itération de Krasnoselskii-Mann.} \medskip Soit $f: \mathbb R^{n} \longrightarrow \mathbb R$ une fonction de classe $\mathscr C^{1}$. On note $\nabla f : \mathbb R^{n} \longrightarrow \mathbb R^{n}$ la fonction gradient qui a $x \in \mathbb R^{n}$ associe le vecteur $$ \nabla f (x) = \begin{pmatrix} \frac{\partial f}{\partial x_{i}}(x) \end{pmatrix}_{1 \leqslant i \leqslant n}. $$ \end{document} The full document is available here. Thank you for your help!

  • Append command to all superscripts and subscripts
    by MarcRdC on April 22, 2026 at 12:33 am

    I am using LuaHBTeX (TeX Live 2026) and would like to automatically append a command (say \mycmd, for example a sequence of characters) to all mathematical superscripts and subscripts, without making ^ and _ active — and without using some custom commands to write the said superscripts and subscripts. Could some lua code achieve that? Unlike gsub, it should also apply when symbols ^ and _ are not directly used in the body of the document. For instance, in math mode, a_{b}, a_{b^{c}} and \mytest, where \mytest is defined as a^{b}, should be respectively replaced with a_{b\mycmd}, a_{b^{c\mycmd}\mycmd} and a^{b\mycmd}. \documentclass{article} \def\mycmd{!} \def\mytest{a^{b}} \begin{document} % \verb+\( a_{b} \quad a_{b^{c}} \quad \mytest \)+ should give \( a_{b!} \quad a_{b^{c!}!} \quad a^{b!} \). \verb+\verb!a_b a^b!+ should give \texttt{a\_b a\textasciicircum b}. % \end{document}

  • Plot a domain in 3D with TikZ for a triple integral
    by Sebastiano on April 20, 2026 at 9:59 pm

    I have to solve this triple integral ∭ x y|z|³/(1+ (x²+y²)⁴)  dx  dy dz, with a domain T={(x, y, z) ∈ ℝ³: x ≤ 0, y ≥ 0, z² ≤ x²+y² ≤ 1}. Plotting with DESMOS 3D I see this: Actually I am not able to visualise this domain in my mind. It should be a cylinder enclosed by a double-sloped cone, but I can’t quite get the x ≤ 0, y ≥ 0 parameters right. I’ve created something but I would like my drawing (or a new one) to be intuitive with TikZ3D so that I can correctly draw this integral. My MWE: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \tdplotsetmaincoords{60}{130} \begin{document} \begin{tikzpicture}[tdplot_main_coords, scale=3] % assi \draw[->] (0,0,0) -- (1.3,0,0) node[right]{$x$}; \draw[->] (0,0,0) -- (0,1.3,0) node[left]{$y$}; \draw[->] (0,0,0) -- (0,0,1.3) node[above]{$z$}; \foreach \t in {0,1,...,359}{ \pgfmathsetmacro{\ct}{cos(\t)} \pgfmathsetmacro{\st}{sin(\t)} \draw[blue!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{\x}); \draw[red!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{-\x}); } \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},1); \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},-1); \end{tikzpicture} \end{document}

  • expl3 e vs x function variants
    by karlh on April 20, 2026 at 8:06 pm

    In the LaTeX3 kernel documentation (interface3), it used to state, "The e specifier is in many respects identical to x, but with a very different implementation. Functions which feature an e-type argument may be expandable. The drawback is that e is extremely slow (often more than 200 times slower) in older engines, more precisely in non-LuaTeX engines older than 2019." I say "used to" because the current version changed the wording somewhat: "The e specifier is in many respects identical to x, but uses [the] \expanded primitive. [The] parameter character (usually #) in the argument need not be doubled. Functions which feature an e-type argument may be expandable." My question: other than the argument being allowed to be expandable in the e-form, is there a reason to prefer e over x or vice-versa, or do they do essentially the same thing? In particular, some functions (e.g., \iow_now:Nn) had x-variants in TeXLIVE 2023 but have e-variants now (the implication being that e is preferred, I would guess?), and I am wondering whether it makes any difference in terms of backward or forward compatibility of code I might write in the future.