• 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 alignment
    by 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?

  • Keep columns layout in the article version of a beamer presentation
    by Tobard on January 22, 2026 at 9:43 am

    I use the beamerarticle package to generate both presentation frames and article notes. Everything goes well except I lose a lot of space in the article layout because the column formatting is not preserved. Here is my Article.tex file: % Article.tex \documentclass[a4paper]{article} \usepackage{beamerarticle} \input{content} Here is my Presentation.tex file: % Presentation.tex \documentclass[ignorenonframetext]{beamer} \input{content} And here is my content.tex file: % INITIAL content.tex \usepackage{tikz} \begin{document} \begin{frame}%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \frametitle{Test frame with columns}\small \begin{columns} \column<+->[t]{.3\textwidth} This is the content of the first column. \tikz{\draw (0,0) rectangle (3,2)node[midway]{1};} \column<+->[t]{.3\textwidth} This is the content of the second column. \tikz{\draw (0,0) rectangle (3,2)node[midway]{2};} \end{columns} \end{frame}%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> \end{document} And here are the results of both documents : Then I tried to modify the columns environment in the preamble of content.tex, but it works only if I redefine the columns with \begin{columns}{.3\textwidth} and \end{columns} rather than the simple and convenient \column{.3\textwidth} macro: % NEW content.tex \usepackage{tikz} \mode<article>{ \renewenvironment<>{columns}[1][]{}{} \renewenvironment<>{column}[2][]% {\begin{minipage}[t]{#2}}% {\end{minipage}\hfill} } \begin{document} \begin{frame}%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \frametitle{Test frame with columns}\small \begin{columns} % \column<+->[t]{.3\textwidth} \begin{column}<+->[t]{.3\textwidth} This is the content of the first column. \tikz{\draw (0,0) rectangle (3,2)node[midway]{1};} \end{column} % \column<+->[t]{.3\textwidth} \begin{column}<+->[t]{.3\textwidth} This is the content of the second column. \tikz{\draw (0,0) rectangle (3,2)node[midway]{2};} \end{column} \end{columns} \end{frame}%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> \end{document} What are the proper set of commands to use to preserve column behavior in article mode while using the \column{} macro ? Thank you for your help!

  • 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 tikz
    by 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 enumerate
    by 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}}

  • tikz, in some cases use of "node contents" doesn't work
    by 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-pic
    by 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 colors
    by 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 article
    by 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}

  • Missing definition of \smallsetminus with lua-unicode-math
    by murray on January 19, 2026 at 4:42 pm

    With the unicode-math package, this source gives the expected output, as shown: % !TEX program = lualatex \NeedsTeXFormat{LaTeX2e}[2025-11-01] \documentclass{article} \usepackage{mathtools} \usepackage{fontspec, unicode-math} % OK with this %\usepackage{fontspec, lua-unicode-math} % this gives undefined control sequence \setmainfont[Scale=1.0]{TeXGyreTermesX} \setmathfont{STIX Two Math}[Scale=MatchUppercase,math-style=ISO] \begin{document} $A \smallsetminus B$ \end{document} However, if lua-unicode-math is loaded instead of unicode-math, then an "undefined control sequence" error results. How fix this? Added: in unicode-math-luatex.sty, which is called by unicode-math when lualatex is used, the definition is given by: \cs_set_protected:Npn \smallsetminus { \mathbin{ \mathpalette \__um_smallsetminus: \relax} } \cs_set:Npn \__um_smallsetminus: #1 { \rotatebox{135}{ \smash{ \raisebox{-\height}{$#1\minus$} } }}

  • Adding a hyperlink to a tcolorbox title
    by mmjt on January 19, 2026 at 2:44 pm

    With help from stackexchange, I have been able to create attractive colorboxes for the exercise and problem sets in a class mathematical physics tutorial. The exercises have hints. I would like to modify the "Exercise" tcolorbox so that an optional clickable hint icon will appear in the title bar, containing a hyperlink to the hint. I cannot simply make the whole exercise box be the clickable area, because that will mask any links that may be in the Exercise text, such as a reference to a particular equation. I have tried using an overlay, as in my MWE, but the link is not working. In the MWE I have replaced the icon graphic file withe a text "?". The MWE is a bit lengthy (apologies), but I want to show that the other links are working – it is just the hint link that fails. The full document is over 600 pages! \documentclass{book} \usepackage{graphicx} \usepackage{tcolorbox} \tcbuselibrary{most} \usepackage{xparse} \usepackage{hyperref} % A simple hint environment \newcounter{hint} \newenvironment{hint} { \par\refstepcounter{hint}\medskip } { \par\medskip } % Key to store hint label \tcbset{ hint/.store in=\exercise@hintlabel, } % New exercise box, with a clickable hint box within \newtcolorbox[auto counter, number within=chapter]{exercise}[3][]{ #2, #3, enhanced, breakable, colback=white, colframe=blue!25!white, coltitle=black, boxrule=0.8pt, left=6pt, right=6pt, top=6pt, bottom=6pt, fonttitle=\bfseries, title={Exercise~\thetcbcounter\ifx#1\empty\else\ (#1)\fi}, overlay={ \ifx\exercise@hintlabel\empty\relax \else \node[ anchor=north east, xshift=0pt, yshift=0pt ] at (frame.north east) { \hyperlink{\exercise@hintlabel}{ \textbf{?} % \includegraphics[width=12pt]{hint-icon.eps} } }; \fi }, } \begin{document} \mainmatter \chapter{The Tutorial} \begin{equation} E = mc^{2} \label{eq_a} \end{equation} \vspace{10\baselineskip} \begin{exercise}[]{label={ex_1}}{hint={hint_ex_a}} Use Eqn.~\ref{eq_a} to find an expression for $m$. Click ``\textbf{?}'' for a hint. \end{exercise} \newpage {\textbf{Hints to Exercises}} \begin{hint} \label{hint_ex_a} \textbf{Exercise \ref{ex_1}} Try an algebraic manipulation. \end{hint} \end{document} How can I make the hint link work correctly?

  • 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 passes
    by 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}

  • Inconsistent line thickness of \frac and \overline in PDF [closed]
    by The Little Blue Man on January 18, 2026 at 5:11 pm

    My problem Some of the lines in the PDF of my LaTeX document are different thicknesses. This applies to lines generated using the commands frac, \overline and underline (I'm not sure about the latter). Sometimes the thickness is correct, and sometimes it is much too thick. The thickness varies throughout the document and depending on the zoom level. My main issue is that it persists after printing the document. This problem don't affect lines generated by \rule or \hline. Here is an example: Some details I use LuaLaTeX. I use TexLive on Linux. Here are the packages I use: % Mandatory: \usepackage[french]{babel} \usepackage{graphicx} % — Maths — \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{stmaryrd} % - Addition of the mathscr font \usepackage[scr]{rsfso} \usepackage{fontspec} \usepackage{unicode-math} % Misc \usepackage{comment} \usepackage{geometry} \usepackage{titlesec} \usepackage[shortlabels]{enumitem} \usepackage{calc} \usepackage{lipsum} I use Latin Modern Math as my math font. What I have tried I tried several things that did not solve the issue: redefining \frac with \genfrac{}{}{0.4pt}{} I also tried adding the line '\fontdimen3\textfont3=0.4pt' (on the order of ChatGPT). I tried changing the maths font. Code that generate the problem \documentclass[12pt]{article} \title{Test} % --- Mandatory --- \usepackage[french]{babel} % --- Maths --- \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{stmaryrd} \usepackage[scr]{rsfso} \usepackage{fontspec} \usepackage{unicode-math} % ---- Fonts --- \setmathfont{Latin Modern Math} \setmathfont{STIX Two Math}[ % Utilisation de STIX Two uniquement pour mathbb range=bb, Scale=MatchUppercase ] \setmathfont{STIX Two Math}[ % Utilisation de STIX Two uniquement pour \varnothing range={\varnothing}, Scale=MatchUppercase ] \setmathfont{rsfso10}[ % Utilisation de rsfso10 uniquement pour mathscr range=scr, Scale=MatchUppercase ] \begin{document} \begin{align*} \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \end{align*} \end{document}

  • Reproducing figures with shaded half-planes in a gray square box
    by 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 curve
    by 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 too
    by 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}

  • Exam Class (Hirschhorn) has different Itemize Spacings for the solution and the solutionbox Environments
    by Simon on January 17, 2026 at 10:32 am

    I am working with the "exam" class by Philip Hirschhorn (version 2.704) and I am experiencing some trouble with the spacing of lists, itemize in my case, in solution environments. I see strong differences between the spacing in the "solutionbox" and the other solution environment but I am not proficient enough in lower level Latex or Tex to figure out the reason and potential solutions myself. I could make the lists behave the same by using "enumitem" with \setlist[itemize, 1]{nosep}. As far as I understand, this means that the list settings are actually changing between the different environments. I am interested in an explanation of the underlying mechanisms. Here is a minimum working example for you \documentclass[11pt, answers]{exam} \renewcommand{\solutiontitle}{% \textbf{Solution:}% \par% \noindent% } \begin{document} \textbf{Start of Document} \begin{questions} \question This is a solutionbox environment \begin{solutionbox}{5cm} The solution is either \begin{itemize} \item A \textbf{or} \item B \end{itemize} But it could also be C in a new paragraph. Or D in another new paragraph. \end{solutionbox} \question This is a solution environment \begin{solution} The solution is either \begin{itemize} \item Z \textbf{or} \item Y \end{itemize} But it could also be X in a new paragraph. Or W in another new paragraph. \end{solution} \end{questions} \textbf{End of Document} \end{document} You can see the difference in this screenshot montage it looks like the line spacing is identical but some lengths in the list environment are modified, such as \itemsep or \parsep The behavior of the solution environment is identical with the other solution environments (solutionorbox, etc.) as far as I see. The documentation says that the solutionbox environment is implemented differently from the other environments. I guess that this is part of the reason. Thanks in advance, Simon

  • Hungarian clickable references with manual suffixes
    by taiwan12 on January 16, 2026 at 9:03 pm

    I’m typesetting a document in Hungarian. Hungarian uses case suffixes / postpositions attached to the noun (e.g. ábra, ábrán, ábrára, táblázat, táblázaton), so I need to manually provide the inflected noun in running text. Additionally, I use the chemstyle package and I want scheme environments to behave like figures: same counter as figures (one shared sequence) same caption name (schemes should say “Ábra” in the caption, not “Scheme”) schemes should appear in the List of Figures This scheme/figure integration is already working; I include that code only because it’s part of the real setup. What I’m stuck on is a small helper macro for clickable references that lets me manually supply the Hungarian noun/suffix without duplicating it. \newcommand*\myref[2][ábra]{\hyperref[#2]{\ref*{#2}.~#1}} Desired output (whole text clickable) ábra ábrán táblázat táblázaton Current output (wrong: noun duplicated) ábra 1. ábra ábra 1. ábrán táblázat 1. táblázat táblázat 1. táblázaton Important: If I remove chemstyle (and the scheme-related unification code), then my referencing setup behaves as expected. The duplication issue appears only when chemstyle is loaded / schemes are involved. MWE \documentclass{report} \usepackage[magyar]{babel} \usepackage{geometry} \usepackage[demo]{graphicx} \usepackage{chemstyle} \usepackage[colorlinks]{hyperref} \usepackage[figurewithin=none, tablewithin=none]{caption} \newcommand*\myref[2][ábra]{\hyperref[#2]{\ref*{#2}.~#1}} \makeatletter % scheme and figure counter \let\c@scheme\c@figure \renewcommand{\thescheme}{\thefigure} % schemename caption figurename \renewcommand{\schemename}{\figurename} % scheme into lof \def\ext@scheme{lof} \let\l@scheme\l@figure \makeatother \begin{document} \tableofcontents \chapter{A} \begin{figure}[H] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Caption} \label{figA} \end{figure} \begin{scheme} \centering \includegraphics[width=0.5\linewidth]{...} \caption{Caption} \label{schA} \end{scheme} \begin{figure}[H] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Caption} \label{figB} \end{figure} \begin{table}[H] \centering \begin{tabular}{c|c} & \\ & \end{tabular} \caption{Caption} \label{tabA} \end{table} \myref[ábra]{figA}, \myref[ábra]{schA}, \myref[ábra]{figB}, \myref[táblázat]{tabA} \myref[ábrán]{figA}, \myref[táblázaton]{tabA} \clearpage \phantomsection \addcontentsline{toc}{chapter}{Ábrák jegyzéke} \listoffigures \clearpage \phantomsection \addcontentsline{toc}{chapter}{Táblázatok jegyzéke} \listoftables \end{document} MWE without chemstyle \documentclass{report} \usepackage[magyar]{babel} \usepackage{geometry} \usepackage[demo]{graphicx} \usepackage[colorlinks]{hyperref} \usepackage[figurewithin=none, tablewithin=none]{caption} \newcommand*\myref[2][ábra]{\hyperref[#2]{\ref*{#2}.~#1}} \begin{document} \tableofcontents \chapter{A} \begin{figure}[h] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Caption} \label{figA} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Caption} \label{figB} \end{figure} \begin{table}[h] \centering \begin{tabular}{c|c} & \\ & \end{tabular} \caption{Caption} \label{tabA} \end{table} \myref[ábra]{figA}, \myref[ábra]{figB}, \myref[táblázat]{tabA} \myref[ábrán]{figA}, \myref[táblázaton]{tabA} \clearpage \phantomsection \addcontentsline{toc}{chapter}{Ábrák jegyzéke} \listoffigures \clearpage \phantomsection \addcontentsline{toc}{chapter}{Táblázatok jegyzéke} \listoftables \end{document}

  • Is that possible to just fill=white for text in only one node?
    by Explorer on January 16, 2026 at 8:07 pm

    I have the following code: \documentclass[tikz,border=5pt]{standalone} \begin{document} \ExplSyntaxOn \keys_define:nn {mykey} { foo .tl_set:N = \l_tmpa_tl } \keys_set:nn {mykey} { foo = {O\quad K},%<- } \begin{tikzpicture} \draw[dotted] (0,0) -- (2,0); \node[inner~sep=0pt] at (1,0) {\l_tmpa_tl}; \end{tikzpicture} \begin{tikzpicture} \draw[dotted] (0,0) -- (2,0); \node[fill=white,inner~sep=0pt] at (1,0) {\l_tmpa_tl}; \end{tikzpicture} \ExplSyntaxOff \begin{tikzpicture} \draw[dotted] (0,0) -- (2,0); \node[fill=white,inner sep=0pt] at (.7,0) {O}; \node[fill=white,inner sep=0pt] at (1.3,0) {K}; \end{tikzpicture} \end{document} For the sake of the template settings, the text O\quad K should be put as a token list, as a whole, but I need the third picture's result. Is that possible to just fill=white to just shade the "text area"? Edited: Since cfr commented for the original template case, I would provide more information. Claims: The original package is exam-zh package It depends on xeCJK, so xelatex is must I was not sure that whether it's CJK fonts settings works on every OS. See here. What I want, is to achieve something sealline style as below: It appeared in the leftmargin of exam paper: Now I have the following code: \documentclass{exam-zh} \usepackage{zhlipsum} % \ExplSyntaxOn % % Line 1487 in exam-zh.cls % % https://github.com/xkwxdyy/exam-zh/blob/main/exam-zh.cls#L1487-L1496 % \cs_set:Npn \__examzh_sealline_odd_text_around_line: % { % \node [ anchor = east ] % at ([xshift = -\g__examzh_sealline_odd_text_xshift_dim, yshift = \g__examzh_sealline_odd_text_yshift_dim]current~page~text~area.west) % { % \g__examzh_sealline_odd_text_format_tl % \__examzh_sealline_odd_spread_box:nn { \g__examzh_sealline_odd_text_width_dim } % { \g__examzh_sealline_odd_text_tl } % }; % } % \ExplSyntaxOff \examsetup{ sealline={ show=true, circle-show=false, line-type={loosely-dotted}, text={密封线},%<- the text here is put as `\g__examzh_sealline_odd_text_tl' text-format={\huge\bfseries}, line-thickness={2.5pt}, text-xshift={.375cm} } } \begin{document} \zhlipsum[name=zhufu] \end{document} That is the original case. Noted that 密封线, the l3keys sealline/text is put into \g__examzh_sealline_odd_text_tl ands \g__examzh_sealline_even_text_tl here(why I say as a whole). Which need to be processed by \__examzh_sealline_odd_spread_box:nn here. I want to change the present settings of exam-zh's setting code to the minimal extent.(Of course, I can type text={}, leave it empty, and follow \__examzh_sealline_odd_circle: here to draw multiple \node[fill=white] {密}s) But that change too much the package's setting. So, I simplified it to my origianl post😊.

  • Best way to break up long equation to fit the IEEE format (double column)
    by TastyTurtle on January 16, 2026 at 12:41 pm

    I have a very long equation where the fraction line spans the whole equation, which makes it fit poorly in the IEEEtran format! Below is an image of the equation(s) in question, along with the current code I am using. Feel free to think creatively for a solution, I am open to almost anything. \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath, amssymb, amsthm} \usepackage{geometry} \usepackage{empheq} \geometry{margin=1in} \begin{document} \begin{empheq}[left=\empheqlbrace]{alignat=2} \label{eq:EOM} &\ddot x_w &= \frac{ \dfrac{k_t}{R_m}V_m - \left(\dfrac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) - r_w m_b l_b\!\left(\ddot\theta_b\cos\theta_b-\dot\theta_b^{2}\sin\theta_b\right) }{ \dfrac{I_w}{r_w}+r_w m_w + r_w m_b }, \\ &\ddot\theta_b &= \frac{ - \dfrac{k_t}{R_m}V_m + \left(\dfrac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) + m_b l_b g \sin\theta_b - m_b l_b \ddot x_w \cos\theta_b }{ I_b + m_b l_b^{2} }. \end{empheq} \end{document} Any help would be awesome Edit: Its my first time working with the IEEEtran format but for this questions, it is just a double-column format. More information can be see here: https://www.overleaf.com/latex/templates/ieee-conference-template/grfzhhncsfqn Furthermore, I have updated the code above so that it's compilabl,e and below is a link to my set of equations in a IEEEtran document: https://www.overleaf.com/read/sqrtfcwfjygr#70ecc2 Edit 2: Three different "solutions" can be see in the image below, its probably best to drop the curly bracket and use ´\multline´: Here is the code to recreate the image above: \documentclass[conference]{IEEEtran} \IEEEoverridecommandlockouts \usepackage{mathtools} \usepackage{empheq} \def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} \begin{document} \begin{verbatim} \splitfrac \end{verbatim} \begin{empheq}[left=\empheqlbrace]{align} \ddot{x}_w &= \frac{ \splitdfrac{ \frac{k_t}{R_m}V_m - \left(\frac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) }{ - r_w m_b l_b \left(\ddot\theta_b\cos\theta_b-\dot\theta_b^{2}\sin\theta_b\right) } }{ \frac{I_w}{r_w} + r_w (m_w + m_b) } \label{eq:EOM_xw} \\[1em] \ddot\theta_b &= \frac{ \splitdfrac{ -\frac{k_t}{R_m}V_m + \left(\frac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) }{ + m_b l_b g \sin\theta_b - m_b l_b \ddot{x}_w \cos\theta_b } }{ I_b + m_b l_b^{2} } \label{eq:EOM_thetab} \end{empheq} Fraction and multline\\ \begin{empheq}[left=\empheqlbrace]{align} \begin{split} \ddot x_w &= \frac{1}{\frac{I_w}{r_w} + r_w (m_w + m_b)} \Bigg[ \frac{k_t}{R_m}V_m \\ &\quad - \left(\frac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) \\ &\quad - r_w m_b l_b \left(\ddot\theta_b\cos\theta_b-\dot\theta_b^{2}\sin\theta_b\right) \Bigg] \end{split} \label{eq:EOM_xw} \\[15pt] \begin{split} \ddot\theta_b &= \frac{1}{I_b + m_b l_b^{2}} \Bigg[ -\frac{k_t}{R_m}V_m \\ &\quad + \left(\frac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) \\ &\quad + m_b l_b g \sin\theta_b - m_b l_b \ddot x_w \cos\theta_b \Bigg] \end{split} \label{eq:EOM_thetab} \end{empheq} Negative exponent and multline\\ \begin{multline}\label{eq:EOM_xw} \ddot x_w = \left( \frac{I_w}{r_w} + r_w (m_w + m_b) \right)^{-1} \\ \times \Bigg[ \frac{k_t}{R_m}V_m - \left(\frac{k_e k_t}{R_m}+b_f\right)\left( \frac{\dot{x}_w}{r_w} - \dot\theta_b \right) \\ - r_w m_b l_b \left(\ddot\theta_b\cos\theta_b-\dot\theta_b^{2}\sin\theta_b\right) \Bigg] \end{multline} \end{document}

  • Drawing a porous sandwich beam
    by Tldi You on January 16, 2026 at 9:03 am

    Can we reproduce this image in LaTeX Tikz? I try this \documentclass[tikz,border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{patterns,arrows.meta,decorations.pathmorphing} \begin{document} \begin{tikzpicture}[scale=1] %------------------------------------------------- % Common styles %------------------------------------------------- \tikzset{ block/.style={draw, thick, fill=orange!20}, caps/.style={draw, thick, fill=blue!40}, axis/.style={->, thick}, profile/.style={thick}, } %================================================= % (b) SD %================================================= \begin{scope}[xshift=0cm] % Top and bottom caps \draw[caps] (0,4) rectangle (4,4.5); \draw[caps] (0,0) rectangle (4,0.5); % Main block with layered patterns \draw[block] (0,0.5) rectangle (4,4); % Internal layers \draw[pattern=checkerboard, pattern color=orange!70] (0,2.7) rectangle (4,4); \draw[pattern=crosshatch, pattern color=orange!70] (0,1.6) rectangle (4,2.7); \draw[pattern=grid, pattern color=orange!70] (0,0.5) rectangle (4,1.6); % Axes \draw[axis] (0,2.25) -- (5,2.25) node[above] {$x$}; \draw[axis] (0,2.25) -- (0,5) node[above] {$z$}; % Right profile \draw[domain=0.5:4,smooth,,red,variable=\z] plot ({6-cos(180*\z/((4-0.5)))},{\z}); % Labels \node[right] at (4.1,3.9) {$E_{\max},\,\rho_{\max}$}; \node[right] at (4.1,0.6) {$E_{\max},\,\rho_{\max}$}; \node at (2,-0.6) {(b) SD}; \end{scope} %================================================= % (c) ASD %================================================= \begin{scope}[xshift=8cm] % Top and bottom caps \draw[caps] (0,4) rectangle (4,4.5); \draw[caps] (0,0) rectangle (4,0.5); % Main block \draw[block] (0,0.5) rectangle (4,4); % Gradient-like pattern layers \draw[pattern=checkerboard, pattern color=orange!70] (0,2.5) rectangle (4,4); \draw[pattern=crosshatch dots, pattern color=orange!70] (0,0.5) rectangle (4,2.5); \draw[pattern=checkerboard, pattern color=orange!70] (0,0.5) rectangle (4,1.6); % Axes \draw[axis] (0,2.25) -- (5,2.25) node[above] {$x$}; \draw[axis] (0,0.5) -- (0,5) node[above] {$z$}; % Right profile (asymmetric) % \draw[profile] % (4,4) .. controls (4.8,3.5) and (4.8,1.5) .. (4,0.5); % Labels \node[right] at (4.1,3.9) {$E_{\max},\,\rho_{\max}$}; \node[right] at (4.1,0.6) {$E_{\min},\,\rho_{\min}$}; \node at (2,-0.6) {(c) ASD}; \draw[domain=0.5:4,smooth,,red,variable=\z] plot ({1*(5-cos(45+(180*\z)/(2*(4-0.5)))))},{\z}); \end{scope} \end{tikzpicture} \end{document} Current result: