• What would be the expl3 equivalent of \setbox0... + (Lua) box[0]
    by Denis Bitouzé on March 6, 2026 at 10:01 am

    This question is a followup of a previous question of mine that David kindly answered with the following example: \documentclass{article} \usepackage{csquotes} \def\test#1{% \setbox0\hbox{#1}% \usebox{0}% \directlua{ local nn=0 for n in node.traverse_glyph(tex.box[0].head) do nn=n.char end if nn==8221 then tex.print("\string~yes") else tex.print("\string~no") end }} \begin{document} \begin{enumerate} \item \test{“Foo”} \item \test{\enquote{Bar}} \item \test{xyz} \end{enumerate} \ExplSyntaxOff \end{document} I'd like to expl3-ify this MCE and here is the first step which works nicely: \begin{filecontents*}[overwrite]{myfile.lua} function closing_double_quote(glyph) local nn=0 for n in node.traverse_glyph(glyph) do nn=n.char end if nn==8221 then tex.print("yes") else tex.print("~no") end end \end{filecontents*} \documentclass{article} \usepackage{csquotes} \ExplSyntaxOn \lua_now:n{ require('myfile') } \cs_new_protected:Nn \__mymodule_closing_double_quote:n { \setbox0\hbox{#1} \usebox{0} : \c_space_tl \lua_now:n{ tex.write(closing_double_quote(tex.box[0].head)) } } \begin{document} \begin{enumerate} \item \__mymodule_closing_double_quote:n {“Foo”} \item \__mymodule_closing_double_quote:n {\enquote{Bar}} \item \__mymodule_closing_double_quote:n {xyz} \end{enumerate} \end{document} What remains is: \setbox0\hbox{#1} \usebox{0} that could be expl3-ified as follows: \hbox_set:Nn \l_tmpa_box { #1 } \box_use:N \l_tmpa_box But what would be the equivalent of box[0] in the Lua code: tex.write(closing_double_quote(tex.box[0].head))

  • How to set the vertical space between subtables?
    by CarLaTeX on March 6, 2026 at 8:51 am

    Is it possible to set the vertical space between two subtables as in Table 2 in the following MWE, but using something more "automatic" than setting a \vspace manually? \documentclass{book} \usepackage{subcaption} \subcaptionsetup[table]{position=top} \begin{document} \begin{table}[ht]\centering \caption{Table caption} \begin{subtable}{\linewidth}\centering \caption{First subtable caption} \begin{tabular}{cc} \hline a & b \\ c & d \\ \hline \end{tabular} \end{subtable} \begin{subtable}{\linewidth}\centering \caption{Second subtable caption} \begin{tabular}{cc} \hline e & f \\ g & h \\ \hline \end{tabular} \end{subtable} \end{table} \begin{table}[ht]\centering \caption{Table caption} \begin{subtable}{\linewidth}\centering \caption{First subtable caption} \begin{tabular}{cc} \hline a & b \\ c & d \\ \hline \end{tabular} \end{subtable}\vspace{10pt} \begin{subtable}{\linewidth}\centering \caption{Second subtable caption} \begin{tabular}{cc} \hline e & f \\ g & h \\ \hline \end{tabular} \end{subtable} \end{table} \end{document} Maybe this is a trivial question, but I found only the \vspace (or similar) answers.

  • \not\supseteq with kpfonts
    by Jinwen on March 6, 2026 at 4:21 am

    With kpfonts, \not\supseteq becomes \supsetneq, which is not desirable: Expected result should look like: This appears to be a bug, because \not\subseteq looks fine. However, before the package gets fixed, is there any temporary way to fix this behavior? \documentclass{article} % \usepackage{kpfonts} % \usepackage{unicode-math} \usepackage{kpfonts-otf} \begin{document} \( \not\supseteq \) \end{document}

  • tabularray, how to adjust space between table lastfoot
    by Zarko on March 5, 2026 at 3:53 pm

    In the following (not so minimal) MWE \documentclass[border={1mm 3mm}, 11pt]{standalone} %---------------------------------------------------------------% \usepackage[aboveskip=0.5ex, belowskip=0.5ex, format=plain, font = {stretch=0.84, scriptsize}, labelfont = bf, labelsep = colon, singlelinecheck = off]{caption} \usepackage{tabularray} \SetTblrStyle{note}{\tiny} \SetTblrStyle{remark}{\tiny} \usepackage{tblr-extras} \UseTblrLibrary{booktabs, caption, siunitx} \sisetup{range-units = single, range-phrase = {/} } %---------------------------------------------------------------% \begin{document} \begin{talltblr}[ caption = {Specifikacije razredov lastnosti večrodovnih optičnih vlaken.}, label = {tab:kabli-4}, note{*} = {EMB (Effective Modal Bandwidth) je mera kapacitete večrodovnih vlaken. Pove, koliko podatkov lahko prenesemo na dani razdalji. Maksimalni EMB je pri $\lambda=\qty{850}{\micro\metre}$.}, remark{Opomba} = {Razredi kakovosti določajo tudi barvo plaščev optičnih vlaken. Ujemajo se z barvami vrstic v tabeli.} ]{colsep = 3pt, colspec = {@{} *{5}{Q[c]} Q[c, si={table-format=5.0}] Q[c, si={table-format=3.0}] Q[c] @{}}, cells = {font=\scriptsize\linespread{0.84}\selectfont}, cell{1}{1-3,8} = {r=2}{}, cell{1}{4,6} = {c=2}{}, rowsep = 0pt, row{1,2} = {guard} } \toprule {oznaka\\ razreda} & {TIA\\standard} & {premer\\ jedro/plašč} & slabljenje (db/km), & & EMB\TblrNote{*} (MHz$\cdot$km), & & vir \\ \cmidrule[lr]{4-5} \cmidrule[lr]{6-8} & & & \qty{850}{nm} & \qty{1300}{nm} & \qty{850}{nm} & \qty{1300}{nm} & \\ \bottomrule %---------------- \end{talltblr} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} I like to reduce vertical space between table and (bottom rule) and table note remark. How to do this?

  • zref-clever as drop-in replacement for cleveref
    by Gargantuar on March 5, 2026 at 11:51 am

    I'm trying to define a drop-in replacement for cleveref by using zref-clever. There are, however, issues with amsmath's multiple parsing of equation environments and its redefinitions of \label. The MWE \documentclass{article} \usepackage{amsmath} \usepackage{zref-clever} \newcommand{\cref}{\zcref} \newcommand{\Cref}{\zcref[S]} \newcommand{\crefname}[3]{\zcRefTypeSetup{#1}{name-sg=#2, name-pl=#3}} \makeatletter \NewCommandCopy{\my@label}{\label} \RenewDocumentCommand{\label}{om}{\IfValueT{#1}{\zcsetup{reftype=#1}}\my@label{#2}} \makeatother \crefname{eqn}{my eqn}{my eqns} \begin{document} \begin{equation} \label[eqn]{myeqn} \end{equation} \zcref{myeqn} \end{document} gives the following error: ./test.tex:20: Use of \df@label doesn't match its definition. \endmathdisplay@a ... \ltx@label \@xp {\df@label } \fi \fi \ifnum \dspbrk@lvl... l.20 \end{equation} If you say, e.g., `\def\a1{...}', then you must always put `1' after `\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it. I also tried to append the optional argument, i.e., \label{myeqn}[eqn], but the [eqn] isn't picked up by \label. Any help is greatly appreciated.

  • Tikz error on a not-so-old file (once working)
    by user126154 on March 5, 2026 at 9:00 am

    I have an old latex file that in 2019 was perfectly ok. Today (in 2026) I try to compile the source and I get an error ERROR: Package tikz Error: Cannot parse this coordinate. The point in the file where it seems to be an error (according to emacs) is the following scope environment: \foreach\a in{(-30.5,4),(-13,9),(-16.5,-7.5),(34,0),(53,0),(72,0)} { \begin{scope}[shift={\a}] \draw (0,0) to[out=30, in=150] (4,0); \draw (-1,.5) to[out=-30, in=-150] (5,.5); \end{scope} } The weird thing is that file was completely fine and compiling some years ago! I isolated the problem creating a test file \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach\a in{(10,2), (5,-3)} { \begin{scope}[shift={\a}] \draw (0,0) to (2,2); \end{scope} } \end{tikzpicture} \end{document} and I get the same error. So, my question is What's wrong now, and how I can fix it in the current version of tikz?

  • Padded page number with hyperref
    by Myvh on March 5, 2026 at 8:09 am

    My goal is to have zero-padded page numbers in the footer and in the table of contents. I use the code from this answer. However, it breaks with the hyperref package, only when the total page number has one digit, with the following error: test.tex: error: 86: Use of \??? doesn't match its definition. \newpage. I know that the padding is not needed in this case, but I would like the code to be more robust and also to understand why it breaks in that case. Here is a minimal working example. You can comment out/in \manypages to toggle between the code that breaks or not. \documentclass{article} \usepackage{lastpage} \usepackage{fancyhdr} \usepackage{hyperref} \hypersetup{ colorlinks = true, allcolors = blue } % From https://tex.stackexchange.com/a/730655/228589 \ExplSyntaxOn \NewDocumentCommand{\paddedcounter}{m} { \AtBeginDocument { \cs_if_exist:cF {maxdigits#1} { \cs_gset:cpn {maxdigits#1} {8} } } \AtEndDocument { \iow_now:ce {@mainaux} { \token_to_str:N \maxdigits{#1}{\fp_eval:n{logb(\value{#1}+0.1)+1}} } } \cs_gset:cpn {the#1} { \padded{#1} } } \NewDocumentCommand{\maxdigits}{mm} { \cs_gset:cpn {maxdigits#1}{#2} } \NewExpandableDocumentCommand{\padded}{m} { \prg_replicate:nn { \use:c { maxdigits#1 } - \tl_count:e { \arabic{#1} } } { 0 } \arabic{#1} } \ExplSyntaxOff \paddedcounter{page} \pagestyle{fancy} \fancyhead{} \renewcommand{\headrulewidth}{0pt} \fancyfoot[C]{\thepage\ / \pageref*{LastPage}} \newcommand{\manypages} { \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage } \begin{document} \thispagestyle{fancy} \begin{center} {\Huge Some title} \end{center} \tableofcontents \newpage \manypages \end{document}

  • Fadings and shadings with shifted origins for strokes in TikZ
    by karlh on March 4, 2026 at 11:59 pm

    I have been working with fadings a lot recently, and I encountered a fading in Inkscape that I'm having trouble translating to an equivalent TikZ implementation. The situation is a faded stroke for which the fading boundaries do not coincide with the outline of the shape, and the "center" of the fading is not the center of the object. I have worked out a method that works for filled paths, such as: \begin{tikzpicture} \path [fill=orange,path fading=fade right] (0,0) rectangle (2,2); \draw [very thin,->] (0,1) -- (2,1); \begin{scope} \clip (0,-3) rectangle (2,-1); \fill [orange] (-1,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-3) rectangle (2.5,0); \end{scope} \draw [overlay,very thin,->] (1,-2) -- (3,-2); \end{tikzpicture} where the arrow indicates the start and end points of the shading (equivalent to what you would see with Inkscape's node tool). Similarly, the shading can be rotated with a similar shift in origin like so: \begin{tikzpicture} \path [fill=orange,path fading=fade right,fading angle=30] (0,0) rectangle (2,2); \draw [very thin,->] (0.133974,0.5) -- ++(30:2); \begin{scope} \clip (0,-3) rectangle (2,-1); \begin{scope}[transform canvas={rotate around={30:(1,-2)}}] \fill [orange] (-3,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-4) rectangle (2,0); \end{scope} \end{scope} \draw [overlay,very thin,->] (1,-2) -- ++(30:2); \end{tikzpicture} This works fine for filled regions that are to be shaded or faded. However, the same trick—filling a larger object and then clipping—will not work with strokes that are to be shaded or faded. Is there a way to tell TikZ that the origin of the shading should be different than the bounding box of the object? It would also be desirable for the resulting line to be solid even if it goes off the "edge" of the square that defines the fading. I have also had trouble with faded strokes (without origin translation) not appearing in the PDF, but from a post I found while researching this, the issue is a PDF viewer issue (i.e., Evince and Papers display faded strokes incorrectly, but they show up correctly in MuPDF, say); if there is a way to avoid that problem, great, but otherwise I will chalk that up to "not a TikZ problem." The result should look something like this: Here's the whole thing, with headers: \documentclass{article} \usepackage{tikz} \usetikzlibrary{fadings} \tikzfading[name=fade right,left color=transparent!0,right color=transparent] \begin{document} I have been working with fadings a lot recently, and I encountered a fading in Inkscape that I'm having trouble translating to an equivalent Ti*k*Z implementation. The situation is a faded *stroke* for which the fading boundaries do not coincide with the outline of the shape. I have worked out a method that works for *filled* paths, such as: \begin{center} \begin{tikzpicture} \path [fill=orange,path fading=fade right] (0,0) rectangle (2,2); \draw [very thin,->] (0,1) -- (2,1); \begin{scope} \clip (0,-3) rectangle (2,-1); \fill [orange] (-1,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-3) rectangle (2.5,0); \end{scope} \draw [overlay,very thin,->] (1,-2) -- (3,-2); \end{tikzpicture} \end{center} where the arrow indicates the start and end points of the shading (equivalent to what you would see with Inkscape's node tool). Similarly, the shading can be *rotated* with a similar shift in origin like so: \begin{center} \begin{tikzpicture} \path [fill=orange,path fading=fade right,fading angle=30] (0,0) rectangle (2,2); \draw [very thin,->] (0.133974,0.5) -- ++(30:2); \begin{scope} \clip (0,-3) rectangle (2,-1); \begin{scope}[transform canvas={rotate around={30:(1,-2)}}] \fill [orange] (-3,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-4) rectangle (2,0); \end{scope} \end{scope} \draw [overlay,very thin,->] (1,-2) -- ++(30:2); \end{tikzpicture} \end{center} \end{document}

  • mathic not working with \DocumentMetadata
    by Gargantuar on March 4, 2026 at 7:18 pm

    The MWE \DocumentMetadata{} \documentclass{article} \usepackage{mathtools} \mathtoolsset{mathic} \begin{document} \(a\) \end{document} gives the following error Runaway argument? \fi a\) \par \end {document} ! File ended while scanning use of \__math_grab_dollar_delim:w. <inserted text> \par <*> test.tex I suspect you have forgotten a `}', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better type `E' or `X' now and fix your file. Removing either \DocumentMetadata or mathic compiles. Why is that? It seems like a (recent) bug. EDIT: for reproducibility, the pdfLaTeX version used was pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026/Arch Linux) with the command pdflatex -interaction=nonstopmode -shell-escape -halt-on-error.

  • `\textwidth` not long enough
    by user145836 on March 4, 2026 at 6:45 pm

    Simple \maketitle and section modifications \usepackage{titling} \setlength{\fboxsep}{0em} \setlength{\fboxrule}{2pt} \renewcommand{\maketitle}{ \fbox{ \begin{minipage}{\textwidth} \centering \par\vskip1em\noindent {\LARGE\bf\sc \thetitle} \par\vskip0.5em\noindent {\large\sc \theauthor} \par\vskip1em\noindent \end{minipage} }} \usepackage{titlesec} \titleformat{\section}[block]{\scshape\large}{}{0em}{}[\hrule width \textwidth] do not align (on the right). It seems that \textwith is not wide enough. The same goes when using \titlerule. Why?

  • LaTeX forest: Reorder leaves
    by edgelord on March 4, 2026 at 2:52 pm

    I'm using the LaTeX package forest to render "surface grammar trees" of sentences. Using the particular grammar I'm using (Eisenberg), you can get trees where the leaves are not in natural order. E. g. the sentence "Ich suche verzweifelt einen Stift" ("I search desperately a pen") would have the adverb "verzweifelt" ("desperately") attached to the rest of the sentence at the very last layer and the syntactical analysis tree would look something like this: How is this possible in forest without having to put the adverb to the end of the sentence (which wouldn't make sense). This would produce the correct tree structure but with the wrong word order. How can I specifically move the "verzweifelt" node to the third word position without changing the tree structure? \documentclass{article} \usepackage{forest} \usetikzlibrary{calc} \usepackage[T1]{fontenc} \begin{document} \begin{forest} for tree={ grow=south, parent anchor=south, child anchor=north, align=center, l sep=15pt, s sep=10pt, edge path={ \noexpand\path [draw] (!u.south) -- +(0,-5pt) -| (.north)\forestoption{edge label}; }, } [$S_2$ [S [Ich, tier=word] [suche, tier=word] [PrGr [einen, tier=word] [Stift, tier=word] ] ] [verzweifelt, tier=word] ] \end{forest} \end{document}

  • Luatex - Coloring Haraka
    by Mario Fischer on March 4, 2026 at 6:08 am

    I want to colour the harakat (diacritics) of a text in Pashto. I use Luatex, and I want to switch this function on and off. It should look like I tried this code: \documentclass{article} \usepackage{fontspec} \usepackage{xcolor} \usepackage{luacolor} \usepackage[bidi=basic]{babel} % Setup Arabic language \babelprovide[import, main]{arabic} % THE FIX: Use Renderer=Node instead of Harfbuzz \babelfont{rm}[Renderer=Node]{Amiri} % 1. The Lua Script \directlua{ harakat_attr_val = nil local luacolor_attr = luatexbase.attributes['luacolor'] local function color_harakat(head) if not harakat_attr_val then return head end for item in node.traverse_id(node.id("glyph"), head) do local char = item.char -- Unicode range for Arabic harakat (0x064B to 0x065F) -- and the superscript Alef (0x0670) if (char >= 0x064B and char <= 0x065F) or char == 0x0670 then node.set_attribute(item, luacolor_attr, harakat_attr_val) end end return head end % Add the filter so it runs before the font shaper luatexbase.add_to_callback("pre_linebreak_filter", color_harakat, "color_harakat") } % 2. Custom command to safely set the Harakat color \makeatletter \newcommand{\setHarakatColor}[1]{% \begingroup \color{#1}% \directlua{ harakat_attr_val = tex.attribute[luatexbase.attributes['luacolor']] }% \endgroup } \makeatother \begin{document} \begin{center} \Huge % Tell LuaTeX to color all following harakat Red \setHarakatColor{red} بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ \vspace{1cm} % Switch to blue! \setHarakatColor{blue} بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ \end{center} \end{document} But it is not coloring. What might be the problem, or is there an easy option in Luatex?

  • TikZ: How to add a node where a path gets clipped
    by Edoardo Serra on March 3, 2026 at 3:07 pm

    I am designing a square (or “squarish” actually) map protractor in TikZ. So far, I have managed to draw the degree ticks along the four sides by clipping radial lines between two closed paths using the even odd rule like I saw in this answer. The ticks are generated in a \foreach loop. To avoid drawing long ticks on top of short ones, I separated them into two loops using a conditional test. I am not sure whether this separation is actually necessary for correct SVG export/printing, but that is how I implemented it. Below is a MWE: \documentclass[tikz]{standalone} %,convert={outfile=\main.svg} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{intersections, pgfplots.fillbetween} \pgfdeclarelayer{pre main} \pgfdeclarelayer{main} \pgfsetlayers{pre main, main} \usetikzlibrary{shapes} \begin{document} %all of this is needed to easily clip between two closed paths using even odd rule \makeatletter \def\@appendnamedsoftpath#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\@temppatha\expandafter\expandafter\expandafter{\expandafter\@temppatha\@temppathb}% \pgfsyssoftpath@setcurrentpath\@temppatha } \def\@appendnamedpathforactions#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\def\expandafter\@temppatha\expandafter{\csname @temppatha\expandafter\endcsname\@temppathb}% \let\tikz@actions@path\@temppatha } \tikzset{ use path for main/.code={% \tikz@addmode{% \expandafter\pgfsyssoftpath@setcurrentpath\csname tikz@intersect@path@name@#1\endcsname }% }, append path for main/.code={% \tikz@addmode{% \@appendnamedsoftpath{#1}% }% }, use path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions\expandafter\let\expandafter\tikz@actions@path\csname tikz@intersect@path@name@#1\endcsname}% }, append path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions \@appendnamedpathforactions{#1}}% }, use path/.style={% use path for main=#1, use path for actions=#1, }, append path/.style={% append path for main=#1, append path for actions=#1 } } \makeatother \begin{tikzpicture} \pgfmathsetmacro\bigside{7} \pgfmathsetmacro\smallsidedelta{0.5} %cuts \draw[rounded corners=12pt, name path=outside] (0,0) rectangle (\bigside,\bigside); \draw[dotted, rounded corners=12pt, name path=inside] (\smallsidedelta,\smallsidedelta) rectangle (\bigside-\smallsidedelta,\bigside-\smallsidedelta); %remove before cutting or printign. Just as reference grid %backside print \tikzfillbetween[of=inside and outside] {white}; %print on transparent plastic so this is needed for better readability %frontside print \pgfmathsetmacro\degreesmallticksize{0.2} \pgfmathsetmacro\degreemidticksize{0.35} \pgfmathsetmacro\outerradius{sqrt(2*\bigside/2*\bigside/2)} \path[rounded corners=12pt, name path=degrees short] (\degreesmallticksize,\degreesmallticksize) rectangle (\bigside-\degreesmallticksize,\bigside-\degreesmallticksize); \path[rounded corners=12pt, name path=degrees mid] (\degreemidticksize,\degreemidticksize) rectangle (\bigside-\degreemidticksize,\bigside-\degreemidticksize); \begin{scope} [even odd rule] %small ticks \clip[use path=outside, append path=degrees short]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=0 \draw[thin] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} %had to add a second scope and for loop since the clipped area is different \begin{scope} [even odd rule] %mid ticks \clip[use path=outside, append path=degrees mid]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=1 \draw[thick] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} \end{tikzpicture} \end{document} And the output is the following: I would now like to add a label at the inner end of each thick (5°) tick, displaying the corresponding degree value (0–355), like this: Now a few nuances: The numbers must always face towards the inside, with the exception, if possible, of the bottom row of numbers from 135° to 225°. When numbers get big, they don't have enough space to fit unless the labels become too small to read (actual printing size of the protractor will be something like 7x7 or 8x8cm). So they need to be shifted in such a way that they fit. 355 in the provided image is a clear example of what I mean. I can consider shifting them radially as well, but they need to stay to the outside of the dotted line, which I can make a little smaller. I really don't know where to start and didn't manage to find anything online. Thank you for your time!

  • How to label axes, points, and curves in a 3D plot using luadraw?
    by Octavius on March 3, 2026 at 2:00 pm

    The question arised from the previous link and the luadraw solution. I am using luadraw to visualize the surface z = x^2 + y^2 together with the intersection curve corresponding to the direction u = (1,0). I would like to know whether it is possible to: Label the coordinate axes $x$, $y$, and $z$, Label the point $c = (0,0)$, Indicate the direction $u = (1,0)$, And label the function $F(t) = t^2$ corresponding to the intersection curve. When I try to use Dtext3d, the document compiles but the output appears blank in Overleaf. Is there a reliable way to add these labels when using luadraw? \documentclass[border=5pt]{standalone} \usepackage[svgnames]{xcolor} \usepackage[3d]{luadraw} \usepackage{fourier-otf} \usepackage{tikz} \begin{document} \begin{luadraw}{name=paraboloid} local g = graph3d:new{ window3d = {-2,2,-2,2,0,8}, window = {-4.5,4,-3,9.5}, size = {10,10,0}, viewdir = perspective("central",30,50,20) } -- Surface local S = cartesian3d(function(x,y) return x^2+y^2 end, 2,-2,-2,2) -- Direction local c = Origin local u = M(1,0,0) local N = pt3d.prod(u, vecK) -- Intersection curve local Curve = g:Intersection3d(S, {c,N}) -- Draw surface g:Dfacet(S, {usepalette={palGasFlame,"z"}, edgecolor="gray", clip=true}) -- Draw curve g:Dedges(Curve, {hidden=true, color="Navy", width=12}) -- Axes g:Dline3d({Origin, M(2,0,0)}, {color="black", width=1, dash="dotted"}) g:Dline3d({Origin, M(0,2,0)}, {color="black", width=1, dash="dotted"}) g:Dline3d({Origin, M(0,0,6)}, {color="black", width=1, dash="dotted"}) g:Show() \end{luadraw} % ---- 2D overlay labels (safe in Overleaf) ---- \begin{tikzpicture}[overlay] \node at (3.7,4.2) {$x$}; \node at (1.1,4.8) {$y$}; \node at (2.5,7.3) {$z$}; \end{tikzpicture} \end{document}

  • Why is it necessary to keep first line of input in 'buffer' array?
    by Igor Liferenko on March 3, 2026 at 6:24 am

    In §331 of tex.web we have this: first:=1; ... if not init_terminal then goto final_end; first:=last+1; {|init_terminal| has set |loc| and |last|} So, before input_ln, which is called by init_terminal, we have: loc is 0, first is 1, last is 0. Let's type x<return> in response to **. Then after init_terminal we will have: loc is 1, first is 1, last is 2. And then (due to above snippet) first will be 3. This means that first line of input is permanently kept in buffer array throughout the entire TeX job. And so the length of the first line will restrict the length of line that TeX can read. In particular, one and the same file will compile cleanly if file name is relative, and will fail to compile if file name is absolute. Why first line of input is kept in buffer array?

  • The sizes of \because and \therefore in exam-zh
    by M. Logic on March 3, 2026 at 1:34 am

    A MWS is as follows. \documentclass{exam-zh} \makeatletter \DeclareSymbolFont{AMSa}{U}{msa}{m}{n} %\DeclareSymbolFont{AMSb}{U}{msb}{m}{n} \DeclareMathSymbol{\therefore}{\mathrel}{AMSa}{"29} \DeclareMathSymbol{\because}{\mathrel}{AMSa}{"2A} \makeatother \begin{document} $\because ABCD=\therefore ABCD$ \end{document} As you see, the sizes of \because and \therefore in exam-zh are very small although I invoke them from amssymb. How to fix this to make the sizes of them be normal when invoking them from amssymb?

  • tabularray - make talltblr caption mirror other captions
    by user20478285 on March 3, 2026 at 12:13 am

    \documentclass{article} \usepackage[font=small, labelfont=bf, format=hang]{caption} \usepackage{tabularray} \usepackage{tblr-extras} \UseTblrLibrary{amsmath, booktabs, caption} \begin{document} \begin{table}[h] \centering \begin{talltblr}[caption={A talltblr table.}]{colspec={cc}} \toprule a & b\\ \midrule x & y\\ \bottomrule \end{talltblr} \end{table} \end{document} Using the code above, I get the following result for my talltblr (i.e. the caption width is limited to the table width). I tried the approach from here: \documentclass{article} \usepackage[font=small, labelfont=bf, format=hang]{caption} \usepackage{tabularray} \usepackage{tblr-extras} \UseTblrLibrary{amsmath, booktabs, caption} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DefTblrTemplate{firsthead}{caption}{% \makebox[\tablewidth]{\parbox{\columnwidth}{% \UseTblrTemplate{caption}{normal}% }}% } \SetTblrTemplate{firsthead}{caption} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{table}[h] \centering \caption{A regular table. A regular table. A regular table. A regular table. A regular table. A regular table. A regular table. A regular table. A regular table.} \begin{tabular}{cc} \toprule a & b\\ \midrule x & y\\ \bottomrule \end{tabular} \end{table} \begin{table}[h] \centering \caption{A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table. A tblr table.} \begin{tblr} { colspec={cc} } \toprule a & b\\ \midrule x & y\\ \bottomrule \end{tblr} \end{table} \begin{table}[h] \centering \begin{talltblr} [ caption={A talltblr table. A talltblr table. A talltblr table. A talltblr table. A talltblr table. A talltblr table. A talltblr table. A talltblr table.} ] { colspec={cc} } \toprule a & b\\ \midrule x & y\\ \bottomrule \end{talltblr} \end{table} \end{document} Now the caption has the right width, but it is too close to the table itself. Also, the caption font is too big and the label is not bold, which I can fix / hack if I add \SetTblrStyle{caption-tag}{font=\small\bfseries} \SetTblrStyle{caption-text}{font=\small} but I'm not sure if this is the way to go (and it does not fix the issue of the caption touching the table). I also tried to have a look at the default caption definitions myself in the source code but I just don't understand even remotely enough of LaTeX3). Edit for clarity: I don't need to be able to control table, talltblr, and tblr with \captionsetup, I am rather looking for a way to get the same consistent captions for figure, table, tblr and talltblr environments in my document. I realise this is not easy, especially since the different caption style for talltblr is apparently a feature: I don't think it is a bug. In many aspects, tabularray is different from traditional tables https://github.com/TeXackers/tabularray/issues/255#issuecomment-1142833319)

  • Improving the visibility of a curve in a 3D PGFPlots surface
    by Octavius on March 2, 2026 at 4:50 pm

    In the left-hand figure, I would like to improve the visualization so that the red curve is more clearly visible. \documentclass[12pt,b5paper,twoside,openany]{book} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath,amssymb,amsfonts,amsthm} \usepackage{graphicx} \usepackage{xcolor} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \hypersetup{colorlinks=true,linkcolor=black,citecolor=black} \newtheorem{example}{Example} \setlength{\parindent}{0pt} \begin{document} \begin{example} Consider the function \[ f(x,y)=x^2+y^2, \] the point \[ c=(0,0), \] and the direction \[ u=(1,0). \] To study the variation of $f$ at $c$ in the direction $u$, we define the one-variable function \[ F(t)=f(c+tu). \] In this case, \[ c+tu=(t,0), \] and therefore \[ F(t)=f(t,0)=t^2. \] Thus, when we move away from $c$ in the direction $u$, the values of $f$ vary according to the quadratic function $F(t)=t^2$. The directional derivative of $f$ at $c$ in the direction $u$ is given by \[ f'(c;u)=F'(0). \] Since \[ F'(t)=2t, \] we obtain \[ f'(c;u)=F'(0)=0. \] \end{example} \bigskip \begin{center} \begin{tikzpicture} % --- SURFACE --- \begin{axis}[ at={(0,0)}, anchor=origin, view={120}{25}, axis lines=center, axis line style={->}, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, domain=-2:2, y domain=-2:2, samples=30, samples y=30, width=8cm, height=8cm ] % Surface z = x^2 + y^2 \addplot3[surf, opacity=0.4] {x^2+y^2}; % Curve corresponding to F(t) \addplot3[very thick, red, domain=0:1.2, samples=100] ({x},{0},{x^2}); \end{axis} % --- GRAPH OF F(t) --- \begin{axis}[ at={(7cm,0)}, anchor=origin, axis lines=middle, axis line style={->}, xlabel={$t$}, ylabel={$F(t)$}, domain=-1.5:1.5, samples=200, width=7cm, height=6cm ] \addplot[very thick, red] {x^2}; \node at (axis cs:1,1) [red, anchor=west] {$F(t)=t^2$}; \end{axis} \end{tikzpicture} \end{center} \end{document}

  • Disable stretching between words while using babel for Thai
    by p_pattedd on March 2, 2026 at 8:04 am

    When typing a document in Thai with babel (using XeLaTeX via MikTeX), sometimes it outputs with these spaces between words, for example: MWE: \documentclass[12pt,a4paper]{article} \usepackage[no-math]{fontspec} \usepackage[thai,provide=*]{babel} \babelfont[thai]{rm}[Scale=1.33333]{TH Sarabun New} \renewcommand\baselinestretch{1.4} \begin{document} เดิมแผ่นดินเมืองจีนทั้งปวงนั้น เปนสุขมาช้านานแล้วก็เปนศึก ครั้นศึกสงบแล้วก็เปนสุข มีพระมหากษัตริย์ทรงพระนามพระเจ้าจิวบูอ๋อง แลพระวงศ์ได้เสวยราชย์ต่อ ๆ ลงมาเปนหลายพระองค์ ได้ความสุขมาถึงเจ็ดร้อยปี จึงมีผู้ตั้งแขงเมืองถึงเจ็ดหัวเมือง ครั้งนั้นพระเจ้าจิ๋นอ๋องได้เสวยราชย์ในเมืองจิ๋นก๊กให้ไปตีเอาหัวเมืองทั้งเจ็ดนั้น เข้าอยู่ในอาณาจักรพระเจ้าจิ๋นอ๋องทั้งสิ้น ครั้นอยู่มาพระเจ้าจิ๋นอ๋องเสียแก่ฮั่นฌ้อ แล้วฮั่นโกโจกับฮั่นฌ้อรบกัน จึงได้ราชสมบัติแก่ฮั่นโกโจ ฮั่นโกโจแลพระราชวงศ์ได้เสวยราชสมบัติต่อ ๆ มาในแผ่นดินจีนนั้นถึงสิบสององค์ มีขุนนางคนหนึ่งชื่ออองมังเปนขบถชิงเอาราชสมบัติได้ เปนเจ้าแผ่นดินอยู่สิบแปดปี แล้วจึงมีหลานพระเจ้าฮั่นโกโจชื่อฮั่นกองบู๊จับอองมังฆ่าเสียชิงเอาราชสมบัติได้เสวยราชย์สืบวงศ์มาสิบสององค์ พระองค์ได้เสวยราชย์ที่สุดนั้น ทรงพระนามพระเจ้าเหี้ยนเต้ จึงแตกเปนสามเมือง ภาษาจีนเรียกว่า สามก๊ก \end{document} How to stop LaTeX from doing this? (I have read babel-thai documentation, but none of the macros seems to work.)

  • Redesign of arrow at circuitikz ccgsw symbol
    by Zarko on March 2, 2026 at 7:20 am

    In circuitikz symbol ccgsw I like to change the color of arrow (by simple in-line selection, if is possible) and arrow head for example from stealth to Straight Barb. How to do this? \documentclass[margin=3mm]{standalone} \usepackage{xcolor} \usepackage{circuitikz} \begin{document} \begin{circuitikz} \draw[gray] (0,0) to [ccgsw={$t=t_b$}] (2,0) ; \end{circuitikz} \end{document}

  • BibLaTeX specified language is not used
    by Knudsen on March 2, 2026 at 6:40 am

    Why would biblatex fill out this entry with Cyrillic while the language being specified is Serbian written in Latin? \documentclass{article} \begin{filecontents*}{test.bib} @book{Mitri-vol1-sr, title={Cauchyjev račun ostataka sa primenama}, author = {Mitrinović, Dragoslav S. and Kečkić, Jovan D.}, series = {Matematički problemi i ekspozicije}, volume = {8}, year = {1978}, publisher = {Naučna Knjiga}, address = {Beograd}, pages = {271}, langid = {serbian}, } \end{filecontents*} \usepackage{fontspec} \newfontfamily\cyrillicfont{STIX Two Text} \usepackage{polyglossia} \usepackage{csquotes} \setmainlanguage{english} \setotherlanguage{serbian} \usepackage[style=authoryear, backend=biber, autolang=other, ]{biblatex} \addbibresource{test.bib} \begin{document} \nocite{*} \printbibliography \end{document}

  • tiered list with a heading with tree-like |- line connectors that enumerate items
    by Mampac on March 1, 2026 at 4:08 pm

    how do i get a list that has a heading (in this example, "Deep Learning Methods" as the heading), from which level-2 entries are connected with solid lines? so far i draw the connector lines with tikz like this: which looks fine except for the extra-bolded trunk of the tree due to multiple retracing of the same connector path in my current implementation. it is super-subtle, but when you zoom out of the PDF file, you can see marginal pixel strips lacking at the upper part of the tree trunk where it's thinner than the rest. the MRE is as follows: \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark,calc} \tikzset{ taxonomy/.style={ overlay, remember picture } } \newcommand{\subcatindent}{1.3em} \newcommand{\methodsindent}{2.3em} \begin{document} unrelated text\\ \textbf{\tikzmarknode{dl}{\underline{Deep Learning Methods}}}\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_convo}{Convolution}}\\ \hspace*{\methodsindent}AE-based\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_ae}{Autoencoders}}\\ \hspace*{\methodsindent}Method D2\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_gan}{GANs}}\\ \hspace*{\methodsindent}Method D3\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_diff}{Diffusion}}\\ \hspace*{\methodsindent}Method D3\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_att}{Attention-Driven}}\\ \hspace*{\methodsindent}Method D3\\ \hspace*{\subcatindent}\textbf{\tikzmarknode{dl_ens}{Ensemble}}\\ \hspace*{\methodsindent}Method D3 \begin{tikzpicture}[taxonomy] \newcommand{\srcOffsetX}{+0.3em} \newcommand{\srcOffsetY}{-1.0ex} \coordinate (dl_start) at ($(dl.south west)+(\srcOffsetX,\srcOffsetY + 0.3ex)$); \coordinate (dl_lowest) at (dl_ens.west); \coordinate (dl_trunk) at ($(dl_start |- dl_lowest)$); \draw (dl_start) -- (dl_trunk); \draw (dl_trunk) |- (dl_convo.west); \draw (dl_trunk) |- (dl_ae.west); \draw (dl_trunk) |- (dl_gan.west); \draw (dl_trunk) |- (dl_diff.west); \draw (dl_trunk) |- (dl_att.west); \draw (dl_trunk) |- (dl_ens.west); \end{tikzpicture} \end{document} is there a way to dynamically and systematically implement this so that the connectors are drawn exactly at the place where the previous one turned 90 degrees to the right? ideally, i could turn this in a custom list environment, but so far i don't see a clear way of solving the retracing problem.

  • How to change "python" language style of listings package
    by Syvshc on March 1, 2026 at 3:28 pm

    I want to define my own style of Python, so I write \documentclass{article} \usepackage{listings, xcolor} \lstset { basicstyle = \ttfamily\small, frame = leftline, framerule = 1pt, } \lstdefinelanguage{python}{ morekeywords = {python, red}, keywordstyle = {\bfseries\color{red}}, rulecolor = {\color{red}}, } \begin{document} \begin{lstlisting}[language=python] python, red \end{lstlisting} \end{document}% after compiling with texlive 2025, I got: It did not work. I thought it might be the problem with the default settings of listings.sty package, i.e. lstlang1.sty. However, I can change the style of matlab language: \documentclass{article} \usepackage{listings, xcolor} \lstset { basicstyle = \ttfamily\small, frame = leftline, framerule = 1pt, } \lstdefinelanguage{python}{ morekeywords = {python, red}, keywordstyle = {\bfseries\color{red}}, rulecolor = {\color{red}}, } \lstdefinelanguage{Matlab}{ morekeywords = {Matlab, lime}, keywordstyle = {\bfseries\color{lime}}, rulecolor = {\color{red}}, } \begin{document} \begin{lstlisting}[language=python] python, red \end{lstlisting} \begin{lstlisting}[language=Matlab] Matlab, lime \end{lstlisting} \end{document}% The output is: I wonder why it happened and how I can actually change the style of "python" language. EDIT: I found that this does not work only on TexLive 2025; my version of listings is 76899, and it's cat-version is 1.11b. If I compile this file with 1.10a and TexLive 2024 on Overleaf, all things worked well. EDIT: I found that listings package is insensitive to the language name, Python, python, and PYTHon point to the same language

  • Automatic italic for foreign words
    by Apothikon on March 1, 2026 at 2:06 pm

    Foreign words or phrases inside a mostly monolingual document should usually be displayed in italic. How can this be achieved automatically using babel? I have produced the following code: \documentclass{article} \usepackage{lipsum} \usepackage[french, british, italian]{babel} % Font for the main language \babelfont{rm}{ebgaramond} % Font for foreign languages, inverting roman and italic \babelfont [french, british]{rm}{ebgaramond-Italic} \begin{document} MAIN LANGUAGE \lipsum[1] \vspace{1em} FOREIGN LANGUAGE \foreignlanguage{british}{\lipsum[1]} \end{document} However, I can see some problems in my approach: If I define new features for the font (ligatures, character variants...) I must repeat them for both the main and the foreign font; If I add new languages I must remember to add them to the list of foreign languages to which the italic must be applied. I am quite sure that the amazing babeltransform can easily make it more automatic.

  • Italic text with upright uppercases
    by Apothikon on March 1, 2026 at 1:45 pm

    Can someone suggest a method to have Roman (upright) capitals in italic texts, in the style of Aldus Manutius and of the early Renaissance books? I believe it could probably be done with the lua.otf.font.handler but I don't know where to start. Also, I think at least two aspects need to be kept in mind: Efficiency: the approach should not be too heavy, in order to be usable also for large documents with many paragraphs in italics; Kerning: it will probably be required to define new kerning pairs for many (or every) capital, and I expect this to be done manually depending on the font used in the document. As an example to test this: \documentclass{article} \usepackage{lipsum} \usepackage{ETbb} % A font in the style of Aldus Manutius \begin{document} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \vspace{1em} \textit{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \vspace{1em} \lipsum[1] \vspace{1em} \textit{\lipsum[1]} \end{document} Every suggestion, even if not a complete answer, is very appreciated.

  • Reset counter in \newtheorem
    by Afonso Guerra on March 1, 2026 at 10:52 am

    I'm trying to make a title with \newtheorem{case}{Caso} (My code is in Portuguese-Portugal) and it outputs Caso X. "X" being the next number. So here is the thing, I actually need to reset the "X" value, and I have tried the [theorem] parameter, but it doesn't work for me so can anyone help? Here is my code: \documentclass[12pt]{report} \usepackage[]{amsmath,amsthm,amssymb,amscd} \usepackage[a4paper,margin=25mm]{geometry} \usepackage{babel} \usepackage{pgfplots} \usepackage{multirow} \usepackage{booktabs} \usepackage{framed} \newtheorem{case}{Caso} \begin{document} \begin{case} Não conhecemos a distribuição de $X_1$ ou $X_2$, mas os tamanhos das amostras não apresentão assimetrias exageradas. \end{case} \begin{case} % Some text here % \end{case} % Reset the X value % \begin{case} % More text here, but with it saying "Caso 1." % \end{case} \end{document} If you want something else please tell me.

  • How to produce an effect of bracket below with text?
    by Sunshine on March 1, 2026 at 5:29 am

    I want to produce the bracket like this: \documentclass{article} \begin{document} There is a bracket below with text. \end{document}

  • How to fit these items on three separate lines
    by Ricky W. on March 1, 2026 at 3:11 am

    I am trying to make this bullet points look nice in three lines but here is the problem. it won't fit. Here is my code \documentclass{beamer} \setbeamertemplate{theorems}[numbered] \begin{frame} \frametitle{Definitions} \begin{definition}[Normed Linear Space] A linear space $\mathbb{X}$ is a normed linear space if, to each vector $x\in \mathbb{X}$, there is a real-valued norm $\left\|x\right\|$ that satisfies \begin{itemize}[$\bullet$] \item $\left\|x\right\| \geq 0$ for all $x\in \mathbb{X}$, with $\left\|x\right\|=0$ if and only if $x=0$ \item $\left\|x+y\right\| \leq \left\|x\right\| + \left\|y\right\| $ for all $x,y\in \mathbb{X}$ \item $\left\|ax\right\|=|a|\left\|x\right\|$ for all $a\in \mathbb{R}$ and $x\in \mathbb{X}$ \end{itemize} Here is what I got

  • How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve using Lua?
    by Jasper on February 27, 2026 at 5:58 pm

    How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve. My goal is to avoid using an approach which first tessellates curves into line segments, and tests each line segment pair. That is O(n^2). I want something which can scale. I think Lua is appropriate for this, based on evidence in the comments. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (-2,0) -- (2,0); \draw[->] (0,-2) -- (0,e^2); \draw[domain=-2:2] plot (\x,e^\x); \draw[domain=-2:2] plot (\x,\x+1.5); % two intersections \draw[domain=-2:2] plot (\x,\x+1); % one intersection \draw[domain=-2:2] plot (\x,-\x+4.5); % one intersection \draw[domain=-2:2] plot (\x,\x); % zero intersections % My goal is to use pgfmath to calculate, or if % necessary iteratively approximate, the intersections % of these lines with the exponential curve. % If it is not easy in pgfmath, then I want a Lua-based solution. \end{tikzpicture} \end{document}

  • Problem (warning message) with Calculator package
    by ViToni on February 27, 2026 at 4:03 pm

    This rather small document \documentclass{article} \usepackage{calculator} \newcommand{\myPerCent}[2]{% \DIVIDE{#1}{#2}{\sol}% \MULTIPLY{\sol}{100}{\sol}% \ROUND{\sol}{\sol}% \sol% } \begin{document} Computed \myPerCent{2441}{8667}.\par \end{document} produces this warning (I guess it's a warning and not an error as the PDF is finally built): (\end occurred when \ifdim on line 13 was incomplete) I have no clue how to solve the issue as the code looks ok at first glance, but it seems something is off here. How can I use the package in a proper way? (I'm quite happy I was able to identify the source for the warnings at least as the original document is rather large and I started looking into things like How to diagnose unclosed (incomplete) \iftrue or \ifnum? but somehow I didn't get me anywhere and I don't seem to know anything more than before...)