• How to patch texlive including pythontex
    by user2609605 on January 11, 2026 at 6:14 am

    The application pythontex is very important for me, it is still maintained but activity became low a bit so you cannot get quick solution. So I ask for a quick fix. For python 3 it seems to be a wrapper around pythontex3.py. As python changes, the original pythontex3.py needs more and more patches. Don't be shocked, I just overwrote the original by a script. Now i found out that this is not state of the art. I need not patch directly in texmf-dist but in texmf-local. Ok, I patched some packages also and this seems to work. But with pythontex it does not. Still the original pythontex3.py in texmf-dist is used although the one in texmf-local is present also. For packages texmf-local takes priority over texmf-dist. But for python scripts I cannot figure out the mechanism that determine the one that it is used. Please help. I want to solve my problem but also understand the techniques.

  • label referencing problem in tcolorbox
    by mmjt on January 11, 2026 at 5:38 am

    I am trying to use tcolorboxes to highlight exercises in a math tutorial (book document class) for a course I teach. I use a \label in the box hoping to reference the exercise by number in the solutions manual. However, the label does not "attach" to the colorbox; instead it returns the section number. Thus, Exercise "17" is referenced as "2.2.3" because that is the chapter section it is in. This behavior is different to that of a normal LaTeX environment and I am going in circles trying to resolve the issue. The tcolorbox manual is very detailed, but I cannot sort out this (seemingly) simple issue. What I want to accomplish is this: (1) create a box and put a \label{mylabel} in it. (2) \ref{mylabel} returns the box (exercise) number. (3) I want to reset the box numbering at the start of each chapter, with no "cross-talk" between the similarly numbered boxes in each chapter. I hope somebody can help restore my sanity and reveal the secret to doing this! Here is a MWE: \documentclass{article} \usepackage{tcolorbox} \tcbuselibrary{most} \begin{document} \section{Introduction} This document contains labeled tcolorboxes in Section \ref{sec:example}. The first box is numbered as \ref{box:label1}. \section{An Example Section} \label{sec:example} \newcounter{myboxcounter} \newtcolorbox[auto counter]{mybox}[1][]{ enhanced, colback=blue!5!white, colframe=blue!75!black, fonttitle=\bfseries, before title={\refstepcounter{myboxcounter}}, title={Exercise~\arabic{myboxcounter}\ifx#1\empty\else\ (#1)\fi}, fonttitle=\bfseries, breakable } \begin{mybox}[] \label{box:label1} This is box \ref{box:label1}. \end{mybox} \begin{mybox}[] \label{box:label2} This is box \ref{box:label2}. \end{mybox} \subsection{An Example Section} \begin{mybox}[] \label{box:label3} This is box \ref{box:label3}. The first two are boxes \ref{box:label1} and \ref{box:label2}. \end{mybox} \end{document}

  • How get ISO math style with lua-unicode-math package?
    by murray on January 11, 2026 at 12:26 am

    The commented-out line in the source below, if used instead of the line preceding it, produces ISO-style for upper-case Greek math letters, namely, Italic insead of upright. How does one get the same result with lua-unicode-math instead of just unicode-math? % !TEX program = lualatex \NeedsTeXFormat{LaTeX2e}[2025-11-01] \documentclass{article} \usepackage{fontspec,lua-unicode-math} %\usepackage[math-style=ISO]{unicode-math} % Italic upper-case Greek math \defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX} \setmathfont{STIX Two Math}[Scale=MatchUppercase,math-style=ISO] \begin{document} $a, z, B, X, \quad \alpha, \beta, \Gamma, \Xi $ \end{document}

  • tex4ht does not create local TOC when using starred version of sectioning with an explicit \addcontentsline
    by Nasser on January 11, 2026 at 12:01 am

    setup: I wanted to make all my sections and subsections without numbers showing on the left side of each entry. So I changed to using the star version and with manually entering each section or subsection into the main toc. But now I find that only the main TOC is created, but local toc at top of each section is missing. This happens with splitting or no splitting. Removing the star version of sectioning, the local TOC shows up again as expected. Here is a MWE \documentclass[12pt]{article} \begin{document} \ifdefined\HCode \Configure{tableofcontents*}{section} \TocAt{section,subsection} \else \tableofcontents \fi \section*{section 1} \addcontentsline{toc}{section}{section 1}% text \subsection*{subsection 1} \addcontentsline{toc}{subsection}{subsection 1}% text \subsection*{subsection 2} \addcontentsline{toc}{subsection}{subsection 2}% text \end{document} Compiled with make4ht -ulm default -a debug C.tex 'mathjax,htm' Gives this Now see what happens when I change back to normal sectioning (i.e. no star) \documentclass[12pt]{article} \begin{document} \ifdefined\HCode \Configure{tableofcontents*}{section} \TocAt{section,subsection} \else \tableofcontents \fi \section{section 1} text \subsection{subsection 1} text \subsection{subsection 2} text \end{document} Compiled using same command gives I expected local TOC to show up in both cases. Is there a workaround? reference https://puszcza.gnu.org.ua/bugs/index.php?667

  • XeLaTeX and GhostScript based concatenation drops CID mapping with RevTeX (4-2)
    by norbert on January 10, 2026 at 9:15 pm

    The following test file: \documentclass{revtex4-2} \begin{document} efficient \end{document} when compiled with xelatex and combined with itself (or any other PDF file) using ghostscript as in gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=foo.pdf file1.pdf file1.pdf produces a broken text mapping, as seen when running txt2pdf.py (from pdfminer-six) or copy-pasting the word $ pdf2txt.py foo.pdf e(cid:123)cient 1 e(cid:123)cient 1 Now, when I use article documentclass, everything works and pdf2txt.py returns: efficient 1 efficient 1 (mind the unicode ff ligature) Has anyone an idea where to search for what revtex4-2.cls is doing wrongly? Thanks

  • Double integral with intexgral: display error
    by Sebastiano on January 10, 2026 at 8:35 pm

    Am I make a mistake, but the code \integral[symbol=\iint, llimit=S, variables={x, y}]{f(x, y)} taken from the manual on page 7 does not give me the double integral? \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage[italic=true]{intexgral} \begin{document} \begin{equation} \integral[symbol=\iint, llimit=S, variables={x, y}]{f(x, y)} \end{equation} \begin{equation} \integral[nint=2, llimit=\Omega, variables={x, y}]{f(x,y)} \end{equation} \end{document}

  • How to create a list of referenced values based on entries in a datatool-database
    by lukascbossert on January 10, 2026 at 7:34 pm

    This is a followup question to How to split the value of a macro into elements using LaTeX3? since I fail to integrate the answer there into my actual code. My overall aim is the following: I want to have a list of affiliations and below the institutions that belong to the affiliation (cf. Obtain unique values of multiple specific columns from a datatool database): One Affiliation > One Institution Another Affiliation > Two Institution > Three Institution The data is stored in various datatool databases. The data comes originally from the database person, from there we get the IDs for the institutions, in the database institution we find the IDs of the affiliations, which names are stored in the database affiliation. It should be based on LaTeX3 and the problem is, that there can be multiple institutions listed in the person-database (one person can be working at multiple institutions). When I try to split the value from \pInst I get an error message about ! LaTeX Error: A sequence was misused. Here is my current approach: \documentclass{article} \ExplSyntaxOn \usepackage{datatool} \newcommand{\thePeriod}{3} \tl_new:N \l_my_database_name_tl \keys_define:nn { person }{ role .code:n = \DTLnewdbentry{\l_my_database_name_tl}{role}{#1}, period .code:n = \DTLnewdbentry{\l_my_database_name_tl}{period}{#1}, ref-institution-id .code:n = \DTLnewdbentry{\l_my_database_name_tl}{ref-institution-id}{#1}, } \keys_define:nn { institution }{ id .code:n = \DTLnewdbentry{\l_my_database_name_tl}{id}{#1}, name .code:n = \DTLnewdbentry{\l_my_database_name_tl}{name}{#1}, ref-affiliation-id .code:n = \DTLnewdbentry{\l_my_database_name_tl}{ref-affiliation-id}{#1}, } \keys_define:nn { affiliation }{ id .code:n = \DTLnewdbentry{\l_my_database_name_tl}{id}{#1}, name .code:n = \DTLnewdbentry{\l_my_database_name_tl}{name}{#1}, } \NewDocumentCommand{\addEntry}{ O{#2} m m }{ % #1: keys % #2: database % #3: key-values \group_begin: % https://tex.stackexchange.com/q/738902/98739 \tl_set:Nn \l_my_database_name_tl {#2} \DTLifdbexists{#2}{}{\DTLnewdb{#2}} \DTLnewrow{#2} \exp_args:Ne \keys_set:nn { #1 } {#3} \group_end: } % 1. filter database 'person' for all entries, % Conditions: 1) 'role=PI', 2) period=3 % 2. from the filtered list get a unique list of 'ref-instiution-id' % 3. get from the 'ref-instituion-id' an unique list of the % 'ref-affiliation-id' % 4. print all names that are behin 'ref-affiliation-id', below each % affiliation there are all names of the institutions that are from the unique % list of 'ref-institution-id' % ------------------------------------------------- \NewDocumentCommand{\listOfAffiliations}{} { \seq_new:N \l_instsplit_seq \seq_new:N \l_inst_seq % --- Walk through the whole “person” DB \DTLforeach*[%start of conditions \DTLisinlist{\thePeriod}{\pPeriod}% 1st condition \and% \DTLisinlist{PI}{\pRole}% 2nd condition ]{person}{% \pRole=role,% \pPeriod=period,% \pInst=ref-institution-id% }{ Debugging:\par Person~found: \quad role = \pRole, \quad period = \pPeriod, \quad institution = \pInst\par\bigskip % split multiple values into individual values \seq_set_split:Nne \l_instsplit_seq { , } { \pInst } % fill the list \seq_put_right:Ne \l_inst_seq { \l_instsplit_seq } } % each institution should appear only once \seq_remove_duplicates:N \l_inst_seq % show the values \seq_use:Nn \l_inst_seq {\space--\space} % Get the affiliations to the institutions and print first the affiliation then % below its institutions .... } \ExplSyntaxOff \begin{document} \addEntry{person}{ role = {PI,spokesperson}, period={2,3}, ref-institution-id = {institution1,institution3} } \addEntry{person}{ role = {PI}, period={3}, ref-institution-id = {institution2} } \addEntry{person}{ role = {PI}, period={3}, ref-institution-id = {institution1,institution2} } \addEntry{institution}{ id=institution1, name={One Institution}, ref-affiliation-id={affiliation1} } \addEntry{institution}{ id=institution2, name={Two Institution}, ref-affiliation-id={affiliation2} } \addEntry{institution}{ id=institution3, name={Three Institution}, ref-affiliation-id={affiliation2} } \addEntry{affiliation}{ id=affiliation1, name={One Affiliation} } \addEntry{affiliation}{ id=affiliation2, name={Another Affiliation} } \listOfAffiliations \end{document}

  • How to move an equations system letter to midline height?
    by graograman on January 10, 2026 at 6:36 pm

    I'd like to move the letter H below so it's at a midline height in between the two equations, please. Here's a MWE. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} \left.\begin{matrix} \frac{x-h}{a}=\sec\theta\Rightarrow x-h=a\sec\theta\Rightarrow x=a\sec\theta+h \\ \frac{y-k}{b}=\tan\theta\Rightarrow y-k=b\tan\theta\Rightarrow y=b\tan\theta+k \end{matrix}\right\}\Rightarrow \mbox{\Huge$\mathcal{H}$:} \begin{matrix} x=a\sec\theta+h \\ y=b\tan\theta+k \end{matrix} \end{equation*} \end{document} This code produces the equations system thus:

  • Redefine `$...$` to `\(...\)`
    by weisj on January 10, 2026 at 2:44 pm

    The mathtools package can automatically insert italics correction when using \(...\) for inline math mode. See this answer. However, I much prefer $...$ for inline math as I find it more readable and comfortable to type on my keyboard layout. I am currently using the following hack to keep using the $...$ syntax while preserving the italics correction. \catcode`\$=13% \def$#1${\(#1\)}% I haven't had issues with it in my current document, but I was wondering whether there are reasons this might be a bad idea. I would image that if this was harmless the mathtools package would use it to also patch the $...$ syntax for the mathic feature. So my question is: Is this safe and are there any caveats I might be overseeing?

  • How to insert skip into the `\ShipoutBox`?
    by Explorer on January 10, 2026 at 1:34 pm

    Description Learning from this link, I want to vertically center the \ShipoutBox for every page. Code 1 \documentclass{article} \usepackage[ paperwidth=120mm, paperheight=80mm, margin=10mm, showframe ]{geometry} \usepackage{lipsum} \AddToHook{shipout}{% \setbox\ShipoutBox=\vbox{\null\mbox{}\vfill\box\ShipoutBox\vfill\null} } \begin{document} \lipsum[2-3] \end{document} However, it doesn't work. Code 2 And I tried with \fbox(just to test...)... \documentclass{article} \usepackage[ paperwidth=120mm, paperheight=80mm, margin=10mm, showframe ]{geometry} \usepackage{lipsum} \AddToHook{shipout}{% \setbox\ShipoutBox=\vbox{\fbox{\box\ShipoutBox}} } \begin{document} \lipsum[2-3] \end{document} That shows weird bounding box: Code 3 I also tried the incorrect way, with shipout/before hooks: In ltshipout-doc.pdf, sec 1.2, introduced that: Note: It is not possible (or say advisable) to try and use this hook to typeset material with the intention to return it to main vertical list, it will go wrong and give unexpected results in many cases—for starters it will appear after the current page not before or it will vanish or the vertical spacing will be wrong! And the shipout/after is too late to work: \documentclass{article} \usepackage[ paperwidth=120mm, paperheight=80mm, margin=10mm, showframe ]{geometry} \usepackage{lipsum} \AddToHook{shipout/before}{\null\mbox{}\vfill} \AddToHook{shipout/after}{\vfill\null} \begin{document} \lipsum[2-3] \end{document} It push the \Shipoutbox to the bottom, I can't find the proper time point to pull it back. Question Is there exist elegent method to push everypage's \Shipoutbox vertically centered? Is the weird bounding box of \ShipoutBox that related to my Code 1's NOT work?

  • Does catchfilebetweentags significantly slow down LaTeX compilation?
    by taiwan12 on January 10, 2026 at 1:27 pm

    I am using the catchfilebetweentags package to separate content (descriptions and data blocks) from the main document structure and include them via \ExecuteMetaData. In a simplified example, my setup looks like this: main.tex \documentclass{report} \usepackage{graphicx} \usepackage{geometry} \usepackage{float} \usepackage{lipsum} \usepackage{catchfilebetweentags} \newcommand{\fig}[1]{\begin{figure}[H]\includegraphics[width=0.2\linewidth]{#1}\end{figure}} \newcommand{\des}[1]{\ExecuteMetaData[des.tex]{#1}} \newcommand{\data}[1]{\ExecuteMetaData[data.tex]{#1}} \newcommand{\merge}[4]{\par\textbf{#1}\par\fig{#2}\des{#3}\par\data{#4}\par} \begin{document} \merge{First}{example-image-a}{Des1}{Data1} \merge{Second}{example-image-b}{Des2}{Data2} \merge{Third}{example-image-c}{Des3}{Data3} \end{document} des.tex %<*Des1> \lipsum[1] %</Des1> %<*Des2> \lipsum[1] %</Des2> %<*Des3> \lipsum[1] %</Des3> data.tex %<*Data1> \lipsum[1] %</Data1> %<*Data2> \lipsum[1] %</Data2> %<*Data3> \lipsum[1] %</Data3> In the actual document, there are 50+ \merge blocks, each calling \ExecuteMetaData twice (for description and data). My question is about performance: Does using catchfilebetweentags (and repeatedly calling \ExecuteMetaData) significantly slow down LaTeX compilation in this kind of setup, especially as the document grows? Thanks in advance!

  • Count items in an itemize list, but not the indented ones
    by Loulou on January 10, 2026 at 1:05 pm

    The title says it all: I want to count the items in a list like itemize but not the items in the indented ones. I currently use the code below. In my document, I use a \label{nameoflabel} inside my list, just after the last item, and I can call it whenever I want with a \numitems{nameoflabel}. At the moment, this counts every items of the indented lists, whether they also are itemize or even enumerate (hence, compilating the code below gives "3" in the last sentence, but there are 2 items in the general list). I lack ideas and technique to prevent that! MWE : \documentclass{article} \usepackage{enumitem} \usepackage{refcount} \usepackage{xpatch} \newcommand{\numitems}[1]{\getrefnumber{#1}} \newcounter{itemcntr} \AtBeginEnvironment{itemize}{% \setcounter{itemcntr}{0}% \xapptocmd{\item}{\refstepcounter{itemcntr}}{}{}% } \begin{document} \begin{itemize} \item 1 \begin{itemize} \item 1 \end{itemize} \item 2 \label{nameoflabel} \end{itemize} There are \numitems{nameoflabel} items in the list, not counting the indented one. \end{document}

  • Degree character breaks compilation with latex+dvipdfmx and fourier package
    by user691586 on January 10, 2026 at 10:56 am

    I have encountered a build breakage which I could reduce to the following document: \documentclass[dvipdfmx]{article} \usepackage{fourier} \begin{document} \thispagestyle{empty} \showoutput n°1 \end{document} After executing latex, the dvipdfmx step crashes $ dvipdfmx test test.dvi -> test.pdf [1Assertion failed: (obj), function pst_string_release, file pst_obj.c, line 770. Abort trap: 6 dvipdfmx test I had a similar issue at some point with xelatex (not using dvipdfmx class option) while I was reducing from the real-life document but I could not reproduce it later on once reaching the above mwe, so it may have been a process error on my part. Examining fourier.sty I have reduced it to this even more minimal reproducer: \documentclass[dvipdfmx]{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \renewcommand\rmdefault{futs} \begin{document} \thispagestyle{empty} \showoutput n°1 \end{document} $ latex testminimal.tex This is pdfTeX, Version 3.141592653-2.6-1.40.28 (TeX Live 2025) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./testminimal.tex LaTeX2e <2025-11-01> L3 programming layer <2025-12-29> (/usr/local/texlive/202x/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (/usr/local/texlive/202x/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/202x/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/202x/texmf-dist/tex/latex/base/textcomp.sty) (/usr/local/texlive/202x/texmf-dist/tex/latex/fourier/t1futs.fd) (/usr/local/texlive/202x/texmf-dist/tex/latex/l3backend/l3backend-dvipdfmx.def) (./testminimal.aux) (/usr/local/texlive/202x/texmf-dist/tex/latex/fourier/ts1futs.fd) Completed box being shipped out [1] \vbox(633.0+0.0)x407.0 .\glue 16.0 .\vbox(617.0+0.0)x345.0, shifted 62.0 ..\vbox(12.0+0.0)x345.0, glue set 12.0fil ...\glue 0.0 plus 1.0fil ...\hbox(0.0+0.0)x345.0 ....\hbox(0.0+0.0)x345.0 ..\glue 25.0 ..\glue(\lineskip) 0.0 ..\vbox(550.0+0.0)x345.0, glue set 539.94232fil ...\write-{} ...\glue(\topskip) 3.65001 ...\hbox(6.34999+0.0)x345.0, glue set 316.21002fil ....\hbox(0.0+0.0)x15.0 ....\T1/futs/m/n/10 n ....\TS1/futs/m/n/10 ? ....\T1/futs/m/n/10 1 ....\penalty 10000 ....\glue(\parfillskip) 0.0 plus 1.0fil ....\glue(\rightskip) 0.0 ...\glue 0.0 plus 1.0fil ...\glue 0.0 ...\glue 0.0 plus 0.0001fil ..\glue(\baselineskip) 30.0 ..\hbox(0.0+0.0)x345.0 ...\hbox(0.0+0.0)x345.0 (./testminimal.aux) ) Output written on testminimal.dvi (1 page, 256 bytes). Transcript written on testminimal.log. $ dvipdfmx testminimal.dvi testminimal.dvi -> testminimal.pdf [1Assertion failed: (obj), function pst_string_release, file pst_obj.c, line 770. Abort trap: 6 dvipdfmx testminimal.dvi I am using TL2025, fully updated as of today. The problem goes away if one removes the ° character. The problem is not only one of that character it is also triggered by the \thanks macro. \documentclass[dvipdfmx]{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \renewcommand\rmdefault{futs} \title{A} \author{B\thanks{C}} \date{} \begin{document} \maketitle \end{document} $ dvipdfmx test2 test2.dvi -> test2.pdf [1Assertion failed: (obj), function pst_string_release, file pst_obj.c, line 770. Abort trap: 6 dvipdfmx test2 Actually the culprit here is \textasteriskcentered. Same problem with \textdagger. \documentclass[dvipdfmx]{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \renewcommand\rmdefault{futs} \begin{document} % A\textasteriskcentered % \ifcase#1\or \TextOrMath\textasteriskcentered *\or % \TextOrMath \textdagger \dagger\or % \TextOrMath \textdaggerdbl \ddagger \or % \TextOrMath \textsection \mathsection\or % \TextOrMath \textparagraph \mathparagraph\or % \TextOrMath \textbardbl \|\or % \TextOrMath {\textasteriskcentered\textasteriskcentered}{**}\or % \TextOrMath {\textdagger\textdagger}{\dagger\dagger}\or % \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}\else \textdagger \end{document} Same with xelatex. Use \documentclass{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \renewcommand\rmdefault{futs} \begin{document} \textdagger \end{document} Then $ xelatex testxelatex This is XeTeX, Version 3.141592653-2.6-0.999997 (TeX Live 2025) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (./testxelatex.tex LaTeX2e <2025-11-01> L3 programming layer <2025-12-29> (/usr/local/texlive/202x/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (/usr/local/texlive/202x/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/202x/texmf-dist/tex/latex/base/fontenc.sty (/usr/local/texlive/202x/texmf-dist/tex/latex/lm/t1lmr.fd)) (/usr/local/texlive/202x/texmf-dist/tex/latex/base/textcomp.sty) (/usr/local/texlive/202x/texmf-dist/tex/latex/fourier/t1futs.fd) (/usr/local/texlive/202x/texmf-dist/tex/latex/l3backend/l3backend-xetex.def) (./testxelatex.aux) (/usr/local/texlive/202x/texmf-dist/tex/latex/fourier/ts1futs.fd) [1] (./testxelatex.aux)Assertion failed: (obj), function pst_string_release, file pst_obj.c, line 770. ) Error 6 (driver return code) generating output; file testxelatex.pdf may not be valid. Transcript written on testxelatex.log. (not so surprising as xelatex uses xdvipdfmx; and xelatex --no-pdf testxelatex compiles without error.)

  • How to split the value of a macro into elements using LaTeX3?
    by lukascbossert on January 10, 2026 at 10:24 am

    I would like to have separate values for the content of the macro. In the example below they should be considered as two elements (splitted at the ,). \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \seq_new:N \l_inst_seq \newcommand{\institutions}{ins1,ins2} \begin{document} \ExplSyntaxOn % Split the macro contents at commas \seq_set_split:Nnn \l_inst_seq { , } { \institutions } % Use the sequence Count:~\seq_count:N \l_inst_seq\par Items:~\seq_use:Nn \l_inst_seq {~|~} \ExplSyntaxOff \end{document}

  • How to use New Computer Modern sans in beamer text? [duplicate]
    by ysalmon on January 10, 2026 at 10:23 am

    I am trying to use the New Computer Modern Sans fonts in a beamer presentation, both for text and math (so what is the default in beamer, but with modern, unicode fonts). I thus say \documentclass{beamer} \usefonttheme{professionalfonts} \usepackage[sansdefault]{fontsetup} \begin{document} \begin{frame} Should be sans ! $math$ \end{frame} \end{document} However, the text font is not set to sans serif, only the math font. This is driving me crazy, because doing the same thing in article mode does set the main font to sans serif, and sans serif is the default in beamer anyway. I am compiling with lualatex (texlive 2025) if that matters. The log seems to show that Sans fonts are loaded (cannot add it due to length). But not used. Note that contrary to another question, the point here is about the text font, not the math font.

  • LaTeX enumeration: two-digit numbering with prefix (FR-01)
    by Markus M on January 10, 2026 at 10:21 am

    I currently fail to create an referenceable enumeration in LaTeX where each item is labeled and numbered with a fixed string prefix, and a two-digit number with leading zeros Example: FR-01, FR-02, FR-03, … References using \ref / \cref should reproduce the item prefix+number (e.g. FR-01). What already works This minimal example works for one-digit numbers: \documentclass[12pt,a4paper,twoside,openright]{scrbook} \usepackage{enumitem} \usepackage{hyperref} \usepackage{cleveref} \begin{document} \begin{enumerate}[ label=\textbf{FR-\arabic*}, ref=FR-\arabic*, leftmargin=*, ] \item\label{fr:upload-data} The system shall allow a user to upload data. \end{enumerate} This task addresses \cref{fr:upload-data}. \end{document} This produces FR-1 This task addresses FR-1. What I want FR-01 This task addresses FR-01. My attempts to use commands such as \twodigits fail. Does anyone have a good solution and can help?

  • How to tweak the distance of resistor's "+"/"-" label's vertical distance when `raised` is set?
    by Explorer on January 10, 2026 at 10:09 am

    I have the following code: \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european] \ctikzset{voltage=raised}%<- \draw (0,0) -- ++(1,0) to[R=R,label distance=3pt, v=$\mathrm{u_R}$] ++(0,+3) -- ++(-1,0); \end{circuitikz} \end{document} However, I want the "+" and "-" to get closer with "u_R"(that is: shift "+" up and shift "-" down), I have tried shift and label distance and voltage/distance from node, but all failed, because they justs tweak the distance between the wire. It's hard for me to dig it out from the manual, is that exists elegant method?

  • How to add tdmrep in XMPmetadata using LuaLaTeX
    by murugan anbu on January 10, 2026 at 9:20 am

    I want to add the tdmrep information into the XMP metadata using LuaLaTeX with the \DocumentMetadata{} command. (2023 LuaLaTeX engine) Please advise how to add this. My MWE is below. \DocumentMetadata{} \documentclass{article} %%%Need to addd in the XMP metadata % ______<rdf:Description xmlns:tdm="http://www.w3.org/ns/tdmrep/"> % _________<tdm:policy>https://www.xxxxx.org/tdm/tdmrep-policy.json</tdm:policy> % _________<tdm:reservation>1</tdm:reservation> % ______</rdf:Description> \usepackage{hyperref} \usepackage{hyperxmp} \begin{document} Esta caracterstica contrasta con la evolucin observada en varias economas europeas, especialmente en Europa occidental, donde, a partir de mediados del siglo xix, comenz a consolidarse una estructura fiscal ms diversificada, con un peso creciente de los impuestos internos, tanto indirectos (como los impuestos al consumo) como directos (como los impuestos sobre la renta o la propiedad). Este proceso fue acompaado por el fortalecimiento de las capacidades administrativas estatales y la expansin de burocracias fiscales especializadas \end{document}

  • TeX Live "reproducible" environment with symlinking
    by Aly on January 10, 2026 at 7:16 am

    On my local PC I have a full installation of TeX Live. However, doing a full installation of TeX Live in CI proves to be a great waste of time. I'd like projects that I build locally to fail locally if they would also fail in CI: I want to restrict the subset of TeX Live that a certain project sees to the same list I use for building a document in CI. However, I don't want to do a new installation of TeX Live every single time I start a TeX project. This would lead to a lot of unnecessary disk space usage, especially if the packages change & I have to completely regenerate the install. I've written a tool to do this that so far does the following: grab a few variables: the new TEXMFROOT ⇒ $NEW_ROOT kpsewhich -var-value=TEXMFROOT ⇒ $OLD_ROOT tlmgr print-platform ⇒ $PLATFORM for all the requested packages, recursively grab their dependencies & files, including texlive.infra, kpathsea, and on Windows only tlperl.windows, with tlmgr info --json x y z t u v for binfiles, docfiles, runfiles, and srcfiles, create a symbolic link named $NEW_ROOT/$file pointing to $OLD_ROOT/$file kpathsea is an exception and has to be hardlinked or copied as Perl's Cwd::abs_path resolves symlinks updmap.cfg is an exception and has to be copied because it gets mutated by internal tools make empty $NEW_ROOT/texmf-var and $NEW_ROOT/texmf-config I run the following commands in the new root (environment variables described below): mktexlsr fmtutil-sys --all yes | updmap-sys --syncwithtrees updmap-sys To run a command in the new TeX environment, I set up the following: $PATH has instances of $OLD_ROOT replaced with $NEW_ROOT $TEXMFCNF is set to $NEW_ROOT:$NEW_ROOT/texmf-dist/web2c Unfortunately, I've hit a dead end. Trying to build an example document: \documentclass[11pt]{scrartcl} \title{Title} \author{Author} \date{Date} \begin{document} \maketitle \end{document} with the packages scheme-basic, latexmk, and koma-script, fails with luaotfload | db : Font names database not found, generating new one. luaotfload | db : This can take several minutes; please be patient. luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not found: "lmroman10-regular". [redacted]/test/.dtmgr/texmf-dist/tex/latex/koma-script/scrsi ze11pt.clo:100: Font \TU/lmr/m/n/10.95=[lmroman10-regular]:+tlig; at 10.95pt no t loadable: metric data not found or bad. <to be read again> relax l.100 \normalsize ) ([redacted]/test/.dtmgr/texmf-dist/tex/latex/koma-script/type area.sty Missing character: There is no a (U+0061) in font nullfont! Missing character: There is no b (U+0062) in font nullfont! Missing character: There is no c (U+0063) in font nullfont! Missing character: There is no d (U+0064) in font nullfont! Missing character: There is no e (U+0065) in font nullfont! Missing character: There is no f (U+0066) in font nullfont! followed by a lot of similar errors. Interestingly, the font can be found if I suffix it with otf: $ ../target/debug/dtmgr run -- luaotfload-tool --find="lmroman10-regular.otf" luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "lmroman10-regular.otf" not found. luaotfload | resolve : Font "lmroman10-regular.otf" found! luaotfload | resolve : Resolved file name "[redacted]/test/.dtmgr/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf" $ ../target/debug/dtmgr run -- luaotfload-tool --find="lmroman10-regular" luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "lmroman10-regular" not found. luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate. luaotfload | resolve : Cannot find "lmroman10-regular" in index. luaotfload | resolve : Hint: use the --fuzzy option to display suggestions. What's the right approach to take here? Am I barking up the completely wrong tree, or am I just a few steps away from something that'll work well?

  • How to get named sections declared in \definehead to appear in the TOC?
    by Gary on January 10, 2026 at 6:37 am

    When using \definehead to define a section, how can it be set to appear in the TOC? In this example, only the section declared in \setuphead appears in the TOC, even though SectionSpecial is declared as a section. Thank you. \setupcombinedlist[content][list={chapter,section}] \completecontent \definehead [SectionSpecial] [section] [color=blue] \setuphead [section] [color=darkgreen] \starttext \startchapter \startsection[ title={Normal Section} ] \samplefile{ward} \stopsection \startSectionSpecial[ title={Special Section} ] \samplefile{ward} \stopSectionSpecial \stopchapter \stoptext

  • What is the symbol/macro for `$(\!\!)$` (symbol that looks like opening and closing paretheses that overlap each other)?
    by Dima Pasechnik on January 10, 2026 at 1:05 am

    In 100+ years old algebraic geometry texts one sees notation like $(a(\!\!)A,B,C)^2=0$. How does one properly typeset $(\!\!)$ in (La)TeX? for some reason I can't seem to be able to post proper TeX here. Edited The symbol's usage and example screenshot is shown in x-post at here and in the comment:

  • Why does decorate make \gategroup braces in quantikz extend to the end of the circuit?
    by Julien on January 10, 2026 at 12:14 am

    I am using quantikz to draw a quantum circuit of the Grover Algorithm and I want to add a brace under the repeating portion of the circuit using \gategroup. When I apply a TikZ brace decoration, the brace unexpectedly extends to the end of the circuit, even though steps=2 is specified. If I remove decorate, the grouping respects steps=2 as expected. Here is a minimal working example illustrating the issue: \documentclass{article} \usepackage{mathtools} \usepackage{tikz} \usetikzlibrary{quantikz2,decorations} \begin{document} \begin{quantikz} \lstick{$\ket{0}^{\otimes n}$} & \qwbundle{n} & \gate{H^{\otimes n}} & \gate[wires=2]{O_f} & \gate{G} & \push{~\dots~} & \meter{} & \cw \\ \lstick{$\ket{1}$} & \qw & \gate{H} & \ghost{O_f} \gategroup[1, steps=2, label style={label position=below, yshift=-0.5cm, postaction={decorate, decoration={brace,mirror}}]]{Répéter K fois} & \qw & \push{~\dots~} & \qw & \qw \end{quantikz} \end{document} With this code, the brace visually extends to the right edge of the circuit, beyond the two intended columns (O_f and G). However, if I remove decorate from the style option, the \gategroup correctly spans only two steps. What am I doing wrong?

  • How to improve graphs of functions of two variables with jagged edges in pgfplots?
    by orion2112 on January 9, 2026 at 10:19 pm

    In the spirit of creating "beautiful plots" of functions of two variables, I am reaching out to this community to try and find possible improvements in the way I have been using pgfplots and \addplot3. Here are 3 attempts at graphing the paraboloid $f(x,y)=x^2+y^2$. Attempt 1: plotting {x^2+y^2} in cartesian coordinates with no restriction on the z domain yields a plot that "hides part of itself" and doesn't readily show the "bowl" shape we all love: \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Smooth and ugly} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, domain=-3:3, y domain=-3:3, opacity=0.5 ] {x^2+y^2}; \end{axis} \end{tikzpicture} \end{document} Attempt 2: adding the "restrict z to domain=-3:3" option, but this produces a very jagged top edge to the paraboloid, and not a nice smooth circle. Adding samples reduces the jaggedness slightly but there is a limit to how many samples I can put before I get an error, and that isn't enough to get a smooth circle. \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Jagged edges at top} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, domain=-3:3, y domain=-3:3, restrict z to domain={-3:3}, opacity=0.5 ] {x^2+y^2}; \end{axis} \end{tikzpicture} \end{document} Attempt 3: using data cs=polar and a domain of 0:360 instead of -3:3 gets me to an acceptable graph that doesn't hide itself and that has a smooth border: \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Not jagged, but polar coords} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, data cs=polar, domain=0:360, y domain=-3:3, restrict z to domain={-3:3}, opacity=0.5 ] ({x},{y},{y^2}); \end{axis} \end{tikzpicture} \end{document} Problem solved? Not really. What if now I want to plot f(x,y)=x/(y-x)? If done in cartesian coordinates without restricting the z domain, the graph "hides itself". If done in cartesian coordinates and restricting the z domain, some of the edges are jagged. For instance: (I seem to notice that if the mesh line is parallel to one of the "walls" of the plot box, there is no jagged edge, but if a "square" of the mesh is outside the z domain, the whole square is erased, and not just the part that is outside the z domain). And here I don't see how polar coordinates would be usable to bypass that problem. "But, this is not a nice function, of course the graph will be ugly". Fair enough, but seeing that Desmos does it instantly and even allows you to rotate the plot smoothly, I was hoping that maybe it's possible to do better here: So, is there anything that can be done about this? Am I using this wrong? Or is it just a limitation of plotting surfaces in LaTeX? Thanks in advance for all the insight. Note: I am aware of the topic here and that it seems there are only rectangular (and not triangular) surface elements, but I am not sure the issue is the same nor how \clip and \begin{scope} were used to fix the issue. If this is the way to go, can someone explain what those commands do exactly?

  • (Fake) caption above the first PDF page
    by RedGreenBlue on January 9, 2026 at 9:52 pm

    I have a TeX document where I would need to include 1 page images or PDFs (1 page, multiple pages). For PDFs I use currently pdfpages. Thanks to @David Carlisle it sounds like \includegraphics could be an option, too. It might be even better because I would like to highlight parts in the images or PDFs and this does not come though currently when using includepdf after I highlighted parts in the document. I tried to come up with a command (modified as I am trying to refine it). The command has currently 5 parameters. Maybe a sixth would be good to have correct the distance between caption and included file on the first page. \newcounter{pdfanhang} \newcommand{\attachment}[5][0.9]{% #1=scale, #2=title, #3=filename, #4=caption text, #5=optional second label \phantomsection \addcontentsline{toc}{subsection}{Anhang \thepdfanhang: #2} % Build full path \edef\fullpdfpath{#3}% % Check file exists \IfFileExists{\fullpdfpath}{% % Get PDF page count \pdfximage{\fullpdfpath}% \edef\pdfpagecount{\the\pdflastximagepages}% % First page with caption \includepdf[ pages=1, scale=#1, offset=0 -1cm, %yes, this has an effect pagecommand={% \vspace*{-1.9cm}, %this moves the captions higher up and with it the following document \refstepcounter{pdfanhang} \ifx&#5&\else \label{#5} \fi \begin{center} \captionsetup{labelformat=anhangformat} \captionof{figure}{\textbf{\textcolor{red}{#2}} #4} \label{app:pdf_anhang_\thepdfanhang} \end{center} } ]{\fullpdfpath} % Remaining pages (in case of PDF document, not sure, how it would work with includegraphics) \ifnum\pdfpagecount>1 \includepdf[ pages=2-\pdfpagecount, scale=#1, pagecommand={} ]{\fullpdfpath} \fi }{% \typeout{Warning: File \fullpdfpath not found!}% } } I am trying to find a way to place the (fake) caption above the PDF attachment (1 side or multiple, in the letter case , only the first PDF pages) I don't know currently how to switch from including a PDF to image in my command. Edit: It looks lie \includegraphics` could be the better option? Could you help me to improve my command "attachment" command, please? Place the caption above the first PDF page, or image, small space between caption and PDF, so there is no overlap between text of the caption and the included PDF/image. Could one introduce a parameter to control the space between caption and PDF? Caption should also have space for 3-5 sentences comments in the worst case Being able to include an image as well instead of PDF How to control in case of a multiple PDF document to limit the inclusion of multiple pages? This example PDF has 13 pages, but maybe this is overkill to include them all later. This new MWE shows now the current situation. Better MWE, no mocking needed thanks to @David Carlisle \documentclass{article} \usepackage{xcolor} \usepackage{caption} \usepackage{hyperref} \usepackage{pdfpages} \newcounter{pdfanhang} \newcommand{\attachment}[5][0.9]{% \phantomsection \refstepcounter{pdfanhang} \addcontentsline{toc}{subsection}{Anhang \thepdfanhang: #2} \IfFileExists{#3}{% \pdfximage{#3}% \edef\lastpage{\the\pdflastximagepages}% % First page \includepdf[ pages=1, scale=#1, pagecommand={% \ifx&#5&\else\label{#5}\fi \begin{center} \captionof{figure}{\textbf{\textcolor{red}{#2}} #4} \end{center} } ]{#3} % Remaining pages \ifnum\lastpage>1 \includepdf[ pages=2-\lastpage, scale=#1, pagecommand={} ]{#3} \fi }{% \typeout{Warning: File #3 not found}% } } \begin{document} \tableofcontents \attachment[0.9] {Example multipage PDF (or single image)} {example-image-a4-numbered.pdf} {Here should be space for three to five sentences explaining what is important in the document below. This explanatory text must not be overlapped by the document that follows. Does anybody know why highlighted text in a PDF does not show up when using \texttt{\textbackslash includepdf}? I am also open to replacing \texttt{\textbackslash includepdf} with \texttt{\textbackslash includegraphics}.} {app:multipagepdf} \end{document}

  • I would like to create a graph paper document
    by Brion C on January 9, 2026 at 4:36 pm

    I'm trying to create a graph paper document and have the text align to the grid (Not just superimposed on it). The text should at least align with baseline of the grid, but better yet, each character should be placed inside the grid like if you were handwriting on graph paper.

  • Simple way to show/hide controls points in a Tikz line?
    by YaGoi Root on January 9, 2026 at 2:18 pm

    In Tikz diagrams, one of the best ways to make controlled curved lines (such as pointing arrows in a flow chart) is using \draw with control points. For example, \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{shapes.arrows, arrows.meta} \begin{document} \begin{figure} \begin{tikzpicture} \draw[thick,->,>=Stealth, show controls] (0,0) .. controls (0.5,3) and (4.5,0).. (5,5); \end{tikzpicture} \end{figure} \end{document} However, I feel like it ends up being a sort of guessing game when trying to determine where to actually place the control points, because I have a hard time visualizing where the points are, but once I know where they are I know how their position affects the curved line. I understand how the points effect the line very intuitively, but moving said points to the desired location is easier when you can see the points as well. Is there any simple way to "toggle" on a display of the control points, so that you can see them while editing the diagram, and then hide them when you've got the line that you want?

  • circuitikz: how to get all in the same line width thickness
    by cis on January 9, 2026 at 1:37 pm

    Is there an easy way to get all in the same line width thickness? I tried to calc some things but I do not think this was correct: \pgfmathsetlengthmacro\lw{2.1pt}% wanted linewidth (circuitikz default 0.8pt) \pgfmathsetlengthmacro\lwc{0.8pt}% circuitikz default linewidth 0.8pt % ----> could this be read out somehow? \pgfmathsetmacro\th{\lwc/\lw}% needed bipoles/thickness % ---> do not think, this is correct \documentclass[margin=5pt]{standalone} \usepackage{tikz} \usepackage[]{circuitikz} %\ctikzset{bipoles/thickness=3} \pgfmathsetlengthmacro\lw{2.1pt}% wanted linewidth (circuitikz default 0.8pt) \pgfmathsetlengthmacro\lwc{0.8pt}% circuitikz default linewidth 0.8pt % ----> could this be read out somehow? \pgfmathsetmacro\th{\lwc/\lw}% needed bipoles/thickness % ---> do not think, this is correct \begin{document} \begin{tikzpicture}[european, line width=\lw, circuitikz/bipoles/thickness=\th,% default 2 %circuitikz/sources/symbol/thickness=\th,% default 1 ] \draw (0,3) to [sinusoidal voltage source, v=$u(t)$, ] (0,0); \draw (0,3) to[C=$C$] (4,3) to[resistor={$R$}] (4,0) to[battery1, invert] (0,0); \node[align=left, anchor=north west, fill=yellow!25] at (0,-1) { \textbf{Values}: \\ lw: \lw \\ th: \th \\ bipoles/thickness: \ctikzvalof{bipoles/thickness} \\ circuitikz/sources/symbol/thickness: \ctikzvalof{circuitikz/sources/symbol/thickness} ? \\ ...... }; \end{tikzpicture} \end{document}

  • Create a textbox with a figure inside
    by Mike on January 9, 2026 at 1:34 pm

    I would like to create a textbox that includes a figure. The text should wrap around the figure. I tried the following. \documentclass[11pt]{book} % --- 1. Essential Packages --- \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{wrapfig} \usepackage{caption} \usepackage{calc} \usepackage[most]{tcolorbox} \usepackage{helvet} \usepackage{lipsum} \tcbset{ figbox/.style={ enhanced, colback=white, colframe=blue, arc=0mm, fonttitle=\bfseries\sffamily, before skip=15pt, after skip=15pt, boxrule=0.5pt, } } % New environment: wrapbox % Arguments: 1=Side (l or r), 2=Width of figure, 3=Image path, 4=Caption \newenvironment{wrapbox}[4]{ \begin{tcolorbox}[figbox] \begin{wrapfigure}{#1}{#2} \centering \includegraphics[width=#2]{#3} \captionof{figure}{#4} \end{wrapfigure} \leavevmode }{ \par \vspace{0.5pt} % Minimal spacing \end{tcolorbox} } % --- 4. Document Content --- \begin{document} \chapter{Chapter} \section{Section} \begin{wrapbox}{r}{0.35\textwidth}{example-image-a}{Title} Some text to describe an example. \end{wrapbox} \lipsum[5] \end{document} However, the figure is not in the box and even overlaps with my other text that should come after the box. If I have enough text (meaning more than the picture size) it works.However, if I do not have enough text to cover the picture the box is too small and the text below overwrites the figure.

  • Rafael Bombelli's mathematical power notation
    by Eff on January 9, 2026 at 12:02 am

    In the 1572 algebra book L'Algebra by Rafael Bombelli, he uses his own notation for powers. I want to reproduce this notation in LaTeX. Below is a screenshot from the book that shows how he wrote to the sixth power, the fifth power, etc. In general, x to the power of n is written as n above a kind of circular arc. I have found a good example where it is made nicely in LaTeX. But I don't know how to reproduce it. Can anyone offer a solution to writing this power notation in LaTeX?

  • TikZ overlay alignment issues in nested tcolorboxes: PDFLaTeX (LTR) vs XeLaTeX/Polyglossia (RTL)
    by user416144 on January 8, 2026 at 3:48 pm

    I am designing a complex lesson plan layout using tcolorbox. The design features specific vertical strips (margins) defined in the box's overlay. I use custom commands (\mrhala, \Time, \rems) based on TikZ to place content into these strips using absolute positioning relative to the page or box width. The Problem: The code works perfectly and aligns correctly when compiled with PDFLaTeX (LTR). However, my final document requires Arabic, so I must use XeLaTeX with polyglossia. When I switch to XeLaTeX, the horizontal positioning of these marginal notes breaks. They shift incorrectly or overlap, especially when used inside nested boxes. It seems that the coordinate calculations (e.g., \dimexpr, xshift) or the origin point (0,0) behave differently in the RTL context of XeLaTeX. Screenshots: Correct Output (PDFLaTeX): The marginal notes align perfectly with their columns. Incorrect Output (XeLaTeX with Polyglossia): The notes are shifted and misaligned. Minimal Working Example (MWE): \documentclass[a4paper]{article} \usepackage[margin=1cm]{geometry} \usepackage[most]{tcolorbox} \usepackage{amsmath,amssymb,mathtools,tikz,pifont,fontawesome,array,colortbl,varwidth,yagusylo,lipsum} \usetikzlibrary{calc,shapes.geometric,backgrounds} \renewcommand{\baselinestretch}{1.2} \pagestyle{empty} \parindent=0mm \newlength\BDmainW \newcommand\BDid{} % identifier of the current BoxDars \newlength\marahil \setlength\marahil{1.25cm} \newlength\modat \setlength\modat{1cm} \newlength\REMS \setlength\REMS{2.5cm} \newtcolorbox[auto counter]{BoxDars}{ enhanced,breakable, blanker,top=10mm, leftupper=\marahil+1mm, rightupper=\modat+\REMS+1mm, colback=white, bottom=3mm, before skip=3pt, after skip=10pt, parbox=false, before upper={% \edef\BDid{\thetcbcounter}% \setlength{\BDmainW}{\linewidth}% \tikz[remember picture,overlay]\coordinate (BDstart-\BDid) at (0,0);% }, overlay={ % Header background \draw[very thick,fill=orange!45] (interior.north west) rectangle ([yshift=-8mm]interior.north east); % Main Frame \draw[very thick,red!50!black] (interior.south west) rectangle (interior.north east); % --- Vertical Dividers --- % 1. Stages Divider (Left side) \draw[very thick,red!50!black] ([xshift=\marahil]interior.north west) -- ([xshift=\marahil]interior.south west); % 2. Remarks Divider (Right side) \draw[very thick,red!50!black] ([xshift={-\REMS}]interior.north east) -- ([xshift={-\REMS}]interior.south east); % 3. Time Divider (Right side, next to Remarks) \draw[very thick,red!50!black] ([xshift={-\modat - \REMS}]interior.north east) -- ([xshift={-\modat - \REMS}]interior.south east); % --- Header Labels --- % Stages Label (Left) \node[yshift=-4mm, font=\bfseries\small] at ([xshift=0.5*\marahil]interior.north west |- interior.north east) {Stages}; % Lesson Elements Label (Center) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={0.5*\linewidth +\marahil - \modat-\REMS}]interior.north west |- interior.north east) {Lesson Elements}; % Time Label (Right) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={ -(0.5*\modat+\REMS)}]interior.north east |- interior.north west) {Time}; % Remarks Label (Right) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={-0.5*\REMS}]interior.north east |- interior.north west) {Notes}; }} \newcommand{\whichbox}{% \ifnum\value{tcblayer}=0 Outside any box% \else Box \Roman{tcblayer}% \fi } \newcommand{\Time}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr\BDmainW+1mm+\modat/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[anchor=base, text width=\modat, align=center] at ([yshift=#1]target) {% {\large\yagding[ifsymclock]{148}}\\#2% }; \end{tikzpicture}% } \newcommand{\rems}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr\BDmainW+1mm+\modat+\REMS/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[anchor=base, text width=\REMS, align=center, font=\small] at ([yshift=#1]target) {#2}; \end{tikzpicture}% } \newcommand{\mrhala}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr-1mm-\marahil/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[inner sep=0, rotate=90] at ([yshift=#1]target) {#2}; \end{tikzpicture}% } \newtcolorbox{box1}{ title=Title: \whichbox, colframe=blue!50!black, colback=blue!5 } \newtcolorbox{box2}{colframe=red!50!black, colback=red!5, title=Nested Box (Level 2)} \newtcolorbox{box3}{colframe=green!50!black, colback=green!5, title=Deep Nested Box (Level 3)} \begin{document} \begin{BoxDars} \section*{Main Lesson Content} This is the main text area. The margins are handled automatically. \mrhala{Start} \Time{10 min} \rems{Intro Note} \vspace{1cm} \begin{box2} We are now inside a nested box. Notice how the indentation changes for the text, but the margin notes below will still snap to the main columns. \mrhala{Step 2} \Time{30 min} \lipsum[1][1-2] \begin{box3} Inside a deeply nested box... Even here, the commands reference the physical page edge. \rems{Deep Note} \Time{15 min} \mrhala{Final} \end{box3} \end{box2} \rems[3mm]{Final remarks} \end{BoxDars} \end{document} Below is the code. If you run it with pdflatex, it works. If you uncomment the polyglossia lines and run with xelatex, it breaks. Question: How can I adapt the coordinate calculations (specifically \dimexpr logic inside \mrhala, \Time, and \rems) to be robust in XeLaTeX/RTL, so that the notes align to the physical columns of BoxDars regardless of the nesting level?