Week
- Help trying to customise toc with tagging supportby David Purton on January 24, 2026 at 12:25 pm
I'm trying to customise the TOC using built in commands to allow for tagging support, but I'm running in to some behaviour I can't figure out. In the following MWE, the I set \contentsline@text@2@format to \emph and the the line is formatted as expected. But if I set it to \MakeUppercase the label structure breaks (in this case notice the missing space after the subsection number). Am I doing this wrong? I'm struggling to trace the code through to find out why this happens. %! TeX Program = lualatex \DocumentMetadata{ lang=en, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on } \documentclass{article} \ExplSyntaxOn \cs_set_nopar:cpn { contentsline@text@2@format } { \emph % Fails with \MakeUppercase } \ExplSyntaxOff \begin{document} \tableofcontents \subsection{A section heading} \end{document}
- A new kind of ligature, connected d/pby ivo Welch on January 24, 2026 at 3:58 am
I have been trying to coerce Claude to help me, but it is hilariously bad. I am trying to create a new character that looks like d <space> p, where the <space> becomes a connector. The font is charter, math, which I can pull off from newtxmath or mathdesign, which means the input is modestly slanted. \documentclass[12pt]{standalone} \usepackage{XCharter} \usepackage[charter,vvarbb]{newtxmath} \usepackage{amsmath} \begin{document} \fontsize{200}{172}\selectfont \ensuremath{d \kern22pt p} \end{document} I have blown this up here, but I shall need it in my normal font lateron. The result is supposed to look somewhat like: Obviously, one can do quite a bit better than me and my pen, especially, but not only at the lower left corner of my new connector. I will use this, in standard font size, a few hundred times in my document. Is it easy to create such a character? What program should I use? A low learning curve is a lot more important than versatility for further designs in the future. Once I have the character, how do I best use it in my document? Should I try to create its own one-character font, or just create a few PNG files at the right sizes that a \dp\ macro then inserts?
- Can I add a symbol to indicate that a footnote has been split across pages?by Draconis on January 23, 2026 at 9:05 pm
My university's thesis formatting guidelines are extremely stringent about margins, which means when a footnote gets split across pages (because the \footnotemark is on the bottom line of the page, so including the entire footnote would push the mark onto the next page), there's not much I can do to fix it. I can't, for example, expand the text box slightly, or insert some additional whitespace at the bottom. Proofreaders have found this confusing. So with the better typographical solutions being off-limits, I would like to at least indicate to the reader that the footnote continues on the next page. Is it possible to indicate some sort of symbol, such as a rightward-pointing arrow, at the point where a footnote has been split across pages, to indicate that it's continued elsewhere? I know some periodicals do this when an article is split across pages. MWE adapted from here: \documentclass[oneside]{book} \usepackage{lipsum} \usepackage[splitrule]{footmisc} \begin{document} \lipsum[1-3] \lipsum[1] New paragraph, which is really long, so long in fact that it spans more than one line. New paragraph, which is really long, so long in fact that it spans more than one line. \footnote{Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour.} % \lipsum \end{document} Current result: What I would like: some kind of symbol (perhaps a ➤?) at the end of the first page, showing that the footnote continues elsewhere and isn't just broken off. \usepackage[splitrule]{footmisc} indicates on the next page that there's a continuation, but I would like a marker on the first page as well. This question, this question, and this question ask the same thing, but none of them includes a MWE; I'm hoping that providing one will help find an answer.
- How to position TikZ shapes directly centered under text labels in a table-like layout?by Oregon Math Tutor on January 23, 2026 at 7:13 pm
I'm creating a geometry reference sheet with a table-like layout using TikZ. I need: the shape label horizontally centered in the cell each figure centered beneath the label As the image shows, I can't achieve this alignment. This image shows my desired output: This image (partial screen shot) shows what the current code renders: Current approach: Using \node for labels positioned with anchor=east Drawing shapes inside \begin{scope}[shift={...}] blocks Each row has a label on the left, shape in the middle-left, and properties on the right Thanks very much for taking time to assist me! mwe: \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{amssymb} \usetikzlibrary{calc, shapes.geometric, arrows.meta, decorations.markings} % Use Helvetica (similar to Arial) for a clean look since custom fonts caused errors \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} % Define colors to match the original image \definecolor{colSquare}{RGB}{156, 188, 156} % Muted Green \definecolor{colRect}{RGB}{128, 128, 128} % Greyish \definecolor{colPara}{RGB}{255, 105, 120} % Pink/Red \definecolor{colRhom}{RGB}{190, 140, 190} % Purple \definecolor{colKite}{RGB}{180, 230, 200} % Mint Green \definecolor{colTrap}{RGB}{245, 170, 60} % Orange \definecolor{colText}{RGB}{128, 0, 128} % Purple text for headers \definecolor{colLine}{RGB}{70, 130, 180} % Blue grid lines \begin{document} \begin{tikzpicture}[ thick, % Style for shape outlines myshape/.style={draw=black, line width=1pt}, % Custom tick marks for sides tick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-2.5pt,-2.5pt) -- (2.5pt,2.5pt);}}}}, dtick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-1.5pt,-2.5pt) -- (2.5pt,2.5pt) (-4.5pt,-2.5pt) -- (-0.5pt,2.5pt);}}}}, % Custom arrows for parallel lines parrow/.style={postaction={decorate, decoration={markings, mark=at position 0.55 with {\arrow[scale=1.5,black]{>}}}}} ] % --- Grid Layout --- % Horizontal lines \draw[colLine] (-4, 1.5) -- (12, 1.5); \draw[colLine] (-4, 0) -- (12, 0); \draw[colLine] (-4, -4) -- (12, -4); \draw[colLine] (-4, -8) -- (12, -8); \draw[colLine] (-4, -12) -- (12, -12); \draw[colLine] (-4, -16) -- (12, -16); \draw[colLine] (-4, -20) -- (12, -20); \draw[colLine] (-4, -24) -- (12, -24); % Vertical separator \draw[colLine] (3.5, 1.5) -- (3.5, -24); % Headers \node[text=colText, scale=2] at (-0.25, 0.75) {Shape}; \node[text=colText, scale=2] at (7.75, 0.75) {Properties}; % --- Row 1: Square --- \begin{scope}[shift={(0,-2)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Square}; \coordinate (S1) at (2.5, -1.2); \coordinate (S2) at (4.9, -1.2); \coordinate (S3) at (4.9, 1.2); \coordinate (S4) at (2.5, 1.2); \fill[colSquare] (S1) -- (S2) -- (S3) -- (S4) -- cycle; % Ticks drawn manually to ensure rotation alignment looks just like the image \draw[myshape] (S1) -- (S2) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S2) -- (S3) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S3) -- (S4) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S4) -- (S1) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (S1) -- (S3); \draw (S2) -- (S4); % Right angle at center \draw (3.7,0) ++(0.2,0.2) -- ++(-0.2,0.2) -- ++(-0.2,-0.2); % Corner right angles \draw (S1) ++(0.3,0) -- ++(0,0.3) -- ++(-0.3,0); \draw (S2) ++(-0.3,0) -- ++(0,0.3) -- ++(0.3,0); \draw (S3) ++(-0.3,0) -- ++(0,-0.3) -- ++(0.3,0); \draw (S4) ++(0.3,0) -- ++(0,-0.3) -- ++(-0.3,0); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item All sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect at $90^\circ$. \end{itemize} \end{minipage} }; \end{scope} % --- Row 2: Rectangle --- \begin{scope}[shift={(0,-6)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Rectangle}; \coordinate (R1) at (2.5, -0.9); \coordinate (R2) at (5.0, -0.9); \coordinate (R3) at (5.0, 0.9); \coordinate (R4) at (2.5, 0.9); \fill[colRect] (R1) -- (R2) -- (R3) -- (R4) -- cycle; % Sides ticks \draw[myshape] (R1) -- (R2) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R2) -- (R3) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (R3) -- (R4) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R4) -- (R1) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (R1) -- (R3); \draw (R2) -- (R4); % Corners \draw (R1) ++(0.2,0) -- ++(0,0.2) -- ++(-0.2,0); \draw (R2) ++(-0.2,0) -- ++(0,0.2) -- ++(0.2,0); \draw (R3) ++(-0.2,0) -- ++(0,-0.2) -- ++(0.2,0); \draw (R4) ++(0.2,0) -- ++(0,-0.2) -- ++(-0.2,0); % Diagonal marks (triple tick) % Manually drawing triple ticks on diagonals \draw[line width=0.8pt] (3.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.4, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.1, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.3, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.4, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.1, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.3, -0.1) -- ++(0.1,-0.2); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item Opposite sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect each other. \end{itemize} \end{minipage} }; \end{scope} \end{tikzpicture} \end{document}
- circuitikz: 'muxdemux' with exact same dimensions as an 'european resistor (inductor)'by cis on January 23, 2026 at 3:01 pm
Just out of interesst, I asked myself how to configure a muxdemux such that it has the exact same dimensions as an european resistor (european inductor), but with three muxdemux-pins on the underside. (Note: The exact target image is attached.) Here is my approach: \documentclass[border=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors, IPP/.style={muxdemux, muxdemux def={Lh=0.8, Rh=0.8, NL=1, NR=1, NB=3, NT=0, w=2}, %muxdemux label={B2=abc, BL1=1, BL2=2, BL3=3,}, %external pins width=0.4, circuitikz/muxdemuxes/fill=gray!25, }, ] \node [IPP, align=center](A) at (0,0) {}; \draw[] (-1,0.5) to[R, fill=gray!25] +(2,0); \end{circuitikz} \end{document}
- Raise integral signs with limitsby Knudsen on January 23, 2026 at 2:14 pm
Is there a way to raise an integral sign slightly and bring the limits together with it? For example, in \documentclass{report} \begin{document} \[ \int_0^1 \sqrt{a+b\sqrt{a+b\sqrt{a+b\sqrt{x}}}} dx \] \end{document} the integral can benefit from being enlarged and moved up a small bit, even if it going to take it out of alignment with part of the formula.
- TikZ Feynman W loop with Z radiationby Beth Long on January 23, 2026 at 12:55 pm
I want to make the following diagram: But this: \documentclass[a4paper,12pt]{article} \usepackage[compat=1.1.0]{tikz-feynman} \usepackage{xcolor} \definecolor{uctgreen}{rgb}{0,0.45,0} \newcommand\uct[0]{{\color{uctgreen}{u}\color{red}{c}\color{blue}{t}}} \tikzfeynmanset{ every diagram={very thick}, } \begin{document} \resizebox{5cm}{5cm}{ \begin{tikzpicture}[yscale=0.7, xscale=1.4] \begin{feynman} % ~~~ defining the vertices ~~~~~~ \vertex (i1) ; \vertex[below right=of i1] (v1); \vertex[ right=of v1] (v2); \vertex[above right=of v2] (o1); % ~~~ Z-related ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \vertex at ($(v1)!.5!(v2) - (0,15mm)$) (v3); % middle, below \vertex[below=1cm of v3] (v4); % <<< Z "length" % ~~~ lower part ~~~~~~~~~~~~~~ \vertex[below left = 2cm of v4] (i2); % one way to modify \vertex[below right= 2cm of v4] (o2); % ~~~ drawing this diagram ~~~~~~~~~~~~~~~~~~~~~ \diagram*{ {[edges={fermion}](i1) --[edge label=s] (v1) --[edge label=\uct] (v2) --[edge label=d] (o1)}, (v1) --[photon, half right, edge label'=W] (v2), (v3) --[photon, edge label'=Z] (v4), {[edges={fermion}](i2) --[edge label'=$\nu$] (v4) --[edge label'=$\nu$] (o2)}, }; \end{feynman} \end{tikzpicture} } \end{document} produces this: How can I add labels to both sides of the W and make the W-Z vertex match up?
- Is it possible simplify this lualatex code?by xcn on January 23, 2026 at 8:39 am
The following code is used to retrieve and round a variable defined via \directlua. Is it possible to remove the luaround function and replace {\IfValueTF{#1} {luaround(#2, #1)} {#2}} with something like {\IfValueTF{#1} {("%." .. #1 .. "f"):format(#2)} {#2}}? \documentclass[12pt]{article} \usepackage{luacode} \begin{luacode*} function luaround(x, n) return string.format('%.' .. n .. 'f', x ) end \end{luacode*} \NewExpandableDocumentCommand{\usevar}{om}{% \directlua{tex.sprint(% {\IfValueTF{#1} {luaround(#2, #1)} {#2} } % IfValueTF )} } \begin{document} \directlua{ x=0.345 y=2 } \usevar[2]{x} \end{document}
- hyperref + algorithm2e + zref-clever = 🐛: referencing an algorithm and a line in it produces the same type name for both 😢by Mark McGregor on January 22, 2026 at 7:11 pm
We try to reference a line in a shy algorithm and the algorithm itself with zref-clever. Running pdflatex twice on \documentclass{article} \pagestyle{empty} \usepackage{hyperref} \usepackage{algorithm2e} \usepackage{zref-clever} \zcRefTypeSetup{algocf}{ name-sg=Alg.\@, Name-sg=Alg.\@ } \zcRefTypeSetup{AlgoLine}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{algocfline}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{line}{ Name-sg=line, name-sg=line } \begin{document} \begin{algorithm}\LinesNumbered \caption{My great algorithm}\label{algLabel} \KwOut{The oh so great output of my great algorithm} command1\; command2\nllabel{lineLabel}\; command3 \end{algorithm} \zcref[S]{algLabel} contains \zcref{lineLabel}. \end{document} yields As we see, the second type name is “Alg.”, whereas we'd expect “line”. If we comment out hyperref, we get “Alg. 1 contains line 2.” as expected. So far we failed to get different type names for the two references in the presence of hyperref, so you can blame it. At the same time, given that algorithm2e has been unmaintained for about 8½ years and zref-clever for slightly over 1 year, you can blame them, too. Anyway, what is the technical root cause of the failure? Any bugfix, patch, or workaround?
- Unexpected tabular vertical alignmentby itobito on January 22, 2026 at 4:52 pm
I'm having a difficult time understanding the vertical alignment of columns of tables created via tabular. My Code \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{ | p{2.5cm} | m{2.5cm}| b{2.5cm} | } \hline cell1 dummy text dummy text dummy text& cell2 & cell3 \\ \hline cell4 & cell5 dummy text dummy text dummy text & cell6 \\ \hline cell7 & cell8 & cell9 dummy text dummy text dummy text\\ \hline \end{tabular} \end{document} This example is pretty much taken directly from the Overleaf Tables documentation, with the difference being the varying column alignments. I'd expect the code above to produce Expected table with the text in the first column top-aligned, the text in the second column middle-aligned, and the text in the third column bottom-aligned. However, the code above actually produces Actual table I know it's possible (and easier) with the tabularray package, but I'd like to understand why. Why do my actual table's columns have seemingly incorrect vertical alignments?
- When lemmas share the same counter as theorems, how to print “Lemma” in references produced by zcref-clever?by Mark McGregor on January 22, 2026 at 9:35 am
When cleveref died, we switched to zref-clever, but its \zcref refers to lemmas as theorems when we use the same counter. Namely, running pdflatex on \documentclass{article} \pagestyle{empty} \usepackage{zref-clever} \newtheorem{thm}{Theorem}[section] \newtheorem{lem}[thm]{Lemma} \zcRefTypeSetup{lem}{ name-sg=Lem. } \zcRefTypeSetup{thm}{ name-sg=Thm. } \begin{document} \section{My great section} \begin{lem}\label{lem}My great lemma.\end{lem} \begin{thm}\label{thm}My great theorem.\end{thm} According to \zcref{lem} \ldots \end{document} produces “According to Thm. 1.1 ...”: Above, we expected According to Lem. 1.1 ... though. Who is the culprit and what to do?
- Plotting a rational function in tikzby mf67 on January 21, 2026 at 9:17 pm
I'm trying to plot a rational function, but I constantly get dimensions too large, even if the plot frame is within the page and the function is within limits. \documentclass{book} \usepackage{pgf,tikz,pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{tikzpicture}[declare function={r(\x)=(-\x*\x*\x*\x+600*\x*\x*\x-135000*\x*\x+10125000*\x)/(2109375*(30000-200*\x));}] \begin{axis}[ x=0.05cm,y=1cm, xmin=0, xmax=160, ymin=0, ymax=1, xlabel={\(x\)}, ylabel={\(y\)} ] \draw[domain=0:160,smooth,samples=100] plot ({\x},{r(\x)}); \end{axis} \end{tikzpicture} \end{document} What could be wrong? TIA. This is how the graph looks in Mathematica
- How do I apply some quality control for l3keys and multichoices?by lukascbossert on January 21, 2026 at 3:24 pm
In my keys I have two "special" keys, gender and period. While gender must only have one value of m,f,d, the key period can have any of 1,2,3 (also 1,3 or 2,3 is possible). The order of number doesn’t matter. But it is important that it is one of those numbers, nothing else (besides the ,). For gender I was able to set up such a quality control measure: gender .choices:nn = { m , f , d } {\DTLnewdbentry{person}{gender}{#1}}, gender / unknown .code:n = {\msg_warning:nnnn { person } { invalid-value }{ #1 }{ m,f,d }}, but my attempt to use multichoices:nn fails: period .multichoices:nn = {1,2,3} { \clist_put_right:Nn \l_dfg_person_period_clist { #1 }}, \documentclass{article} \usepackage{datatool} \ExplSyntaxOn \msg_new:nnn { person } { unknown-key } { Key~ '\l_keys_path_str'~ is~ unknown~ and~ being~ ignored.^^J^^J You~passed~the~value~'#1'~ to~ that~ key.^^J Doublecheck~for~spelling~errors.~^^J The~ item~ is~ \msg_line_context: } \msg_new:nnn { person } { invalid-value } { Invalid~value~'#1'~for~key~'\l_keys_path_str'.^^J^^J Allowed~values~are:~'#2'.~^^J The~ item~ is~ \msg_line_context: } \clist_new:N \l_dfg_person_period_clist \keys_define:nn { person } { unknown .code:n = { \msg_warning:nnn { person } { unknown-key } {#1}}, unknown .default:V = \c_novalue_tl, % ---------- id ---------- id .code:n = \DTLnewdbentry{person}{id}{#1}, id .value_required:n = true, % ---------- firstname ---------- firstname .code:n = \DTLnewdbentry{person}{firstname}{#1}, % ---------- lastname ---------- lastname .code:n = \DTLnewdbentry{person}{lastname}{#1}, % ---------- gender ---------- gender .choices:nn = { m , f , d } {\DTLnewdbentry{person}{gender}{#1}}, gender / unknown .code:n = {\msg_warning:nnnn { person } { invalid-value }{ #1 }{ m,f,d }}, gender .value_required:n = true, % ---- period with multiple choices ---- period .initial:n = \clist_clear:N \l_dfg_person_period_clist, period .multichoices:nn = {1,2,3} { \clist_put_right:Nn \l_dfg_person_period_clist { #1 }}, % period / 1 .code:n = { \clist_put_right:Nn \l_dfg_person_period_clist { 1 }}, % period / 2 .code:n = { \clist_put_right:Nn \l_dfg_person_period_clist { 2 }}, % period / 3 .code:n = { \clist_put_right:Nn \l_dfg_person_period_clist { 3 }}, period .code:n = \DTLnewdbentry{person}{period}{ \clist_use:N \l_dfg_person_period_clist}, period / unknown .code:n = {\msg_warning:nnnn { person } { invalid-value }{ #1 }{ 1,2,3 }}, } % ---------------------------------------------------------------- % Interface % ---------------------------------------------------------------- \NewDocumentCommand{\addEntry}{ O{#2} m m } { \DTLifdbexists{#2}{}{ \DTLnewdb{#2} } \DTLnewrow{#2} \keys_set:nn { #1 } { #3 } } \NewDocumentCommand{\getEntry}{o m m O{id}} { \DTLgetvalueforkey{\thevalue}{#3}{#1}{#4}{#2} \DTLifnullorempty{\thevalue}{}{ \thevalue } } \ExplSyntaxOff % ---------------------------------------------------------------- % Test data % ---------------------------------------------------------------- \addEntry{person}{ id = {p1}, firstname = {Alice}, lastname = {Smith}, gender = {m}, period = {1}, } \addEntry{person}{ id = {p2}, firstname = {Bob}, lastname = {Brown}, gender = {m}, period = {2,3}, } % ---------------------------------------------------------------- \begin{document} \section*{Demo of the tiny interface} PI name: \textbf{\getEntry[person]{p1}{lastname}}\\ PI gender: \textbf{\getEntry[person]{p1}{gender}}\\ Periods (p1): \textbf{\getEntry[person]{p1}{period}}\\ Periods (p2): \textbf{\getEntry[person]{p2}{period}} \end{document}
- Defining tabular column with resuming enumerateby user1 on January 21, 2026 at 12:14 pm
I have a follow up question, to this one. I want to define a column type, which creates a resumed enumerated list over several rows. I do not use [series=table,nosep,leftmargin=*,before=\vspace{-0.5\baselineskip}] in the following code. I got the solution using minipage previously from an other problem. But please feel free to change this. \documentclass{article} \usepackage{enumitem} \usepackage{array} \makeatletter \newcolumntype{e}[1]{% >{\minipage[t]{\linewidth}\let\\\tabularnewline \enumerate %TODO does not work: [resume*] \addtolength{\rightskip}{0pt plus 50pt}% for raggedright \setlength{\itemsep}{-\parsep}}% p{#1}% <{\@finalstrut\@arstrutbox\endenumerate\endminipage}} \makeatother \begin{document} text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text \begin{tabular}{|e{5cm}|p{5cm}|} \hline \multicolumn{1}{|p{5cm}|}{Column 1 Heading } & Column 2 Heading \\ \hline \item Item 1 & no items\\ \hline \item Perhaps this text could go on for a while too & no items 2\\ \hline \end{tabular} text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text \end{document}
- Typesetting old Arabic manuscripts (without dots)by imdk4242 on January 21, 2026 at 11:31 am
In the study of old Arabic manuscripts, the letter are commonly written without dots below/above different Arabic letter (b/n/t/tha/dhal/etc.). Is it possible to replicate this old writing using arabluatex package or similar? Sample text to be found here (link, Corpus Coranicum) Update #1: A suitable use it to set in arabluatex (ekdosis) to get TEI xml-compliant editions. Sample code: \documentclass{scrartcl} \usepackage{fontspec} \usepackage[english]{babel} \babelfont{rm}{Old Standard} \usepackage[fullvoc]{arabluatex} \SetArbEasy \begin{document} \txarb{ ٮسم الله الرحمں الرحٮم } \arb[novoc]{bismi llAhi l-ra.hmAni l-ra.hImi} \end{document} Output: (The yaa with/without dots is documented as part of the package) A work around(?) could be (mis)using the \newarbmark{} and define seperat old Arabic letters, e.g. as illustrated for the tanwin here: \newarbmark{Y}{^^^^0649}{} \arb{hud\arbcolor[red]{aN\arbnull{_A}}\arbmark{Y}} \arb[trans]{hud\arbcolor[red]{aN\arbnull{_A}}\arbmark{Y}}
- How to place an extended description of the illustration on the page adjacent to it?by forrest on January 21, 2026 at 10:16 am
I am trying to place a figure (plot) on the right (odd) site and the extended description of this figure on top of left (even) site - the previous one. In other words, I would like to have an option of float placement coexisting with htbp, but rlated to placement on even or odd page, let say l/r. MWE: \documentclass{article} \usepackage{mwe} \begin{document} \blindtext\blindtext \begin{figure}[t] \includegraphics[width=\textwidth,height=.3\textheight]{example-image-a}% \caption{First image description}\label{fig:first} \end{figure} \begin{figure}[p] \includegraphics[width=\textwidth,height=.9\textheight]{example-image-a}% \caption{First image}\label{fig:second} \end{figure} \blindtext\blindtext\blindtext \begin{figure}[t] \includegraphics[width=\textwidth,height=.3\textheight]{example-image-b}% \caption{Second image description}\label{fig:fourth} \end{figure} \begin{figure}[p] \includegraphics[width=\textwidth,height=.9\textheight]{example-image-b}% \caption{Second image}\label{fig:fifth} \end{figure} \blindtext\blindtext\blindtext \end{document} I have found similar questions, but left without answer that can solve my problem: The package afterpage gives no control ability of floats' placement - Placing figure on an even/odd page. Also by execution of @David Carlisle code I have obtained incorrect location of figures - Position two floats on opposing pages. The solution utilizing dpfloat package does not enalbe to place float at the top of the page (together with the document main text on the same page) - How to float until on left (or right) page? I see that the use of afterpage package not only gives not a required result but also changes the order of floats - Placing figure on an even/odd page. The hvfloat package would be useful to me if it had options to place a description at the top of the page, and surrounded by a frame (I am using tcolorbox for this purpose). Demonstration how the afterpage package can not solve the problem: \documentclass{article} \usepackage{afterpage} \usepackage{mwe}% for the example only \begin{document} \blindtext\blindtext\blindtext \blindtext\blindtext\blindtext \afterpage{% \clearpage% flush all other floats \ifodd\value{page} %\else% uncomment this else to get odd/even instead of even/odd \expandafter\afterpage% put it on the next page if this one is odd \fi {% \begin{figure}[t] \includegraphics[width=\textwidth,height=.3\textheight]{example-image-a}% \caption{First image}\label{fig:first} \end{figure} \clearpage \begin{figure}[p] \includegraphics[width=\textwidth,height=.9\textheight]{example-image-b}% \caption{Second image}\label{fig:second} \end{figure} \clearpage }% } \blindtext\blindtext\blindtext \begin{figure}[t] \includegraphics[width=\textwidth,height=.3\textheight]{example-image-c}% \caption{Third image}\label{fig:third} \end{figure} \blindtext\blindtext\blindtext \blindtext\blindtext\blindtext \afterpage{% \clearpage% flush all other floats \ifodd\value{page} %\else% uncomment this else to get odd/even instead of even/odd \expandafter\afterpage% put it on the next page if this one is odd \fi {% \begin{figure}[t] \includegraphics[width=\textwidth,height=.3\textheight]{example-image-a}% \caption{Fourth image}\label{fig:fourth} \end{figure} \clearpage \begin{figure}[p] \includegraphics[width=\textwidth,height=.9\textheight]{example-image-b}% \caption{Fifth image}\label{fig:fifth} \end{figure} \clearpage }% } \blindtext\blindtext\blindtext \end{document}
- tikz, in some cases use of "node contents" doesn't workby Zarko on January 21, 2026 at 9:36 am
I'm curious, why second example in the following MWE doesn't works. Well, I can leave with first example, but anyway ... I'd rather prefer to use the second one. \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, node contents={} }, ] % first example: works fine \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some long one line text] {} (0,2); % second example: gives error "Cannot parse this coordinate." \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] (0,2); \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] {} (0,2); \end{tikzpicture} \end{document} Result of the first example is: Addendum: However, if I move inserting of node after drawing a path: \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, color=blue, node contents={} }, every pin/.add style = {}{blue}, ] \draw[Jvmes=4mm/red] (0,0) -- (0,2) node [Npin=4mm/left:some text, pos=0.5]; \end{tikzpicture} \end{document} than it works as expected: I hope that Henri Menke will extend his comment (which help me understand what is going on at my examples) to an answer.
- How to change color of equals sign without disturbing alignment?by Arya1050 on January 21, 2026 at 8:42 am
\documentclass{beamer} \begin{document} \begin{frame} \begin{align*} A &= B \\ &\textcolor{blue}{=} C \end{align*} \end{frame} \end{document} I want the last equals sign to be colored blue, but this code disrupts the alignment. It also brings the 'C' closer to the equals sign. How can I fix this? ChatGPT turned out to be of no help. Note: I don't have any particular purpose for doing this. I was just experimenting out of curiosity on my actual slides. Just wanted to see if this problem could be solved in any case.
- alignment of diagrams in xy-picby Olga on January 20, 2026 at 7:10 pm
I'm learning to draw commutative diagrams using the xy-pic package. I don’t know how to insert pictures on this forum yet, so I’ll write what I got with xymatrix: \documentclass[12pt,reqno]{report} \usepackage[all,cmtip]{xy} \usepackage[T1]{fontenc} \usepackage[russian]{babel} \begin{document} $$\xymatrix{% Z \ar@{-->}[r]_h \ar `u/8pt[r] `[rr]^{g} [rr] & \displaystyle Y \ar[r]_f & X }$$ $$\xymatrix{% F(Z) \ar[r]_{\alpha} \ar `u/8pt[r] `[rr]^{F(g)} [rr] & \displaystyle F(Y) \ar[r]_{\beta} & F(X) }$$ \end{document} I would like to align both charts in width and and want to turn the ends of the arrows $g$ and $F(g),$ respectively, towards $X$ and $F(X).$ Edit. Here's what I got with your help:
- Drawing a thick arrow with different fill and outline colorsby aaragon on January 20, 2026 at 11:46 am
Drawing this type of arrow turned out to be quite complex. I looked at the macro in this post and modified accordingly so that I get the shape I want. However, that macro only prints a single color arrow and it looks painfully difficult to modify to get what I want. Therefore, I thought that I would "emulate" the result by printing two superposed arrows, an original one and one scaled slightly so as to mimic that I have a different border color. This is what I have so far: \documentclass{standalone} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{calc, arrows.meta, bending} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \makeatletter \tikzset{ ararrow/.default={open}{open}, ararrow/.code 2 args={% \tikz@addoption{% \pgfset{tips=true}% draw tips even if the path isn't. \pgfgetpath\currentpath \pgfprocessround{\currentpath}{\currentpath}% \pgf@decorate@parsesoftpath{\currentpath}{\currentpath}% \pgfsetarrowsstart{% Triangle[bend, length=1.*(\pgf@decorate@totalpathlength), width =0.08*(\pgf@decorate@totalpathlength), % <-- added line join=round,#1] } \pgfsetarrowsend{% Stealth[ angle'=60, length=0.22*(\pgf@decorate@totalpathlength), width =0.26*(\pgf@decorate@totalpathlength), line join=round,#2]}% \tikz@mode@drawfalse % disable drawing of path } }, ararrow **/.style={ararrow={}{}}, ararrow oo/.style={ararrow={open}{open}}, ararrow *o/.style={ararrow={}{open}}, ararrow o*/.style={ararrow={open}{}}, } \makeatother \begin{document} \begin{tikzpicture} \coordinate (P) at (0,0); \coordinate (Q) at (1,1); \coordinate (C) at ($(P)!0.5!(Q)$); % outer arrow \draw[blue, ararrow **] (P) to[bend left=45] (Q); % inner arrow: same curve, scaled about C \begin{scope}[ shift={(C)}, scale=0.9, shift={($-1*(C)$)} ] \draw[yellow, ararrow **] (P) to[bend left=45] (Q); \end{scope} \end{tikzpicture} \end{document} which produces the image you see. Ideally, it would be great if the macro can be modified to get what I need so the user can simply type: \draw[draw=blue, fill=yellow, ararrow **] (P) to[bend left=45] (Q);
- Automatically reserve space at bottom of second column on first page in twocolumn articleby Srikanth Mohankumar on January 20, 2026 at 9:33 am
I need to automatically reserve empty space at the bottom of the second column on the first page only in a two-column article. This space will be used later for stamping a thumbnail image during PDF post-processing. Requirements: Only affect the first page, second column Reserve approximately 100pt of blank space at the bottom of the column The text in the second column should be shorter to leave this space empty First column should remain at normal height Should be automatic (no manual commands in document body) Must work with LuaLaTeX (TeX Live 2025) I've tried various approaches with @opcol and @outputdblcol but they either create space at the top instead of bottom, or affect all pages instead of just the first page. \documentclass[twocolumn]{article} \usepackage{lipsum} \makeatletter % Need solution here to reserve 100pt at bottom of second column on page 1 \makeatother \begin{document} \title{Sample Document} \author{Author Name} \maketitle \lipsum[1-20] \end{document} Expected result: The second column on page 1 should have normal text at the top, but stop 100pt before the bottom, leaving that space blank for later thumbnail insertion. What I've tried:I attempted using \afterpage with \footnotetext to create the reserved space: \afterpage{\footnotetext{\fbox{\vbox to 100pt{second column reserved space}}}} This works well for short paragraphs, but fails when long paragraphs continue onto the second page - the reserved space appears on the wrong page. I've also tried various approaches with @opcol and @outputdblcol hooks, but they either create space at the top instead of bottom, or affect all pages instead of just the first page. MWE: \documentclass[fleqn,twocolumn]{article} \usepackage{lipsum} \usepackage{afterpage} \makeatletter % Need solution here to reserve 100pt at bottom of second column on page 1 \makeatother \title{Sample} \author{John Doe} \begin{document} \maketitle % This approach fails with long paragraphs \afterpage{\footnotetext{\fbox{\vbox to 100pt{second column reserved space}}}} \begin{abstract} \lipsum[2] \end{abstract} \section{Introduction} Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. \footnote{Number test.} \end{document}
- Define a font by file rather than by name?by Gary on January 18, 2026 at 10:13 pm
I'm trying to follow pages 51-52 of the book Fonts out of ConTeXt to define a font by file: rather than name:; but I must be overlooking something. The path to the font file is /home/gary/programs/context/context-linux-64/tex/texmf/fonts/data/gust/tex-gyre/termes/texgyretermes-regular.otf By-name works as: \definefont[Times][name:texgyretermesregular*default at 11pt][line=2.8ex] But by-file does not load. \definefont[Times][file:texgyretermes-regular.otf*default at 11pt][line=2.8ex] I did not see an error in the CLI output but the font remains the body font when declared as \Times in an environment within the body. All I did was toggle between commenting the \definefont lines and did not change the body at all. One time the font loads, the other it does not. Thank you. Below is the result of mtxrun --script font --list --all termes and you have to scroll right to see the filename column. I guess I didn't read far enough to the next section that reads The first two columns mention the names that we can use to access a font. This explains why using only texgyretermes loads bold. But I do not understand the meaning of file versus name. identifier familyname fontname filename subfont instances texgyretermesbold texgyretermes texgyretermesbold texgyretermes-bold.otf texgyretermesbolditalic texgyretermes texgyretermesbolditalic texgyretermes-bolditalic.otf texgyretermesitalic texgyretermes texgyretermesitalic texgyretermes-italic.otf texgyretermesmath texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesmathcompanion texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathcompanionnormal texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathcompanionregular texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathnormal texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesmathregular texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesnormal texgyretermes texgyretermesitalic texgyretermes-italic.otf texgyretermesregular texgyretermes texgyretermesregular texgyretermes-regular.otf
- Is there a "hook" to expand a macro after the end of a path in TikZ?by Rmano on January 18, 2026 at 7:33 pm
I am adding a new feature to circuitikz to simplify the usage of "user-defined" voltages (and currents and "flow"s). The question is not specific to circuitikz, although the MWE is — sorry for the complication. If I manage a smaller MWE I'll post here. The basic question is: when a TikZ \path command is processed (and a \draw, etc., which are basically the same), is it possible to add a hook to be expanded at the end of it? I mean, after the final ; is found. In the following MWE, I would like to add some code to the addcall key so that I do not need to add the final \DoAdvVoltages. Ideally, the macro should be called after each path is finished, but calling it before the end of the environment would be acceptable. In order of preference, the solution should: call \DoAdvVoltages at every end of the path, when in the path the to[..., addcall=...] is used; if that's not possible, call \DoAdvVoltages at the end of the tikzpicture, in every tikzpicture where at least one path used the addcall key; if that's not possible, call the \DoAdvVolteges at the end of every tikzpicture. The solution should be engine-independent (well, it should work in the engines supported by TikZ, basically LaTeX and ConTeXt). Option 3 is easy in LaTeX, I do not know if it's as easy in ConTeXt. Option 2 could be achievable in LaTeX: add a one-shot hook at env/tikzpicture/end the first time it's called, protected by an if, from the .code itself — I'm not sure if this is a use-case possible in the current hook code, I'll dig into it when I have time, but it would be an acceptable answer (Is \AddToHookNext what I'm looking for here?). \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[RPvoltages]{circuitikz} % just an example \ctikzset{voltage=raised, !v sym/.style={no v symbols}} \newcommand{\placesigns}[2]{% place the +- signs at a fixed distance \path (#1voltage.center) ++(-\ctikzgetdirection{#1}:0.5cm) node[]{$+$}; \path (#1voltage.center) ++(180-\ctikzgetdirection{#1}:0.5cm) node[]{$-$}; } % add a command queue to circuitikz \makeatletter \gdef\local@voltages{} \def\addcommand#1#2{%add to \commands the macro \#1{nodename}{#2} \begingroup \edef\@@name{\ctikzvalof{bipole/name}} \edef\@@temp{% \noexpand\pgfutil@g@addto@macro\noexpand\local@voltages{% \expandafter\noexpand\csname #1\endcsname {\@@name}{#2}% }% }% \@@temp \endgroup } \def\DoAdvVoltages{\local@voltages\relax\gdef\local@voltages{}\ctikz@hook@setfalse} \makeatother % This works, but just for LaTeX (or not?) % Moreover, I'd like to add this from the addcall keys, so that % I don't call it for *every* tikzpicture! % \AddToHook{env/tikzpicture/end}{\DoAdvVoltages} \ctikzset{addmyv/.style = {v={#1}, !v sym, addcall={#1}}} \ctikzset{addcall/.code ={\addcommand{placesigns}{#1}}} \begin{document} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \DoAdvVoltages \end{tikzpicture} \end{document} A partial solution (the option 2 above) could be something like this, that seems to work: \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[RPvoltages]{circuitikz} % just an example \ctikzset{voltage=raised, !v sym/.style={no v symbols}} \newcommand{\placesigns}[2]{% place the +- signs at a fixed distance \path (#1voltage.center) ++(-\ctikzgetdirection{#1}:0.5cm) node[]{$+$}; \path (#1voltage.center) ++(180-\ctikzgetdirection{#1}:0.5cm) node[]{$-$}; } % add a command queue to circuitikz \makeatletter \newif\ifctikz@hook@set\ctikz@hook@setfalse \gdef\local@voltages{} \def\addcommand#1#2{%add to \commands the macro \#1{nodename}{#2} \begingroup \edef\@@name{\ctikzvalof{bipole/name}} \edef\@@temp{% \noexpand\pgfutil@g@addto@macro\noexpand\local@voltages{% \expandafter\noexpand\csname #1\endcsname {\@@name}{#2}% }% }% \@@temp \endgroup } \def\DoAdvVoltages{\local@voltages\relax\gdef\local@voltages{}% \typeout{EXECUTE DoAdv} \global\ctikz@hook@setfalse } \def\ctikz@set@hook{% \ifctikz@hook@set \else \global\ctikz@hook@settrue % I have no idea if I can do this in context/plain... \ifpgfutil@format@is@latex \typeout{EXECUTE AddToHookNext} \AddToHookNext{env/tikzpicture/end}{\DoAdvVoltages}% \fi \fi } \ctikzset{addcall/.code ={\addcommand{placesigns}{#1}\ctikz@set@hook}} \makeatother % This works, but just for LaTeX (or not?) % \AddToHook{env/tikzpicture/end}{\DoAdvVoltages} \ctikzset{addmyv/.style = {v={#1}, !v sym, addcall={#1}}} \begin{document} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \end{tikzpicture} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \end{tikzpicture} \end{document} But clearly, this is not valid (I think) for ConTeXt at all.
- "Not in outer par mode" errors on intermediate compilations that resolve on later passesby RLH on January 18, 2026 at 7:07 pm
I have a long document (600+ pages) that has been using \clearpage and \afterpage to force some page breaks and figure placement, and breakable tcolorboxes as example environments. This document occasionally gets into states where a fresh compile of the document completes without errors, the second compilation fails with ! LaTeX Error: Not in outer par mode. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.128 \clearpage and the third and subsequent compilations succeed. Based on comments on my closed question \clearpage causes "not in outer par mode error" on second pass, I've found ways to reduce the use of \afterpage and to use non-float objects that otherwise behave like figures when I do need \afterpage, and have also tracked down my specific problem to an interaction between Floats in afterpage. Special footnote handling that uses shipout to move the footnote outside of the box. The presence of a long table of contents. (see demonstration code below) -- While I now understand more about what source-code patterns can produce these errors, I would stil like to better understand how the processing of the document leads to the specific error behavior. The error message (and other documentation of when the error is expected to appear) seems to indicate that the compiler is reading a \clearpage command at a point in the document which some internal state variable registers as being inside of a float. Combined with this error appearing on the second pass (when the TOC moves pages around) and its absence if the \tableofcontents call is removed, a parsimonious interpretation would be that either the location of the page breaks forced by \clearpage or the page numbers on which the floats appear are being retained from the previous pass, and so are triggering the error, even though \clearpage command does not appear inside float environment in the source code. Once the page locations have stabilized, the error goes away. Comments on my previous question suggested that this is not the correct model for how the error plays out at compilation time. What is a better way to understand the behavior of these kinds of errors that show up on intermediate compilations, but go away if I compile enough times? -- Code for generating the kind of errors that I'm encountering. This document should compile successfully on the first pass, error three times on the second and third passes, and then compile correctly on subsequent passes. \documentclass[11pt]{book} \usepackage{afterpage} \usepackage[many]{tcolorbox} \tcbuselibrary{magazine} % Not directly relevant here, but gets me a foreach function for the examples %%%%%%%% %%%%%%%% % Code for typesetting footnotes from tcolorboxes outside of the box, and in the main footnote sequence \newif\iffootaux \newcounter{footaux}% for \csname \newcounter{auxpage}% to handle frontmatter etc. \setcounter{auxpage}{1} \makeatletter \def\footnoteaux{\@ifnextchar[\@xfootnoteaux{\stepcounter{footnote}% \footnotemark[\thefootnote]\@footaux[\thefootnote]}} \def\@xfootnoteaux[#1]{\footnotemark[#1]\@footaux[#1]} \def\footaux{\@ifnextchar[\@footaux{\@footaux[\thefootnote]}} \def\@footaux[#1]#2{\protected@write{\@auxout}{\let\theauxpage\relax}{\string\newfootnote{\theauxpage}{#1}{#2}}} \newcommand{\newfootnote}[3]{% #1 = \theauxpage, #2 = \thefoontnote, #3 = text \ifnum#1=1\relax \footnotetext[#2]{#3}% \else \stepcounter{footaux}% \expandafter\xdef\csname footauxpage\thefootaux\endcsname{#1}% \expandafter\xdef\csname footauxnumber\thefootaux\endcsname{#2}% \expandafter\protected@xdef\csname footauxtext\thefootaux\endcsname{#3}% \fi} % to run at the end of every page (debug version) \newcommand{\addfootaux}{\loop \@ifundefined{footauxpage\thefootaux}{\footauxfalse}{% \count1=\csname footauxpage\thefootaux\endcsname\relax \advance\count1 by -1 \ifnum\count1=\value{auxpage}% \expandafter\let\expandafter\footauxnumber\csname footauxnumber\thefootaux\endcsname \expandafter\let\expandafter\footauxtext\csname footauxtext\thefootaux\endcsname \footnotetext[\footauxnumber]{\footauxtext}% \footauxtrue \else \footauxfalse \fi} \iffootaux \global\expandafter\let\csname footauxpage\thefootaux\endcsname\relax \global\expandafter\let\csname footauxnumber\thefootaux\endcsname\relax \global\expandafter\let\csname footauxtext\thefootaux\endcsname\relax \stepcounter{footaux}% \repeat \stepcounter{auxpage}} \makeatother \AtBeginDocument{\setcounter{footaux}{1}}% reset counter after \newfootnote \AddToHook{shipout/after}{\addfootaux} %%%%%%%% %%%%%%%% \newtcbtheorem[number within=section, number freestyle={\noexpand\thesection.\noexpand\arabic{\tcbcounter}}]{example}{Example}{ detach title, before upper={\tcbtitle.\quad \let\footnotetext=\footaux \let\footnote=\footnoteaux }, enhanced jigsaw, sharp corners, frame hidden, lines before break=4, borderline west={.5pt}{3pt}{black}, right=0pt, toprule=0pt, rightrule=0pt, bottomrule=0pt, leftrule=.5pt, colback=white, colframe=black, breakable=true, opacityback=0, colbacktitle=white, opacitybacktitle=0, coltitle=black, titlerule=0pt, fonttitle=\bfseries, parbox=false, label type=example, }{exp} % Demonstration text \usepackage{lipsum} % Credit to musarithmia for Sator square % https://tex.stackexchange.com/a/208857 % Retrieved 2026-01-17, License - CC BY-SA 3.0 \newcommand{\satorsquare}{ {\huge\bfseries%\hfil% \begin{tabular}{|c|c|c|c|c|} \hline S & A & T & O & R\\ \hline A & R & E & P & O\\ \hline T & E & N & E & T\\ \hline O & P & E & R & A\\ \hline R & O & T & A & S\\ \hline \end{tabular}}} \begin{document} \title{Afterpage hammering to cause crash} \maketitle \tableofcontents % Generate enough text that the table of contents moves things across pages \foreach \n in {1,...,35} { \section{C} \lipsum[\n]%\footnote{This is a footnote from outside an example} } % Generate progressively longer examples with afterpaged figures \foreach \n in {1,...,3} { \typeout{On Example \n} % Put a float into an afterpage \afterpage{ \begin{figure} {\centering \satorsquare{} \caption{figure}{This is a Sator square} \label{fig:onesatorsquare\n} } \end{figure} } % Force a clearpage \clearpage % Typeset text in a breakable tcolorbox \begin{example}{Example}{exp\n} \lipsum[1-3] \lipsum[\n-\n+\n] \end{example} } % Generate progressively longer examples with afterpaged figures and footnotes handled with shipout \foreach \n in {1,...,3} { \typeout{On Example 3+\n} % Put a float into an afterpage \afterpage{ \begin{figure} {\centering \satorsquare{} \caption{figure}{This is a Sator square} \label{fig:onesatorsquare\n} } \end{figure}} % Force a clearpage \clearpage % Typeset text in a breakable tcolorbox with a footnote that is placed outside the box \begin{example}{Example}{exp\n} \lipsum[1-3]\footnote{This is a footnote from inside an example} \lipsum[\n-\n+\n] \end{example} } \end{document}
- Reproducing figures with shaded half-planes in a gray square boxby Sebastiano on January 18, 2026 at 4:43 pm
I am trying to reproduce some images from old lecture notes, in particular notes by Prof. Gorni dating back to the 1993/94 academic year (pag. 4), or in other notes, like this picture At that time I had no knowledge of LaTeX at all. I do not know whether those figures were produced using PSTricks or with XFig/WinFig via psfrag, but my goal is to reproduce them in TikZ, correctly coloring the relevant half-planes. I am not completely sure whether it is possible (or appropriate) to modify the domain by introducing a square with a gray background or a path, but I have nevertheless quickly put together a minimal working example. \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{arrows.meta,decorations.markings,backgrounds} \usepackage{geometry} \geometry{margin=2.5cm} \begin{document} \begin{center} \begin{tikzpicture}[scale=1.5] \draw[->] (-0.2,0) -- (2,0) node[right] {$x$}; \draw[->] (0,-0.2) -- (0,2) node[above] {$y$}; \def\a{1.75} \begin{scope}[on background layer] \fill[gray!25] (-\a,\a) -- (\a,\a) -- (\a,-\a) -- (-\a,\a) -- cycle; \end{scope} \draw[thick,white] (-\a,-\a) rectangle (\a,\a); \draw[thick] (-1.5,1.5) -- (1.5,-1.5); \node at (-1.25,0.55) {$y=-x$}; \draw[thick] ({sqrt(2)},0) arc (0:90:{sqrt(2)}); \fill (0,{sqrt(2)}) circle (0.6pt); \fill ({sqrt(2)},0) circle (0.6pt); \node[left] at (0,{sqrt(2)}) {$\left(0,\sqrt{2}\right)$}; \node[below] at ({sqrt(2)},0) {$\left(\sqrt{2},0\right)$}; \end{tikzpicture} \end{center} \end{document} The problems I am facing (also because I have never attempted anything like this before) are the red rectangles (I wonder if there is a simple option to place the arc vector in a central position):
- How to return array from a command?by karu on January 18, 2026 at 10:07 am
How to return an array from a command? or rather How to expand a command to some generated array? The code below generates the correct array into \OutArray inside \Transmogrifier, but I don't know how to return it to calling \ResultArray. I know one option to access the values is to define an empty array, give the array as an argument to the command, have the command generate the elements to that array and access them when the command is finished. This is not what I am looking for. My question is more to expand my understanding and increase the tools I have in my disposal. \documentclass[tikz]{standalone} \begin{document} \newcommand*{\SomeOperation}[2]{% \fpeval{#1*#2}% }% \newcommand*{\Transmogrifier}[2]{% \pgfmathparse{dim(#1)}% or \pgfmathdim{#1}% \edef\ArrayLength{\pgfmathresult}% \xdef\OutArray{{}}% \foreach \i in {0,...,\fpeval{\ArrayLength-1}}% {% \pgfmathparse{array({#1},\i)}% or \pgfmatharray{{#1}}{\i}% \ifnum \i=0% \xdef\OutArray{\SomeOperation{\pgfmathresult}{#2}}% \else% \xdef\OutArray{\OutArray,\SomeOperation{\pgfmathresult}{#2}}% \fi% }% \xdef\OutArray{{\OutArray}}% How to "return" \OutArray? %\typeout{OutArray: \OutArray}% }% \begin{tikzpicture} \def\TestArray{{1,2,3}}% \typeout{TestArray: \TestArray}% \newcommand*{\ResultArray}{% \Transmogrifier{\TestArray}{2}% }% %\ResultArray% Temp for testing \typeout{ResultArray: \ResultArray}% \end{tikzpicture} \end{document} Desired outcome in the log file: TestArray: {1,2,3} ResultArray: {2,4,6}
- Indifference and budget curveby henry on January 18, 2026 at 8:26 am
I have a trouble to draw this diagram, could you guys help me please. This is my code: \begin{frame}{5.2.Child-care subsidy} \vspace{0.1cm} \centering \resizebox{0.95\textwidth}{!}{% \begin{tikzpicture}[scale=0.95, >=Stealth, font=\sffamily] % --- 1. HỆ TRỤC --- \draw[thick] (0,0) -- (0,6.5) node[above] {Income}; \draw[thick] (0,0) -- (6.5,0); \node[below left] at (0,0) {0}; \node[below] at (5.5,0) {$\longleftarrow$ Hours of Paid Work}; \coordinate (a) at (6.0, 0); \coordinate (c) at (6.0, 1.5); \coordinate (b) at (6.0, 3.0); \draw[thin, gray!30] (6.0, 0) -- (6.0, 3.2); \filldraw[black] (a) circle (1.5pt) node[right, font=\scriptsize] {$a$}; \filldraw[black] (c) circle (1.5pt) node[right, font=\scriptsize] {$c$}; \filldraw[black] (b) circle (1.5pt) node[right, font=\scriptsize] {$b$}; % Đường thấp d-c \coordinate (d) at (0, 4.0); \draw[thick, cyan!50] (d) node[left, black, font=\scriptsize] {$d$} -- (c); \coordinate (e) at (0, 5.5); \draw[thick, curveBlue] (e) node[left, black, font=\scriptsize] {$e$} -- (b); \coordinate (X) at (2.4, 3.0); \filldraw[black] (X) circle (2pt) node[below left] {$X$}; \coordinate (Y) at (3.6, 4.0); \filldraw[black] (Y) circle (2pt) node[above right] {$Y$}; \draw[thick, black] (0.6, 5.2) .. controls (1.2, 3.8) and (1.8, 2.9) .. (X) .. controls (3.2, 3.1) and (5.0, 2.5) .. (6.2, 4.0) node[right] {$U_1$}; \draw[thick, black] (1.5, 6.5) .. controls (2.2, 5.0) and (2.8, 3.9) .. (Y) .. controls (4.5, 4.1) and (5.5, 4.2) .. (6.2, 5.8) node[right] {$U_3$}; \draw[thick, black!70] (1.0, 6.0) .. controls (1.8, 4.5) and (2.5, 3.5) .. (3.1, 3.6) .. controls (4.0, 3.7) and (5.2, 3.5) .. (6.2, 5.0) node[right] {$U_2$}; \end{tikzpicture} } This is what i get:
- Any possible method to handle for-loop more smartly in tikz?by Explorer on January 18, 2026 at 7:31 am
I have the following codes to typeset following: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{decorations.pathreplacing} \ExplSyntaxOn \cs_new:Nn \__my_Aterm_tl:n { \tl_set:Nn \l_tmpa_tl { a \sb 1 } \int_step_inline:nnn {2} {#1} { \tl_put_right:Nn \l_tmpa_tl { + a \sb {##1} } } \tl_use:N \l_tmpa_tl } \NewDocumentCommand{\Aterm}{ m }{\__my_Aterm_tl:n{#1}} \ExplSyntaxOff \begin{document} \def\NN{5} \begin{tikzpicture} \foreach \i[evaluate=\i as \nexti using int(\i+1)] in {1,...,\NN}{ \draw (0,{-(\i-1)}) rectangle (\i,-\i); \ifnum\i<\NN\relax \draw[decorate,decoration={brace,amplitude=5pt}] (\i,{-(\i-1)}) -- node[midway,right=3pt] {$b_{\i}-b_{\nexti}$} (\i,-\i); \else \draw[decorate,decoration={brace,amplitude=5pt}] (\i,{-(\i-1)}) -- node[midway,right=3pt] {$b_{\i}$} (\i,-\i); \fi \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (0,{-(\i-1)}) -- node[midway,below=3pt] { % $a_{\i}$ $\Aterm{\i}$ } (\i,{-(\i-1)}); } \end{tikzpicture} \end{document} It works! But the code looks not elegant, for the abrupt \ifnum and expl3-syntex(I have heard from that may cause unexpected result to mix tikz and expl3), is that possible to make good use of evaluate=<variable> as <macro> using <formula> or /remember=<variable> as <macro> (initially <value>)?
- Set xmp description for other languages tooby HerpDerpington on January 18, 2026 at 1:50 am
The xmp description can be set for example using hyperref: \DocumentMetadata{ lang=en-US } \documentclass{article} \usepackage{hyperref} \hypersetup{ pdfsubject={This will end up as the english subject.} } \begin{document} test \end{document} exiftool then reveals: Description : This will end up as the english subject. Description (en-US) : This will end up as the english subject. Language : en-US coming from the XMP block [...] <dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">This will end up as the english subject.</rdf:li> <rdf:li xml:lang="en-US">This will end up as the english subject.</rdf:li> </rdf:Alt> </dc:description> [...] which seems to suggest that the Description may also be set for other languages. How can I for example set the description for something like de-DE?
- LaTeX macro to generate a centered grid of subfigures from a comma list (no gaps, equal widths, auto sublabels 1,2,3…)by taiwan12 on January 17, 2026 at 7:57 pm
I’m trying to define a LaTeX command that creates a figure containing multiple subfigures from a comma-separated list of image names. I’d like a macro with this interface: \multipleIMG{<images per row>}{<comma-separated list of image files>}{<main label>}{<main caption>} Requirements: Use the full available width (\linewidth). No horizontal and vertical gaps between images. Each row should be centered as a whole (even the last row if it’s not full). All images must have the same width (based on <images per row>). Create sublabels automatically as <main label>_1, <main label>_2, … (1, 2, 3, …). I’m using subcaption. I don’t want visible subcaptions, only labels for referencing (\phantomcaption is fine). Example input: \multipleIMG{3}{location-1,location-2,location-3,location-4,location-5}{fig:first}{Five Figure} This should produce 3 images in the first row, then 2 centered images in the second row, all with equal widths, and labels: fig:first_1, fig:first_2, fig:first_3, fig:first_4, fig:first_5 So that I can reference both the main figure and a subfigure like: \ref{fig:first}, \ref{fig:first_1} Here is an MWE showing the layout I want (hard-coded manually for 5 images). I want to replace this manual code with \multipleIMG. \documentclass{report} \usepackage[demo]{graphicx} \usepackage{subcaption} \usepackage[colorlinks=true]{hyperref} \begin{document} \begin{figure}[htbp] \centering \newlength{\imgw} \setlength{\imgw}{\dimexpr\linewidth/3\relax} \makebox[\linewidth][c]{% \begin{subfigure}{\imgw} \includegraphics[width=\linewidth]{} \phantomcaption \label{fig:first_1} \end{subfigure}% \begin{subfigure}{\imgw} \includegraphics[width=\linewidth]{} \phantomcaption \label{fig:first_2} \end{subfigure}% \begin{subfigure}{\imgw} \includegraphics[width=\linewidth]{} \phantomcaption \label{fig:first_3} \end{subfigure}% } \vspace{-\baselineskip} \makebox[\linewidth][c]{% \begin{subfigure}{\imgw} \includegraphics[width=\linewidth]{} \phantomcaption \label{fig:first_4} \end{subfigure}% \begin{subfigure}{\imgw} \includegraphics[width=\linewidth]{} \phantomcaption \label{fig:first_5} \end{subfigure}% } \caption{Five Figure} \label{fig:first} \end{figure} \ref{fig:first}, \ref{fig:first_1} \end{document}