Hot
- Positioning of ellipsis between nodesby Mohan Radhakrishnan on January 21, 2026 at 9:46 am
I am trying to add ellipsis between b4 and bn and also between the 4th and last boxes at the end(child pointers). Hope I have included all libraries so that the MWE doesn't break. This is part of a larger document. The bn doesn't have a background properly. The dots are not there as there is no space between b4 and bn and similarly between the last and previous child pointer boxes. I am using this code design based on some examples as it seems to suit the requirement. \usetikzlibrary{fit,positioning,calc,arrows} \usepackage{pgfplots} \usetikzlibrary{backgrounds} \usetikzlibrary{calc, shapes.geometric} \tikzset{ my/.style={ draw=gray,thick,fill=gray!40,minimum height=1.5cm,minimum width=1.5cm,font={\Huge\bfseries} }, >=latex } \begin{tikzpicture}[font=\sffamily, node distance=0.2cm and 0.2cm] \node[my] (b111) {$b_1$}; \node[my,right=of b111] (b112) {$b_2$}; \node[my,right=of b112] (b113) {$b_3$}; \node[my,right=of b113] (b114) {$b_4$}; \node[draw=none,right=of b114] (ellipsis1) {$\cdots$}; \node[my,right=1cm of b114] (bn) {$b_n$}; \node[my,right= 1cm of bn] (b115) {}; \node[my,right=of b115] (b116) {}; \node[my,right=of b116] (b117) {}; \node[my,right=of b117] (b118) {}; \node[draw=none,right=of b118] (ellipsis1) {$\cdots$}; \node[my,right=1cm of b118] (bn) {}; \begin{pgfonlayer}{background} \node[draw=black,thick,fill=gray!30,fit=(b111)] {}; \node[draw=black,thick,fill=gray!30,fit=(b112)] {}; \node[my,anchor=west] at (0,3) (pk1){Partial Keys\strut}; \node[draw=black,thick,fill=gray!30,fit=(b113)] {}; \node[draw=black,thick,fill=gray!30,fit=(b114)] {}; \node[draw=black,thick,fill=gray!30,fit=(bn)] {}; \node[draw=black,thick,fit=(b115)] {}; \node[draw=black,thick,fit=(b116)] {}; \node[draw=black,thick,fit=(b117)] {}; \node[draw=black,thick,fit=(b118)] {}; \node[draw=black,thick,fit=(bn)] {}; \draw[->, black,thick] (b115) -- ++(0,-3); \draw[->, black,thick] (b116) -- ++(0,-3); \draw[->, black,thick] (b117) -- ++(0,-3); \node[my,anchor=west] at (6,3) {Child Pointers\strut}; \draw[->, black,thick] (b118) -- ++(0,-3); \draw[->, black,thick] (bn) -- ++(0,-3); \end{pgfonlayer} \begin{scope}[xshift=6cm] \begin{pgfonlayer}{background} \end{pgfonlayer} \end{scope} \node [font = {\Huge\bfseries\sffamily}, above right=of pk1] (t1) {Node\_16}; \end{tikzpicture} Update : I managed it like this but it is invisible.
- 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:
- 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.
- I get the error message: "Unknown message 'caption-code-by-class-deactivated' for module 'tocbasic'"by S. Venkataraman on January 21, 2026 at 5:35 am
I am using Lualatex. I updated my texlive windows version yesterday and I am getting the above error message: ! LaTeX Error: Unknown message 'caption-code-by-class-deactivated' for module (LaTeX) 'tocbasic'. For immediate help type H <return>. ... l.1377 } This is a coding error. LaTeX was asked to display a message called 'caption-code-by-class-deactivated' by the module 'tocbasic': this message does not exist. Try typing <return> to proceed. If that doesn't work, type X <return> to quit. I have so many packages that it will be difficult to check which package is causing the problem. When I click on the error message, it flags this line in tocbasic.sty: \hook_gput_code:nnn { package / caption3 / before } { tocbasic } { \cs_set:Npn \caption@documentclass { standard } \msg_info:nn { tocbasic } { caption-code-by-class-deactivated } } The file compiles completely and I am able to see the output. What could be the problem?
- Is Algebraic Graph Visualizer (AGV) the best LaTeX (TikZ) assistant applications/software? [closed]by gete on January 21, 2026 at 3:49 am
We have been developing an online app-Algebraic Graph Visualizer (AGV). It translates simple algebraic expression into graph within seconds. The graph can be downloaded as PNG file. Additionally it can be exported into Gephi, Cytoscape and Edge List (CSV) for deeper graph analysis. Most importantly, it can be exported into LaTeX(.tkz) within seconds, thereby acting as LaTeX(TikZ) painkiller in manually writing hundreds of error prone LaTeX prompts. The user can simply generate the graph with a single expression in AGV they like and exported into TikZ with a press and copied it to their LaTeX or overleaf documents. This can greatly reduce the time and effort in manually writing codes. Is there any other software/applicationsavailable as LaTeX(TikZ) assistant better than AGV? Here is the app link for live demo:AGV.
- Change proportional to tabular numbers of equation counterby Luluio on January 20, 2026 at 10:27 pm
I am using lowercase proportional figures in the main body of documents, causing equation counters to be lowercase proportional figures as well. However, especially with multiple equations on a single page, I believe equation counters could benefit from being tabular. How can I adjust the appearance of numbers in counters without affecting it in the main body? A MWE would be: \documentclass{article} \usepackage{fontspec} \usepackage{mathtools} \setmainfont{STIXTwoText}[ Numbers = {Proportional, OldStyle}, ] \counterwithin{equation}{section} \begin{document} \section{Test} \addtocounter{equation}{9} \begin{align} E &= \gamma m c^2 \\ &= \sqrt{p^2 c^2 + m^2 c^4} \\ \gamma &= \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}} \end{align} \end{document}
- Texshop can't find pdflatexby Garrison Cottrell on January 20, 2026 at 10:26 pm
I keep getting this error: /usr/local/texlive/2017/bin/x86_64-darwin/pdflatex does not exist. Of course, it doesn't, as I have more recent versions. I have tried running texshop live, updating everything, I tried reinstalling texshop, I tried downloading and installing mactex, etc. Each time, I get the exact same error. How do I fix this? It's cost me hours...
- Using BibLaTeX with letter classby Pedro G. Mattos on January 20, 2026 at 10:24 pm
I want to use the Biblatex package with the letter class. I tried following Using BibTeX with letter class but it does not work with biblatex. Here is a Minimal Almost-Working Example. \begin{filecontents}{bibliography.bib} @article{First, author = "Other, A. N.", title = "Some things {I} did", journal = "J. Irreproducible Results", year = "2011" } @article{Second, author = "Aaa, S{\o}mebloke", title = "Tigers", journal = "Ann. Improbable Res.", year = "2011" } \end{filecontents} \documentclass{letter} \usepackage{biblatex} \addbibresource{bibliography.bib} \signature{Signature} \address{Address} \begin{document} \begin{letter}{Dear} \opening{Opening} Body of the letter. Some text \cite{First}, more text \cite{Second}. \closing{Sincerely,} \clearpage \printbibliography \end{letter} \end{document}
- 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:
- Weird subscript errorby Dhairya Kumar on January 20, 2026 at 4:41 pm
I had an issue beautifying the function: but faced the error that the subscripts J and D are obviosly too huge. Help me in making them look more better. Codes: $$f(x,y)=\begin{cases} x=x_{\mathrm{J}},y\in\left(-\frac{l}{2},\frac{l}{2}\right) \\ x\in(-x_{\mathrm{J}},x_{\mathrm{J}}), y=y_D\\ x=-x_{\mathrm{J}},y\in\left(-\frac{l}{2},\frac{l}{2}\right) \\ x\in(-x_{\mathrm{J}},x_{\mathrm{J}}), y=-y_D \end{cases}$$ Context: I was writing an answer on MSE and came across this error.
- Can I replace datatool with pure LaTeX3 commands?by lukascbossert on January 20, 2026 at 4:24 pm
In many of my templates (e.g. for proposals) I am relying heavily on datatool building a database structure with various "tables". Throughout the document (or in some cases in the preamble) I fill the tables by adding entries using custom commands. I recently getting more and more involved in LaTeX3 and building functionalities with it instead of using datatool. But the combination is problematic: How to calculate the percentage of a filtered list using LaTeX3? How to add/calculate integers that are coming from a macro using LaTeX3? How to create a list of referenced values based on entries in a datatool-database Therefor I am now contemplating to replace datatool and use LaTeX3 instead. But I am not sure whether I have the same features/functionalities I would have using datatool. Below you find my current approach and I would be happy to get guidance on how to replace the content of the macros using LaTeX3-syntax. It would be best when the content of the user-commands (\get..., \add..., \print...) can stay. A necessity would be to populate a table with e.g. n-many person-entries. Each entry has an id, through this id all key-values are accessible. It would be great when there is already a quality check when passing values to the keys: In my current approach this seems not to be possible, e.g. that gender has only three valid values: m, f, d. Or for period valid values are 1, 2 or 3 or any combination comma-separated (1,3). \keys_define:nn { dfg/person } { id .code:n = \DTLnewdbentry{person}{id}{#1}, id .value_required:n = true, firstname .code:n = \DTLnewdbentry{person}{firstname}{#1}, lastname .code:n = \DTLnewdbentry{person}{lastname}{#1}, gender .code:n = \DTLnewdbentry{person}{gender}{#1}, % valid `m`, `f`, `d` role .code:n = \DTLnewdbentry{person}{role}{#1}, period .code:n = \DTLnewdbentry{person}{period}{#1}, % valid `1`, % `2`, `3` or any combination ,-separated ref-institution-id .code:n = \DTLnewdbentry{person}{ref-institution-id}{#1}, } Why would I want to replace datatool? Since I was asked in the comments here is a summary of what I think why I should replace datatool. Handling of the result value: At the end it comes down to do a loop through the dataset and print the output. With LaTeX3 I could very granular define how one/multiple values are printed Matter of speed: My impression was that looping with datatool takes longer than using LaTeX3. Compiling time is precious when one uses online services (e.g. Overleaf). Not to worry about (no-)expansion: As mentioned above my impression was that the difficulty of handling/evaluating the data is due to the \DTLforeach-loop (see above) Here is the MWE \documentclass{article} \usepackage{datatool,xcolor} \ExplSyntaxOn % ---------------------------------------------------------------- % PERSON key set % ---------------------------------------------------------------- \keys_define:nn { dfg/person } { id .code:n = \DTLnewdbentry{person}{id}{#1}, id .value_required:n = true, firstname .code:n = \DTLnewdbentry{person}{firstname}{#1}, lastname .code:n = \DTLnewdbentry{person}{lastname}{#1}, gender .code:n = \DTLnewdbentry{person}{gender}{#1}, % valid `m`, `f`, `d` role .code:n = \DTLnewdbentry{person}{role}{#1}, period .code:n = \DTLnewdbentry{person}{period}{#1}, % valid `1`, % `2`, `3` or any combination ,-separated ref-institution-id .code:n = \DTLnewdbentry{person}{ref-institution-id}{#1}, } % ---------------------------------------------------------------- % PROJECT key set % ---------------------------------------------------------------- \keys_define:nn { dfg/project } { id .code:n = \DTLnewdbentry{project}{id}{#1}, id .value_required:n = true, number .code:n = \DTLnewdbentry{project}{number}{#1}, status .code:n = \DTLnewdbentry{project}{status}{#1}, % valid `<EMPTY>`, `N`, `E` name .code:n = \DTLnewdbentry{project}{name}{#1}, research-area .code:n = \DTLnewdbentry{project}{research-area}{#1}, ref-person-id .code:n = \DTLnewdbentry{project}{ref-person-id}{#1}, } % ---------------------------------------------------------------- % AFFILIATION key set % ---------------------------------------------------------------- \keys_define:nn { dfg/affiliation } { id .code:n = \DTLnewdbentry{affiliation}{id}{#1}, name .code:n = \DTLnewdbentry{affiliation}{name}{#1}, location .code:n = \DTLnewdbentry{affiliation}{location}{#1}, } % ---------------------------------------------------------------- % INSTITUTION key set % ---------------------------------------------------------------- \keys_define:nn { dfg/institution } { id .code:n = \DTLnewdbentry{institution}{id}{#1}, name .code:n = \DTLnewdbentry{institution}{name}{#1}, ref-affiliation-id .code:n = \DTLnewdbentry{institution}{ref-affiliation-id}{#1}, } % ---------------------------------------------------------------- % \addEntry[<key‑set>]{<database>}{key=val, key=val,…} \NewDocumentCommand{\addEntry}{ O{#2} m m } { % #1 = key set (default = database name) % #2 = name of the database % #3 = comma‑separated key‑value list \DTLifdbexists{#2}{}{\DTLnewdb{#2}}% create DB if missing \DTLnewrow{#2}% % feed the list to the appropriate key family \keys_set:nn { dfg/#1 } { #3 } } % ---------------------------------------------------------------- \NewDocumentCommand{\getEntry}{o m m O{id}}{% % #1 database name % #2 name of the ID-field % #3 name of the field you want to get the data from % #4 field for an alternative id \DTLifdbexists{#1}{% \DTLgetvalueforkey{\thevalue}{#3}{#1}{#4}{#2}% \DTLifnullorempty{\thevalue} {} {\thevalue}% }{% \textcolor{red}{database~missing:~#1}% }} % ---------------------------------------------------------------- % Convenience wrappers \NewDocumentCommand{\getPI}{s m o} { % #1: starred version -> firstname % #2: id of PI / person % #3: optional text, but reference linked to PI \seq_clear:N \l_tmpa_seq \seq_set_from_clist:Nn \l_tmpa_seq {#2}% \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq { \exp_not:n { \group_begin: \DTLgetvalueforkey{\thePersonName}{lastname}{person}{id}{##1} \datatool_if_null:NTF {\thePersonName} { \textcolor{red}{\texttt{<?##1?>}} } { \bfseries \IfNoValueTF{#3}% {\IfBooleanT{#1} {\getEntry[person]{##1}{firstname}\space} \getEntry[person]{##1}{lastname}} {#3}} \group_end: }} \seq_use:Nn \l_tmpb_seq {\space{/}\space}% } %================================================================ % 3. Tiny ready‑made tables (just to show the data) %================================================================ \newcommand{\printProjectLeadersTable}{% \begin{tabular}{ll} \textbf{ID} & \textbf{Name} \\ % Keep rows whose “role” field contains the token “PI” \DTLforeach*[ \DTLisinlist{PI}{\prole} ]{person}{\pid=id,\prole=role,\pfn=firstname,\pln=lastname} {% \pid & \getPI{\pid}\\ }% \end{tabular} } % ---------------------------------------------------------------- % \ProjectsTable{<group-letter>}{<heading>} \newcommand{\printProjectsTable}[2]{% \begin{tabular}{lcl} \textbf{#1-group} & \textbf{Title} & \textbf{PI}\\ \DTLforeach*[ \DTLisPrefix{\pnum}{#1}% 1st condition ]{project}{\pnum=number,\pname=name,\ppid=ref-person-id} {% \pnum & \pname & \getPI*{\ppid}\\ }% \end{tabular} } \ExplSyntaxOff %------------------------------------------------------------- %--- 4. Populate the tiny databases \addEntry{affiliation}{ id = {aff1}, name = {Test University}, location = {Test City} } \addEntry{institution}{ id = {inst1}, name = {Institute of Testing}, ref-affiliation-id = {aff1} } \addEntry{person}{ id = {p1}, firstname = {Alice}, lastname = {Smith}, gender = {f}, role = {PI}, period = {1,2,3}, ref-institution-id={inst1}, } \addEntry{person}{ id = {p2}, firstname = {Bob}, lastname = {Brown}, gender = {m}, role = {PI}, period = {2,3}, ref-institution-id={inst1}, } \addEntry{project}{ id = {A01}, number = {A01}, status = {N}, name = {Sample Project A}, research-area = {1.11-01}, ref-person-id = {p1} } \addEntry{project}{ id = {B01}, number = {B01}, status = {N}, name = {Sample Project B}, research-area = {1.12-01}, ref-person-id = {p2} } %============================================================= \begin{document} \section*{Demo of the tiny interface} %--- simple look-ups ------------------------------------------------ Full name of n-many PI: \textbf{\getPI*{p1,p2}}\\ Project-name: \textbf{\getEntry[project]{A01}{name}}\\ PI-name: \textbf{\getEntry[person]{p1}{lastname}}\\ Typo in ID: \getPI{p3} \bigskip \section*{Project-leaders table (all PIs)} \printProjectLeadersTable \bigskip \section*{Projects – group A} \printProjectsTable{A}{<Description>} \bigskip \section*{Projects – group B} \printProjectsTable{B}{<Description>} \end{document}
- Overleaf equation preview and compilation differ [duplicate]by Paul Chauchat on January 20, 2026 at 2:13 pm
I have been using Overleaf for a while now, but I just stumbled across a problem that puzzles me. I want to showcase the following symbol, \dot{(\hat{x}_t^{-1})}. However, when I type this in Overleaf, the compiled output is completely destructured. I swear I had already used this before though. The most puzzling part is that the built-in equation preview works fine. It appeared even with the code below. Removing amsmath solves the problem, but this is definitely not the desired option in my case. \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} $$\dot{(\hat{x}_t^{-1})}$$ \end{document}
- How to reveal tag of equation in align environment later?by Arya1050 on January 20, 2026 at 1:32 pm
\documentclass{beamer} \begin{document} \begin{frame} \begin{align}\label{Myeqn} A &= B \nonumber \\ \onslide<2->{&= C} \nonumber \\ \onslide<3->{&= D} \nonumber \\ \onslide<4->{&= E} \end{align} \end{frame} \end{document} I want to make the tag of this equation to be revealed along with the last line of the multiline equation, but the tag is revealed right from the beginning. How can I fix this? I'll shamelessly admit, I tried ChatGPT and Gemini, but they failed.
- Optional argument's value could not be transferred for the `*matrix` environment in l3docby myhsia on January 20, 2026 at 12:45 pm
I have to write pmatrix in the l3doc class when conducting a math-related package, and I also have to use the mathtools package to typeset the small matrix. I found that after I define a token list (It's a l3tl, but I use it in l2e environment just for writing this MWE :-)) \ExplSyntaxOn \tl_set:Nn \foo { r } \ExplSyntaxOff Then, I can use it directly like % \usepackage{mathtools} \[ \begin{psmallmatrix*}[\foo] 1 & 2\\ 3 & 4 \end{psmallmatrix*} \] But I could not use it like the case \[ \begin{pmatrix*}[\foo] 1 & 2\\ 3 & 4 \end{pmatrix*} \] which differs with a small prefix, returns me the following error 10 times! Package array: Illegal pream-token (\foo): `c' used. But if I switch to the standard class, like article, the errors disappeared. I've referred l3doc.dtx, and I think it's due to shortvrb, and I disabled | and ", but this does not work, and I've also tried applying \expandafter, it's also not work. The full MWE is the following \documentclass{l3doc} \usepackage{mathtools} \begin{document} \ExplSyntaxOn \tl_set:Nn \foo { r } \ExplSyntaxOff \[ \begin{psmallmatrix*}[\foo] 1 & 2\\ 3 & 4 \end{psmallmatrix*} \] \[ \begin{pmatrix*}[\foo] 1 & 2\\ 3 & 4 \end{pmatrix*} \] \end{document}
- 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}
- Does \stretched cause \setupalignment[middle] to be ignored and flushleft instead?by Gary on January 20, 2026 at 7:55 am
In this example, how can the inter-character spacing be increased for a title on a title page and remain centered? Is \stretched not the correct method? If the \globalsize is removed the results are the same. Thank you. \setupbodyfont[libertinus,12pt] \define[1]\globalfsize{\fullrestoreglobalbodyfont\switchtobodyfont[#1]} \startstandardmakeup[doublesided=no] \startalignment[middle] {\globalfsize{30pt} UNSTRETCHED} \blank[7pt] {\globalfsize{30pt}\stretched[factor=0.15]{STRETCHED}} \blank[7pt] {\stretched[factor=0.15]{\globalfsize{30pt}STRETCHED}} \blank[7pt] {\globalfsize{30pt}\stretched[width=55mm]{STRETCHED}} \stopalignment \stopstandardmakeup ADDED Just stumbled across \letterspacing which appears to work. Not sure it is the preferred method but it stays centered. \setupbodyfont[libertinus,12pt] \define[1]\globalfsize{\fullrestoreglobalbodyfont\switchtobodyfont[#1]} \startstandardmakeup[doublesided=no] \startalignment[middle] {\globalfsize{30pt} UNSTRETCHED} \blank[7pt] {\globalfsize{30pt}\letterspacing[0.15]{STRETCHED}} \blank[7pt] {\letterspacing[0.15]{\globalfsize{30pt}STRETCHED}} \blank[7pt] {\globalfsize{30pt}\letterspacing[0.35]{STRETCHED}} \blank[7pt] \stopalignment \stopstandardmakeup
- Is that possible to measure the height of inline math with hook?by Explorer on January 20, 2026 at 7:36 am
I have the following code, learning from egerg's answer: \documentclass{article} \usepackage{amsmath} \usepackage{lipsum} % https://tex.stackexchange.com/a/700392/322482 \begin{document} \lipsum[2][1-3] \sbox0{$\dfrac{1}{2}$}\texttt{\the\ht0}\usebox{0} \lipsum[2][1-3] \sbox0{$\frac{1}{1+\frac{1}{1+\frac{1}{1+\cdots}}}$}\texttt{\the\ht0}\usebox{0} \lipsum[2][1-3] \sbox0{$\sum\limits_{n=1}^{\infty}\frac{\prod\limits_{k=1}^{n}\tfrac{k}{n^2}}{\prod\limits_{k=1}^{n}\tfrac{1}{n^2}}$}\texttt{\the\ht0}\usebox{0} \lipsum[2][1-3] \sbox0{$\dfrac{\binom{n}{k}}{\binom{n-1}{k-1}}$}\texttt{\the\ht0}\usebox{0} \lipsum[2][1-3] \end{document} Now I don't want to manually use \sbox and \usebox for every inline math formula, I want to "hook" every inline math environment, I have found this link, but looks not the same. Is that possible to apply \newcommand*\mycmd[1]{\sbox0{#1}\texttt{\the\ht0}\usebox{0}} hooked to every inline math environment?
- Can I force expansion in JSONParseArrayMapFunction?by Teepeemm on January 19, 2026 at 6:51 pm
I have a JSON file that I would like to parse, for which I am using the package jsonparse. I would like to split some of the strings in an array and extract that information into separate variables. Unfortunately, it appears that the splitting needs to happen in an expandable context (this is similar to the way that \typeout needs to get an expandable value to . In my case, I was able to specify rescan=false so that the strings are now expandable. But I'm left wondering: would I have been able to split a string that needed rescanning? I had hoped that \exp_args or \use:e would work, but I think it stops at \tl_rescan:nn, which isn't expandable. (Related GitHub issue.) The following code: \documentclass{article} \usepackage{jsonparse} \JSONParse{\myJSONdata}{{"array":["a-b"]}} \typeout{Line 4: \JSONParseValue{\myJSONdata}{array[0]}} % not useful, needs to be expandable \typeout{Line 5: \JSONParseExpandableValue{\myJSONdata}{array[0]}} % useful \ExplSyntaxOn \newcommand{\splitValues}{\splitArg{\JSONParseArrayValue}} \newcommand{\splitArg}[1]{ \item original: ~ #1 \seq_set_split:Nne \l_tmpa_seq { - } { #1 } \item using~seq~items: ~ \seq_item:Nn \l_tmpa_seq {1} ~ and ~ \seq_item:Nn \l_tmpa_seq {2} \exp_args:NNe \str_set:Nn \l_tmpa_str { \seq_item:Nn \l_tmpa_seq {1} } \exp_args:NNe \str_set:Nn \l_tmpb_str { \seq_item:Nn \l_tmpa_seq {2} } \item using~tmp~variables: ~ \l_tmpa_str{} ~ and ~ \l_tmpb_str } \ExplSyntaxOff \begin{document} \begin{itemize} % \splitArg{\JSONParseValue{\myJSONdata}{array[0]}} % causes errors \splitArg{\JSONParseExpandableValue{\myJSONdata}{array[0]}} % good output for one array element \JSONParseArrayMapFunction{\myJSONdata}{array}{\splitValues} % bad output for all array elements \JSONParseArrayMapFunction[rescan=false]{\myJSONdata}{array}{\splitValues} % good output for all array elements \end{itemize} \end{document} has the output Is it possible to have the middle three entries created from \JSONParseArrayMapFunction[rescan=true] but match the first and last three entries?
- Can't get the page dimensions rightby Kristian Nordestgaard on January 19, 2026 at 6:29 pm
I need to typeset a book and for some reason I can not get the dimensions right. I have to use lualatex because of a package that's loaded earlier, and I'm using memoir. It should be simple but it keeps acting up. The dimensions: Page size without bleed: 5.5" x 8.5" (13.97 x 21.59 cm) Page size with bleed: 5.626" x 8.75" (14.29 x 22.23 cm) Here's the MWE: \documentclass[12pt,openany,showtrims]{memoir} \usepackage{lipsum} %% The stock paper size \setstocksize{222.3mm}{142.9mm} %% The 'real' page size \settrimmedsize{139.7mm}{215.9mm}{*} %% The trims \settrims{3.2mm}{3.2mm} %% Spine and trim page margins from main typeblock \setlrmarginsandblock{15mm}{15mm}{*} %% Top and bottom page margins from main typeblock \setulmarginsandblock{15mm}{17mm}{*} \begin{document} \trimLmarks \lipsum[1-6] \lipsum[7-20] \end{document} It just looks wrong, as you can see: I have a feeling that it's something really simple that I'm doing wrong, but think I have started myself blind on this ...
- How to convert LaTeX file to Markdown but have tables, figures, and formulas as images and citations as plain text?by Chad Chaddington on January 19, 2026 at 6:03 pm
I'm writing my thesis in LaTeX (LaTeX Workshop + TeX Live + VSCode) and using GitLab for its version control. With GitLab (and GitHub, and the like), you can comment on individual lines on a file, and you can have this kind of back-and-forth about what to change and how. I'd like to be able to do that with my thesis advisor. However: PDF does not allow for that, since it's a binary file and treated as an image by the commenting feature; I don't know that my advisor is super familiar with LaTeX, so I don't want to give them a whole bunch of .tex files to parse through and try to figure out which one matches which section of the final .pdf; Even if they were okay with that, I don't want to ask them to do extra work (i.e.: install the editor and extension and TeX Live on their computer, plus keep git-pulling my things rather than comment on the file on GitLab) just so that reviewing my work is easier on me. So! I've been looking up ways to convert my LaTeX files into a single file of a types that can be rendered and commented on in platforms like GitLab (e.g.: .txt, .md, ...). So far I'm partial do markdown, since there's a built-in renderer for it on most git platforms and it works for both images and text. Unfortunately, the most promising converter I found - pandoc - turns some of the code into html (e.g.: tables, citations, figures), which kind of cancels out the whole "no code for my adivsor to parse through" aspect. How can I convert a LaTeX file from .tex to .md, so that, simultaneously: Citations are shown in the markdown file as either their display text only, or as links to their matching bibliography entry? Tables, figures, formulas, etc, are displayed as .png images? I've been reading up here, and the tikz package might help convert a few sections to image files (seen here and here with equations), but all mentions I've found only apply this to the final .pdf, not to other file types, and even then they focus on equations, not tables. I assume I can convert from pdf with the tikz images to markdown, but my computer is slow enough I'd like to convert directly from LaTeX to markdown, just with the images rather than tables/figures/etc. I would like a way to make file names consistent, too, between images, if possible. Thank you for your time! Additional note(s): With pandoc, compilation was done as a recipe step/tool for LaTex Workshop. I used no additional flags for compilation beyond specifying I wanted to convert from latex to markdown. I tried to use different types of markdown to see if there was a difference: github-flavored markdown, and regular markdown. The entry on "latex-workshop.latex.tools" in my VSCode settings.json file is: {"name": "markdowntex", "command": "pandoc", "args": [ "%DOC_EXT%", "-f", "latex", "-t", "gfm", "-s", "-o", "%DOC%.md", ]} I do not wish to use Overleaf. (Jan 20) By images I mean .png files and the like, not .pdf files with images on them
- Missing definition of \smallsetminus with lua-unicode-mathby 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$} } }}
- How to make footnote rule appear later in the slide?by Arya1050 on January 19, 2026 at 2:16 pm
I want to make the footnote rule to appear just as the marking text for the first footnote appears on the slide, along with the footnote. I saw this post, where the answer provided only works on a particular slide. But the poster also asked for an automatic solution, which isn't provided there. Essentially, I want a solution that can be written before the main document begins, that is, in the preamble. I could do it manually as in that post, but doesn't hurt to have a shorter, cleaner solution. Can someone provide the automatic solution, or there isn't any? The MWE is the same as the one in the post linked above. Sorry, if there are any mistakes while making this post. This is my first time.
- How to calculate the percentage of a filtered list using LaTeX3?by lukascbossert on January 19, 2026 at 9:50 am
In continuation of How to add/calculate integers that are coming from a macro using LaTeX3? I’d like to go on an calculate the percentage of a given position and gender. The data is coming from a datatool-database and is processed using a combination of expl3-Syntax and e.g. \DTLforeach*. I get the total amount of positions but I am stuck when it comes to the point to get the percentage of e.g. f for PostDoc. My approach is to modify \dfgTotalPosition{<POSITION>} in that regard that by default it prints the result, when I add an optional argument it would store the result to a macro and not print it: \dfgTotalPosition{<POSITION>}[<MACRO>] \NewDocumentCommand{\dfgTotalPosition}{ O{mydb} m o} { % Reset the total \int_zero:N \l__dfg_total_int \clist_map_inline:nn {f,m,d} {\dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {##1} \int_add:Nn \l__dfg_total_int { \l__dfg_tmp_int }} \IfNoValueTF { #3 } % = the optional macro name { % no macro supplied → print the total \int_use:N \l__dfg_total_int } { % macro supplied → store the total in cs \int_set_eq:Nc { \l__dfg_total_int } #3 } } So, with this I was aiming that \dfgTotalPosition{PostDoc}[totalposPostDoc] would give me \totalposPostDoc that I can use anywhere in my text. But it results to ! Missing number, treated as zero. <to be read again> \global l.131 ...fgTotalPosition{PostDoc}[totalposPostDoc] Furthermore I want to calculate the percentage of a given position in relation to its gender. Since \int_set requires a non-expanable integer expression I would use the optional argument of the macro \dfgTotalPosition (If this is also not possible since it requires also "expansion" then the fallback would be hardcoding the positions to get for all positions a macro: \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] ) \NewDocumentCommand{\dfgGenderPercent}{ O{person} m m } { % #1: database % #2: position % #3: gender \dfgTotalPosition{#2}[l__tmp_percent_#2_int] % alternative: % \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] % \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] % --- total number of persons for this position ----------------- \int_set:Nn \l__dfg_total_int { \use:c {l__tmp_percent_ #2 _int} } % alternative: % \str_case_e:nn{#1}{ % {PhD} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PhD_int}} % {PostDoc} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PostDoc_int}} % } % --- number of the requested gender --------------------------- \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1}{#2}{#3} % --- avoid division by zero ---------------------------------- \int_compare:nNnTF { \l__dfg_total_int } = { 0 } { 0 } % nothing to divide { % --- integer percentage (rounded) ------------------------ \int_set:Nn \l__dfg_percent_int { \fp_eval:n {round( 100 * \l__dfg_tmp_int / \l__dfg_total_int )} } % print the integer together with the percent sign \int_use:N \l__dfg_percent_int } } Here is a complete MWE \documentclass{article} \usepackage{expl3} \usepackage{datatool} \ExplSyntaxOn \int_new:N \l__dfg_count_int \int_new:N \l__dfg_total_int \int_new:N \l__dfg_tmp_int % Internal "setter": % \dfg_count_position_set:Nnnn <int> {<db>} {<position>} {<gender>} % Computes the count and stores it in the integer variable <int>. \cs_new_protected:Npn \dfg_count_position_set:Nnnn #1#2#3#4 { % Reset the counter \int_zero:N \l__dfg_count_int % Loop over the database and apply the filters \DTLforeach* [ \DTLiseq{#3}{\pPosition} \and \DTLiseq{#4}{\pGender} \and \DTLisinlist{PI}{\pRole} ] {#2} { \pID=id, \pPosition=position, \pPeriod=period, \pGender=gender, \pRole=role } { % Increment for each matching record \int_incr:N \l__dfg_count_int } % Store the result in the requested integer variable \int_set_eq:NN #1 \l__dfg_count_int } % User-level command: prints the count \NewDocumentCommand{\dfgCountPosition}{ O{mydb} m m } { \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {#3} \int_use:N \l__dfg_tmp_int } % Total for the three genders (f + m + d) for a given position \NewDocumentCommand{\dfgTotalPosition}{ O{mydb} m o} { % Reset the total \int_zero:N \l__dfg_total_int \clist_map_inline:nn {f,m,d} {\dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {##1} \int_add:Nn \l__dfg_total_int { \l__dfg_tmp_int }} \IfNoValueTF { #3 } % #1 = the optional macro name { % no macro supplied → print the total \int_use:N \l__dfg_total_int } { % macro supplied → store the total in cs \int_set_eq:Nc { \l__dfg_total_int } #3 } } \NewDocumentCommand{\dfgGenderPercent}{ O{person} m m } { % #1: database % #2: position % #3: gender \dfgTotalPosition{#2}[l__tmp_percent_#2_int] % alternative: % \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] % \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] % --- total number of persons for this position ----------------- \int_set:Nn \l__dfg_total_int { \use:c {l__tmp_percent_ #2 _int} } % alternative: % \str_case_e:nn{#1}{ % {PhD} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PhD_int}} % {PostDoc} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PostDoc_int}} % } % --- number of the requested gender --------------------------- \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1}{#2}{#3} % --- avoid division by zero ---------------------------------- \int_compare:nNnTF { \l__dfg_total_int } = { 0 } { 0 } % nothing to divide { % --- integer percentage (rounded) ------------------------ \int_set:Nn \l__dfg_percent_int { \fp_eval:n {round( 100 * \l__dfg_tmp_int / \l__dfg_total_int )} } % print the integer together with the percent sign \int_use:N \l__dfg_percent_int } } \ExplSyntaxOff \begin{filecontents*}[overwrite]{mydata.csv} id,position,period,gender,role 1,PostDoc,"2,3",f,PI 2,PostDoc,"1,2,3",m,PI 3,PostDoc,2,f,PI 4,PostDoc,3,d,PI 5,GroupLeader,3,m,PI 6,GroupLeader,2,f,PI 7,GroupLeader,3,m,PI 8,GroupLeader,2,d,PI 9,PhD,3,f,PI 10,PhD,2,m,PI 11,PostDoc,3,f,PI \end{filecontents*} % Load the CSV into a datatool database named "mydb" \DTLloaddb{mydb}{mydata.csv} \begin{document} Females among PostDocs: \dfgCountPosition{PostDoc}{f}\par Males among PostDocs: \dfgCountPosition{PostDoc}{m}\par Diverse among PostDocs: \dfgCountPosition{PostDoc}{d}\par All PostDocs (f/m/d): \dfgTotalPosition{PostDoc}\par All GroupLeaders (f/m/d): \dfgTotalPosition{GroupLeader}\par All PhDs (f/m/d): \dfgTotalPosition{PhD}\par Total Pos: \dfgTotalPosition{PostDoc}[totalposPostDoc] % not working \dfgGenderPercent{PostDoc}{f} % < requires the optional argument of `\dfgTotalPosition{}[]` \end{document}
- How to deal with german umlauts and hyphenation in plain?by MBE on January 18, 2026 at 11:58 pm
Has anyone an idea, how to solve this problem? I know, that plain is oldfashioned.. I will post my solution later, if it works. \parindent0pt % \hyphenation{ %Pro-blem % Mü-he %not working %Müh-sal %not working %öff-ent-lich %not working % } \hyphenation{ Pro-blem Mue-he %old fashioned Mueh-sal %old fashioned oeff-ent-lich %old fashioned } % \hyphenation{ % Pro-blem %M\"u-he %not working % M\"uh-sal %not working % \"off-ent-lich %not working %} \hbox{ \vtop{\hsize2cm Das Problem macht viel Mühe, aber muß die Mühsal sein? Plain ist veraltet, ich weiss, aber ich möchte es wissen. Man kann doch mal öffentlich fragen. } \hskip2cm \vtop{\hsize2cm Das Problem macht viel Muehe, aber muß die Muehsal sein? Plain ist veraltet, ich weiss, aber ich moechte es wissen. Man kann doch mal oeffentlich fragen. } \hskip2cm \vtop{ \hsize2cm Das Problem macht viel M\"u\-he, aber muß die M\"uh\-sal sein? Plain ist veraltet, ich weiss, aber ich m\"och\-te es wissen. Man kann doch mal \"off\-ent\-lich fragen. } } \bye
- 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.
- 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: