Week
- How can I accessibly make my pdf have an H1 heading?by Teepeemm on January 26, 2026 at 7:03 pm
My accessibility checker (Ally) complains that the following "PDF does not have headings": \DocumentMetadata{tagging=on,lang=en-US,pdfstandard=ua-2, tagging-setup={ math/setup=mathml-SE, % role/new-tag=Title/H1, } } \documentclass{article} \usepackage{lipsum} \title{Title} \begin{document} \maketitle \lipsum[1-9] \end{document} I saw elsewhere that uncommenting the role line would cause the title to become an H1, satisfying the need for headings. This satisfies Ally, but now the compilation gives a warning Parent-Child 'pdf2:H1' --> 'pdf2:P'. Relation is not allowed! and VeraPDF says that the PDF is no longer UA-2. Is there a way to make the title become H1 and not P?
- How to define a LaTeX command with multiple \replacecmpd inputs?by palloc on January 26, 2026 at 5:13 pm
I have the following LaTeX code using the chemstyle and chemnum packages: \documentclass{article} \usepackage{graphicx} \usepackage{chemstyle} \usepackage{chemnum} \begin{document} \begin{scheme} \replacecmpd{PhH} \replacecmpd{PhMe} \includegraphics[scale=0.8]{chem.eps} \caption{Caption I} \label{sch:first} \end{scheme} % In my real project the chemicals are different \begin{scheme} \replacecmpd{PhNH2} \replacecmpd{PhNO2} \includegraphics[scale=0.8]{chem.eps} \caption{Caption II} \label{sch:second} \end{scheme} \end{document} I would like to define a new command, for example \schCall, that wraps this structure into a single macro. Desired syntax example: \schCall[0.6]{chem}{PhH, PhMe}{Caption I}{first} Where: the optional argument is the scale (default = 0.8) the first mandatory argument is the image filename (without .eps) the second mandatory argument is a comma-separated list of arguments for \replacecmpd the third argument is the caption text the fourth argument is used for the label
- How to insert a conditional row in a tabularray?by lukascbossert on January 26, 2026 at 3:11 pm
I am building all my tabular things these days with tabularray. However I come across a new issue that is (I guess) due the expansion thing. I cannot insert condidtionally a new row. The condition comes from \compareEntry{}{}{}{} which I was now building using L3 commands. The command itself works fine, but I cann ot put e.g. & in the true-branch. Here is the error message: ! Misplaced alignment tab character &. <argument> & conditional question if first question is 'true'& \getEntry {01}... l.99 \myProject{01} How can I fix it? \documentclass{article} % needed packages ------------------------------------------------ \usepackage{expl3} % LaTeX3 programming layer \usepackage{datatool} % simple key‑value database \usepackage{tabularray,xcolor} \ExplSyntaxOn \msg_new:nnn { dfg } { database-name-not-given } { The~database~name~(`~#1~`)~is~empty. } \msg_new:nnn { dfg } { database-not-found } { The~database~`#1`~does~not~exist. } \cs_new_protected:Npn \dfg_compare_entry:nnnnnn #1#2#3#4#5#6 { % #1 optional DB name (may be empty) % #2 row identifier (value of the primary key “id”) % #3 field name (column we want to read) % #4 reference value (value we compare against) % #5 true‑branch code % #6 false‑branch code %--- 1) Is the DB name empty? -------------------------------- \tl_if_blank:nTF {#1} { \msg_warning:nnn { dfg } { database-name-not-given } {#1} } { %--- 2) Does the DB really exist? ------------------------- \DTLifdbexists{#1} { %--- 3) Pull the wanted field from the row -------------- % The macro \thevalue will contain the field’s content. \DTLgetvalueforkey \thevalue {#3} {#1} {id} {#2} %--- 4) Compare the (fully expanded) field with #4 ----- % \exp_args:Nx expands the first argument completely, % exactly what \edef used to do. \exp_args:Nx \tl_if_eq:nnTF { \thevalue } {#4} {#5} % true branch {#6} % false branch } { \msg_warning:nnn { dfg } { database-not-found } {#1} } } } \NewDocumentCommand \compareEntry { O{\tmpLocalDB} m m m m m } { \dfg_compare_entry:nnnnnn {#1}{#2}{#3}{#4}{#5}{#6} } \DTLnewdb{project} \DTLnewrow{project} \DTLnewdbentry{project}{id}{01} \DTLnewdbentry{project}{Q1}{true} % <- this will trigger a second/conditional row \DTLnewdbentry{project}{Q1a}{yes} \DTLnewdbentry{project}{Q2}{false} \NewDocumentCommand{\getEntry}{O{\tmpLocalDB} 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}% }} \NewDocumentCommand{\myProject}{m} { \def\tmpLocalDB{project} \tl_clear:N \l_tblr_body_tl \tl_gput_right:Nx \l_tblr_body_tl { 1. & {first~ question } & \getEntry{#1}{Q1} \\ \compareEntry{#1}{Q1}{true}{ & conditional~ question~ if~ first~ question~ is~ 'true' &\space \getEntry{#1}{Q1a} \\ }{} 2. & second~ question &\getEntry{#1}{Q2}\\ } \begin{tblr}[ expand=\l_tblr_body_tl, ]{ rowhead = 0, hline{2}={0pt}, rows = {bg=white, halign={l},font=\footnotesize}, column{1} = {halign={r}}, colspec={t{.25cm}X[t]t{1cm}} } \tl_use:N \l_tblr_body_tl \end{tblr} } \ExplSyntaxOff \begin{document} \section*{Conditional rows inside \texttt{tabularray}} Some pretext\\ \myProject{01} \end{document}
- Simplifying an Asymptote figure for spherical coordinatesby Sebastiano on January 26, 2026 at 12:58 pm
I refer to the second code by the user Chris Chudzicki: % Source - https://tex.stackexchange.com/a/160528 % Posted by Chris Chudzicki, modified by community. See post 'Timeline' for change history % Retrieved 2026-01-26, License - CC BY-SA 3.0 \documentclass{article} \usepackage{asymptote} \begin{document} \begin{asy}[width=\textwidth] settings.render=6; settings.prc=false; import three; import graph3; import grid3; currentprojection=obliqueX; //Draw Axes pen thickblack = black+0.75; real axislength = 1.0; draw(L=Label("$x$", position=Relative(1.1), align=SW), O--axislength*X,thickblack, Arrow3); draw(L=Label("$y$", position=Relative(1.1), align=E), O--axislength*Y,thickblack, Arrow3); draw(L=Label("$z$", position=Relative(1.1), align=N), O--axislength*Z,thickblack, Arrow3); //Set parameters of start corner of polar volume element real r = 1; real q=0.25pi; //theta real f=0.3pi; //phi real dq=0.15; //dtheta real df=0.15; //dphi real dr=0.15; triple A = r*expi(q,f); triple Ar = (r+dr)*expi(q,f); triple Aq = r*expi(q+dq,f); triple Arq = (r+dr)*expi(q+dq,f); triple Af = r*expi(q,f+df); triple Arf = (r+dr)*expi(q,f+df); triple Aqf = r*expi(q+dq,f+df); triple Arqf = (r+dr)*expi(q+dq,f+df); pen thingray = gray+0.33; draw(A--Ar); draw(Aq--Arq); draw(Af--Arf); draw(Aqf--Arqf); draw( arc(O,A,Aq) ,thickblack ); draw( arc(O,Af,Aqf),thickblack ); draw( arc(O,Ar,Arq) ); draw( arc(O,Arf,Arqf) ); draw( arc(O,Ar,Arq) ); draw( arc(O,A,Af),thickblack ); draw( arc(O,Aq,Aqf),thickblack ); draw( arc(O,Ar,Arf) ); draw( arc(O,Arq,Arqf) ); pen thinblack = black+0.25; //phi arcs draw(O--expi(pi/2,f),thinblack); draw("$\varphi$", arc(O,0.5*X,0.5*expi(pi/2,f)),thinblack,Arrow3); draw(O--expi(pi/2,f+df),thinblack); draw( "$d\varphi$", arc(O,expi(pi/2,f),expi(pi/2,f+df) ),thinblack ); draw( A.z*Z -- A,thinblack); draw(L=Label("$r\sin{\theta}$",position=Relative(0.5),align=N), A.z*Z -- Af,thinblack); //cotheta arcs draw( arc(O,Aq,expi(pi/2,f)),thinblack ); draw( arc(O,Aqf,expi(pi/2,f+df) ),thinblack); //theta arcs draw(O--A,thinblack); draw(O--Aq,thinblack); draw("$\theta$", arc(O,0.25*length(A)*Z,0.25*A),thinblack,Arrow3); draw(L=Label("$d\theta$",position=Relative(0.5),align=NE) ,arc(O,0.66*A,0.66*Aq),thinblack ); // inner surface triple rin(pair t) { return r*expi(t.x,t.y);} surface inner=surface(rin,(q,f),(q+dq,f+df),16,16); draw(inner,emissive(gray+opacity(0.33))); //part of a nearly transparent sphere to help see perspective surface sphere=surface(rin,(0,0),(pi/2,pi/2),16,16); draw(sphere,emissive(gray+opacity(0.125))); // dr and rdtheta labels triple V= Af + 0.5*(Arf-Af); draw(L=Label("$dr$",position=Relative(1.1)), V--(1.5*V.x,1.5*V.y,V.z),dotted); triple U=expi(q+0.5*dq,f); draw(L=Label("$rd\theta$",position=Relative(1.1)), r*U ---r*(1.66*U.x,1.66*U.y,U.z),dotted ); \end{asy} \end{document} The code uses asymptote package to represent a volume element in spherical coordinates. Asymptote appears to be correctly installed in my MiKTeX distribution; however, the document does not compile and produces the following error: Package asymptote Warning: file `spy-1.pdf' not found on input line 15. (spy.aux)) No pages of output. Transcript written on spy.log. Sorry, but "MiKTeX Compiler Driver" did not succeed. I do not use Asymptote very often, so I am not sure about the cause of the problem. It is possible that the solution is related to what is discussed in the following TeX.StackExchange threads: 'filename-1.pdf' not found Asymptote Asymptote Code Generates .asy Files, But Asymptote Execution Fails In particular, I have not yet tried the solution proposed by the user user279206, and I do not know whether there is an alternative approach that would allow me to compile the document correctly with my MiKTeX distribution. In a previous question, I also asked whether it is possible to obtain the same arrow tip styles provided by Asymptote using TikZ: Arrows with spherical (conical) tips Since I do not understand Asymptote code, I kindly ask whether it would be possible to modify the original code by removing everything that is not strictly necessary, in order to obtain only the figure related to spherical coordinates, without the volume element and without additional unnecessary details to obtain this with the portion of a sphere. In TikZ there is a result: https://tikz.net/spherical_1/ This is my goal:
- Tikz diagram barycentric label of a triangleby Maxim Wan on January 26, 2026 at 2:43 am
I am still new to LaTeX and I am trying to label the areas of my economics diagram in LaTeX. To do this, I am trying to label the areas using barycentric coordinates, because I want the label to appear in the centre of the triangle. To do this I am calculating the intersections of the lines and using barycentric coordinates. However, I am getting the error message. What would be the correct way to do this? Package pgf Error: No shape known as `Q3` is known. Package pgf Error: No shape known as `A3` is known. Here is my code: \documentclass[tikz, border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc, intersections, decorations.pathreplacing} \usepackage{eurosym} \begin{document} \begin{tikzpicture}[ scale=1.2, axis/.style={thick, ->, >=stealth}, curve/.style={thick}, dashed_line/.style={dashed, thin}, important_line/.style={dashed, thick} ] % --- Y INTERCEPTS --- \coordinate (A1) at (0,8); % Y-intercept of Demand \coordinate (A3) at (0,6); % Y-intercept of Pw+sub %AXES \draw[axis, name path=YAxis] (0,0) -- (0,9) node[left, align=center] {Price of Citrus\\(\euro)}; \draw[axis, name path=XAxis] (0,0) -- (9,0) node[below, align=center, xshift=-1cm] {Quantity of citrus\\(tonnes)}; % CURVES % Demand Curve \draw[curve, name path=Demand] (A1) -- (7,1) node[right] {$D_d$}; % Domestic Supply Curve \draw[curve, name path=SupplyDom] (0,0) -- (7,7) node[right] {$S_d$}; % Shifted Supply Curve \draw[curve, name path=SupplySub] (1.5,0) -- (8.5,7) node[right, align=left] {$S_d +$\\$sub$}; % PRICE LINES % World Price \draw[thick, name path=Pw] (0,4.5) -- (8,4.5) node[right] {$S_{world}$}; \node[left] at (0,4.5) {$P_w$}; % Subsidized Price \path[name path=PwSub] (A3) -- (8,6); \draw[important_line] (A3) -- (6,6); \node[left, align=center] at (A3) {$P_w+sub$}; % INTERSECTIONS \path [name intersections={of=Demand and Pw, by=Q1}]; \path [name intersections={of=SupplyDom and Pw, by=Q2}]; \path [name intersections={of=Demand and PwSub, by=Q3}]; \path [name intersections={of=SupplyDom and PwSub, by=Q4}]; \path [name intersections={of=SupplySub and Pw, by=Q4_projected}]; % DROP LINES \draw[dashed_line] (Q1) -- (Q1 |- 0,0) node[below] {$Q_1$}; \draw[dashed_line] (Q2) -- (Q2 |- 0,0) node[below] {$Q_2$}; \draw[dashed_line] (Q3) -- (Q3 |- 0,0) node[below] {$Q_3$}; \draw[dashed_line] (Q4) -- (Q4 |- 0,0) node[below] {$Q_4$}; % SUBSIDY SIZE \draw[<->, thick] (Q4) -- (Q4_projected) node[midway, right] {Size of Subsidy (90{\euro}/tonne)}; % BRACES \draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=5pt}] (Q1 |- 0,-0.6) -- (Q2 |- 0,-0.6) node[midway,yshift=-2em, font=\small] {Exports under free trade}; \draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=5pt}] (Q3 |- 0,-1.6) -- (Q4 |- 0,-1.6) node[midway,yshift=-2em, font=\small, align=center] {Exports under export\\subsidy}; % AREA LABELS \node at (barycentric cs:A1=1, Q3=1, A3=1) {a}; %.. More labels \end{tikzpicture} \end{document} This is the outputted diagram And I am trying to get the 'a' label to be:
- Merging listoffigures and listofschemes into oneby palloc on January 25, 2026 at 9:38 pm
I am working with the following code: \documentclass{report} \usepackage{geometry} \usepackage[demo]{graphicx} \usepackage{chemstyle} \usepackage[colorlinks]{hyperref} \counterwithout{figure}{chapter} \counterwithout{scheme}{chapter} \begin{document} \tableofcontents \chapter{A} \begin{figure}[H] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Fig I} \label{figA} \end{figure} \begin{scheme} \centering \includegraphics[width=0.5\linewidth]{...} \caption{Sch I} \label{schA} \end{scheme} \begin{figure}[H] \centering \includegraphics[width=0.5\linewidth]{...} \caption{Fig II} \label{figB} \end{figure} \ref{figA}, \ref{schA}, \ref{figB} \clearpage \phantomsection \addcontentsline{toc}{chapter}{List of Figures} \listoffigures \clearpage \phantomsection \addcontentsline{toc}{chapter}{List of Scheme} \listofschemes \end{document} What I want is the following: Merge the List of Figures and the List of Schemes into a single List of Figures. In that case, a Scheme should be numbered as a Figure (e.g., “Scheme 1” → “Figure 2”). The output of \ref{schA} should be “Figure 2”.
- Why is my METAFONT code wrong?by Grzegorz Brzęczyszczykiewicz on January 25, 2026 at 9:11 pm
mode_setup; thick#:=10pt#; thin#:=5pt#; xoo#:=15pt#; yoo#:=20pt#; dot#:=4pt#; slant#:=0pt#; define_pixels(thick, thin, xoo, yoo, dot, slant); ascender:=3; descender:=1; def be(expr x, y) = (x*xoo+y*slant, y*yoo) enddef; path bowl; bowl := be(1, 0) .. controls be(1.6, 0) and be(2, 0.4) .. be(2, 1) .. controls be(2, 1.6) and be(1.6, 2) .. be(1, 2) .. controls be(0.4, 2) and be(0, 1.6) .. be(0, 1) .. controls be(0, 0.4) and be(0.4, 0) .. cycle; def stick(expr height, length) = be(0-length, height)--be(0, height)--be(0, 0) enddef; def serif(expr length) = be(0-length, 0)--be(length, 0) enddef; pen thinP; thinP := pencircle scaled thin; %a thin, circular pen pen thickP; thickP := pencircle xscaled thick yscaled thin; %a thick, elliptical pen numeric theta_v, theta_n, A, k; theta_v := angle(slant, yoo); A := theta_v / 2; theta_n := angle(yoo, -slant); k := sqrt( 25 - (2.5*sin(theta_n - A))**2 ) / ( 5*cos(theta_n - A) ); pen p; p := thickP xscaled k rotated A; beginchar("o", 3*xoo#, 2*yoo#, 0); pickup thickP; draw bowl; endchar; beginchar("l", 1.9*xoo#, ascender*yoo#, 0); pickup thickP; draw (stick(ascender, 0.5)) shifted be(0.5, 0); draw (serif(0.5)) shifted be(0.5, 0); endchar; beginchar("b", 3.2*xoo#, ascender*yoo#, 0); pickup thinP; draw bowl shifted be(0.25, 0); pickup thickP; draw (subpath (2, 0) of bowl) shifted be(0.25, 0); draw (stick(ascender-1, 0.5)) shifted be(0.25, 1); pickup p; draw be(0.25, 1.5)--be(0.25, 0.1) endchar; beginchar("d", 3.3*xoo#, ascender*yoo#, 0); pickup thinP; draw bowl; pickup thickP; draw subpath (4, 2) of bowl; draw be(1.5, ascender)--be(2, ascender)--be(2, 0)--be(2.5, 0); endchar; beginchar("p", 3.2*xoo#, ascender*yoo#, descender*yoo#); pickup thinP; draw bowl shifted be(0.25, 0); pickup thickP; draw (subpath (2, 0) of bowl) shifted be(0.25, 0); draw (stick(2+descender, 0.5)) shifted be(0.25, 0-descender); draw (serif(0.5)) shifted be(0.25, 0-descender); endchar; beginchar("q", 3.1*xoo#, ascender*yoo#, descender*yoo#); pickup thinP; draw bowl; pickup thickP; draw subpath (4, 2) of bowl; draw be(2, 1)--be(2, 0-descender); draw (serif(0.5)) shifted be(2, 0-descender); pickup p; draw be(2, 1.9)--be(2, 0.75) endchar; beginchar("i", 1.9*xoo#, ascender*yoo#, 0); pickup thickP; draw (stick(2, 0.5)) shifted be(0.5, 0); draw (serif(0.5)) shifted be(0.5, 0); pickup pencircle scaled (thick+dot); draw be(0.425, 2.75) endchar; beginchar("h", 3.6*xoo#, ascender*yoo#, 0); pickup thinP; draw (subpath (3, 1) of bowl) shifted be(0.375, 0); pickup thickP; draw ((subpath (2, 1) of bowl)--be(2, 0)) shifted be(0.375, 0); draw (stick(ascender, 0.5)) shifted be(0.375, 0); draw (serif(0.5)) shifted be(0.375, 0); draw (serif(0.5)) shifted be(2.375, 0); endchar; beginchar("n", 3.6*xoo#, ascender*yoo#, 0); pickup thinP; draw (subpath (3, 1) of bowl) shifted be(0.375, 0); pickup thickP; draw ((subpath (2, 1) of bowl)--be(2, 0)) shifted be(0.375, 0); draw (stick(2, 0.5)) shifted be(0.375, 0); draw (serif(0.5)) shifted be(0.375, 0); draw (serif(0.5)) shifted be(2.375, 0); endchar; end there are errors and it should be correct, it throws "Missing )" and "Extra tokens will be flushed" errors. For slant = 0, k should work out to sqrt(1.75) = 1.32287565553..., and A = 45°, however due to a bug, the k is a few eyelets shy of the expected sqrt(1.75), and the line becomes too thin. As for the A, it maybe is correct but I don't know if it is. There are bugs and I don't know how to fix them.
- Different column alignment of first-rowby Werner on January 25, 2026 at 5:19 pm
I like my matrix indices to be center-aligned while numbers within the matrix should be right-aligned for better visual clarity of scale. However, none of my attempts to achieve both have been successful. In the example below, the first option is closest, but fails to align the lost column index. \documentclass{article} \usepackage{nicematrix,xcolor} \newcommand{\mc}{\multicolumn{1}{c}} \begin{document} Manual formatting without \texttt{first-row} - last column index not centered: \[ \begin{NiceArray}{ *{6}{r} } \mc{\color{red}\scriptstyle 0} & \mc{\color{red}\scriptstyle 1} & \mc{\color{red}\scriptstyle 2} & \mc{\color{red}\scriptstyle 3} & \mc{\color{red}\scriptstyle 4} & \mc{\color{red}\scriptstyle 5} \\ 8 & 5 & 16 & 19 & 10 & 5 \\ 12 & 5 & 12 & 15 & 9 & 14 \\ 19 & 13 & 6 & 2 & 12 & 3 \\ 7 & 18 & 13 & 0 & 0 & 17 \\ 6 & 10 & 2 & 7 & 11 & 16 \CodeAfter \SubMatrix[{2-1}{6-6}] \end{NiceArray} \] Using \texttt{\string\RowStyle} - no centering of indices: \[ \begin{NiceArray}{ *{6}{r} } \RowStyle[nb-rows=1]{\color{red}\scriptstyle} 0 & 1 & 2 & 3 & 4 & 5 \\ 8 & 5 & 16 & 19 & 10 & 5 \\ 12 & 5 & 12 & 15 & 9 & 14 \\ 19 & 13 & 6 & 2 & 12 & 3 \\ 7 & 18 & 13 & 0 & 0 & 17 \\ 6 & 10 & 2 & 7 & 11 & 16 \CodeAfter \SubMatrix[{2-1}{6-6}] \end{NiceArray} \] Using \texttt{first-row} - no centering of indices: \[ \begin{NiceArray}{ *{6}{ r } }[first-row,code-for-first-row=\color{red}\scriptstyle] 0 & 1 & 2 & 3 & 4 & 5 \\ 8 & 5 & 16 & 19 & 10 & 5 \\ 12 & 5 & 12 & 15 & 9 & 14 \\ 19 & 13 & 6 & 2 & 12 & 3 \\ 7 & 18 & 13 & 0 & 0 & 17 \\ 6 & 10 & 2 & 7 & 11 & 16 \CodeAfter \SubMatrix[{1-1}{5-6}] \end{NiceArray} \] Using \texttt{first-row} with \texttt{c}entered columns - no right-aligned matrix elements: \[ \begin{NiceArray}{ *{6}{ c } }[first-row,code-for-first-row=\color{red}\scriptstyle] 0 & 1 & 2 & 3 & 4 & 5 \\ 8 & 5 & 16 & 19 & 10 & 5 \\ 12 & 5 & 12 & 15 & 9 & 14 \\ 19 & 13 & 6 & 2 & 12 & 3 \\ 7 & 18 & 13 & 0 & 0 & 17 \\ 6 & 10 & 2 & 7 & 11 & 16 \CodeAfter \SubMatrix[{1-1}{5-6}] \end{NiceArray} \] \end{document} How can I achieve a different alignment for the first row (indices) compared to the rest of the matrix?
- Where does this 1pt extra space between paragraphs come from, and how to configure it?by H. Weirauch on January 25, 2026 at 2:09 pm
In the MWE \documentclass{article} \usepackage{lua-visual-debug} \setlength{\parindent}{0pt} \setlength{\parskip}{0pt} \begin{document} \rule{6mm}{6mm} \rule{7mm}{6mm} \end{document} the code contains an empty line (= new paragraph) between the two \rules. This is what it looks like in the output: Between the paragraphs, some vertical spacing is inserted. As far as I can tell, it is exactly 1pt. Where does this come from, and how am I supposed to modify it? This space does not occur when using minimal document class; it apparently is limited to article (or other high-level classes like KOMA).
- How can I tag an l3pdftextfield?by cfr on January 25, 2026 at 6:53 am
I'm trying to create a text field in a tagged PDF. My real document uses ltx-talk, which complicates things slightly, but the MWE below uses article. I mention ltx-talk in case somebody has a solution which would work for article, but not for ltx-talk, so that I do not waste people's time. \DocumentMetadata{% lang=en-GB, tagging=on, pdfversion=2.0, pdfstandard=UA-2, } \documentclass{article} \usepackage{bookmark} \usepackage{l3pdffield} \title{Tools} \ExplSyntaxOn \cs_new_eq:NN \textfield \pdffield_textfield:n \ExplSyntaxOff \begin{document} \Form \textfield { name=fieldA, width=50mm, height=12pt, depth=50pt, setfieldflags=Multiline, altname=a, } \end{document} I'm having some difficulty understanding how much I'm supposed to do here and how much I'm supposed to let happen. tagpdf.pdf suggests that form fields created with l3pdffield should be automatically added to the structure. I think this indeed happens1: <PDF> <StructTreeRoot> <Document xmlns="http://iso.org/pdf2/ssn" id="ID.02" > <text-unit xmlns="https://www.latex-project.org/ns/dflt" id="ID.05" rolemaps-to="Part" > <text xmlns="https://www.latex-project.org/ns/dflt" id="ID.06" xmlns:Layout="http://iso.org/pdf/ssn/Layout" Layout:TextAlign="Justify" rolemaps-to="P" > <Form xmlns="http://iso.org/pdf2/ssn" id="ID.07" > <?ReferencedObject type="Annot" page="1" ?> </Form> </text> </text-unit> </Document> </StructTreeRoot> </PDF> What I'm not sure about is how to configure a Contents entry for the field - or maybe where I am supposed to put altname, which is presumably in the wrong place at the moment? The document compiles without errors with either LuaLaTeX or pdfLaTeX. However, the PDF fails to validate against UA-22,3. verapdf says <?xml version="1.0" encoding="utf-8"?> <report> <buildInformation> <releaseDetails id="core" version="1.28.2" buildDate="2025-07-15T16:07:00+01:00"></releaseD etails> <releaseDetails id="validation-model" version="1.28.2" buildDate="2025-07-15T16:12:00+01:00 "></releaseDetails> <releaseDetails id="gui" version="1.28.2" buildDate="2025-07-15T16:59:00+01:00"></releaseDe tails> </buildInformation> <jobs> <job> <item size="23750"> <name>/path/to/test-file.pdf</name> </item> <validationReport jobEndStatus="normal" profileName="PDF/UA-2 + Tagged PDF validation pro file" statement="PDF file is not compliant with Validation Profile requirements." isCompliant=" false"> <details passedRules="1722" failedRules="1" passedChecks="175" failedChecks="1"> <rule specification="ISO 14289-2:2024" clause="8.10.2.3" testNumber="1" status="faile d" failedChecks="1" tags="annotation,alt-text"> <description>If a label for a widget annotation is not present, a Contents entry sh all be provided to supply description and context for the widget</description> <object>PDWidgetAnnot</object> <test>containsLbl == true || Contents != null</test> <check status="failed"> <context>root/document[0]/pages[0](21 0 obj PDPage)/annots[0](37 0 obj PDWidgetAn not)</context> <errorMessage>Widget annotation contains neither label nor Contents entry</errorM essage> </check> </rule> </details> </validationReport> <validationReport jobEndStatus="normal" profileName="WTPDF 1.0 Accessibility validation p rofile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant ="false"> <details passedRules="1718" failedRules="1" passedChecks="171" failedChecks="1"> <rule specification="WTPDF1.0" clause="8.10.2.3" testNumber="1" status="failed" faile dChecks="1" tags="annotation,alt-text"> <description>If a label for a widget annotation is not present, a Contents entry sh all be provided to supply description and context for the widget</description> <object>PDWidgetAnnot</object> <test>containsLbl == true || Contents != null</test> <check status="failed"> <context>root/document[0]/pages[0](21 0 obj PDPage)/annots[0](37 0 obj PDWidgetAn not)</context> <errorMessage>Widget annotation contains neither label nor Contents entry</errorM essage> </check> </rule> </details> </validationReport> <validationReport jobEndStatus="normal" profileName="WTPDF 1.0 Reuse validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false" > <details passedRules="1705" failedRules="1" passedChecks="169" failedChecks="1"> <rule specification="WTPDF1.0" clause="8.10.2.3" testNumber="1" status="failed" faile dChecks="1" tags="annotation,alt-text"> <description>If a label for a widget annotation is not present, a Contents entry sh all be provided to supply description and context for the widget</description> <object>PDWidgetAnnot</object> <test>containsLbl == true || Contents != null</test> <check status="failed"> <context>root/document[0]/pages[0](21 0 obj PDPage)/annots[0](37 0 obj PDWidgetAn not)</context> <errorMessage>Widget annotation contains neither label nor Contents entry</errorM essage> </check> </rule> </details> </validationReport> <duration start="1769321531153" finish="1769321531866">00:00:00.713</duration> </job> </jobs> <batchSummary totalJobs="1" failedToParse="0" encrypted="0" outOfMemory="0" veraExceptions="0 "> <validationReports compliant="0" nonCompliant="1" failedJobs="0">1</validationReports> <featureReports failedJobs="0">0</featureReports> <repairReports failedJobs="0">0</repairReports> <duration start="1769321531030" finish="1769321531917">00:00:00.887</duration> </batchSummary> </report> From what I gathered from the PDF spec, I want to add a Contents here, because a label would correspond to a visible label in the PDF, which does not exist. 1 However, some parts of the documentation for l3pdfmanagement suggest that perhaps only link annotations, as opposed to widget annotations, are currently handled fully automatically by the tagging code. So I'm not sure that I do not need to do something additional here, but the problem does not seem to be adding the widget to the structure? 2 In fact, the text field here is not supposed to make sense on its own. It is only meant to make sense when I am standing there talking. It's just a place for me to type. Its purpose will make sense by the end of class, because it will then have content. 3 So marking the field up for accessibility is actually a bit strange. It isn't 'accessible' to sighted readers either in advance of the relevant class.
- Vertical centering in table cellsby bubba on January 25, 2026 at 6:35 am
I'm trying to typeset the following table. I'm having trouble with the vertical centering of each cell's contents, plus the obvious horizontal alignments. ChatGPT's numerous attempts were all hopelessly wrong, and I eventually created the image below in Powerpoint, which (sadly) might have to be my solution, if all else fails.
- Rounding errors printing fractions with \pgfmathprintnumberby pwesterbaan on January 25, 2026 at 12:53 am
I'm trying to use pgfmath to help with randomizing exam questions that I give my students. One of the hurdles I've come across is printing fractions correctly. I've defined the following command: \newcommand{\printFrac}[2]{ \pgfmathprintnumber[frac, frac whole=false, frac shift=1, precision=8]{\fpeval{#1/#2}} } While debugging, I've found that this fails with fractions like "10/41" and "16/9": \[10/41: \printFrac{10}{41}\qquad 16/9: \printFrac{16}{9}\] I read about and tried the pgfmath-xfp package, but the error still persists: \pgfmxfpdeclarefunction{myfrac}{2}{#1/#2} \newcommand{\printFrac}[2]{ \pgfmathparse{myfrac(#1,#2)} \pgfmathprintnumber[frac, frac whole=false, frac shift=1, precision=8]{\pgfmathresult} } Is there something obvious I'm missing? Should I be using another method to print out randomly generated fractions? EDIT: As pointed out in the comments, I did not originally include a complete MWE. In this example, I generate two random non-zero integers, reduce them using the GCD, then try and print the resulting fractions. In this particular run (using a random seed), \printFrac{8}{15} prints correctly, but \printFrac{-15}{8} prints incorrectly. This does not happen everytime, but it happens fairly frequently: \documentclass{exam} \usepackage{tikz} \usetikzlibrary{math} \newcommand{\defVar}[2]{% \pgfmathparse{#2}% \pgfmathsetmacro{#1}{\pgfmathresult}% } \newcommand{\randIntLower}{2} %Lower bound on rand ints \newcommand{\randIntUpper}{10} %Upper bound on rand ints \newcommand{\randIntTemp}{} %Used for defining values in randInts \newcommand{\randInts}[2][]{% % #1 = option (default: []; Use nz for nonzero) % #2 = list of variables % Uses \randIntLower and \randIntUpper as bounds (change with renewcommand if needed) \foreach \var in {#2}{% \ifstrequal{#1}{nz}{% % nonzero method: produces +/- nonzero random integers on [-\randIntUpper,-\randIntLower]\cup[\randIntLower,\randIntUpper] \pgfmathparse{int(ifthenelse(rand > 0, 1, -1)*random(\randIntLower,\randIntUpper))}% \expandafter\xdef\var{\pgfmathresult}% }{% % random integer on [\randIntLower,\randIntUpper] \pgfmathrandominteger{\randIntTemp}{\randIntLower}{\randIntUpper}% \expandafter\xdef\var{\randIntTemp}% }% }% } \newcommand{\computeGcd}[3]{% % #1 = result macro % #2 = first number % #3 = second number % Uses Euclidean algorithm \pgfmathparse{int(abs(#2))}% \pgfmathsetmacro{\gcdA}{int(\pgfmathresult)}% \pgfmathparse{int(abs(#3))}% \pgfmathsetmacro{\gcdB}{int(\pgfmathresult)}% \loop\ifnum\gcdB>0\relax% \pgfmathparse{int(mod(\gcdA, \gcdB))}% \pgfmathsetmacro{\gcdTemp}{int(\pgfmathresult)}% \pgfmathsetmacro{\gcdA}{\gcdB}% \pgfmathsetmacro{\gcdB}{\gcdTemp}% \repeat% \pgfmathsetmacro{#1}{\gcdA}% } \newcommand{\makeFrac}[2]{% \randInts[nz]{#1}% \pgfmathsetmacro{\randIntLower}{\fpeval{#1+abs(#1)/#1}}% \pgfmathsetmacro{\randIntUpper}{\fpeval{2*#1-abs(#1)/#1}}% \randInts[nz]{#2}% \computeGcd{\gcdValue}{#1}{#2}% \defVar{#1}{int(#1/\gcdValue)}% \defVar{#2}{int(#2/\gcdValue)}% } \newcommand{\printFrac}[2]{% \pgfmathprintnumber[frac, frac whole=false, frac shift=1, precision=8]{\fpeval{#1/#2}}% } \pgfmathsetseed{\number\pdfrandomseed} %\pdfrandomseed \begin{document} \makeFrac{\delY}{\delX} \[\pgfmathprintnumber{\delY}/\pgfmathprintnumber{\delX}\qquad m=\printFrac{\delY}{\delX}\qquad -\frac{1}{m}=\printFrac{-\delX}{\delY}\] \[\textnormal{Correct: }\qquad-2/3: \printFrac{-2}{3}\qquad 4/3: \printFrac{4}{3}\] \[\textnormal{Incorrect: }\qquad10/41: \printFrac{10}{41}\qquad 16/9: \printFrac{16}{9}\] \end{document} My end goal is to make my own sort of "portable toolbox" that I can include in different files when writing exams. To address @egreg's comment, I'm using "\printFrac" so that a randomly generated fraction such as -2/-3 is displayed as \frac{2}{3} and 2/-3 as -\frac{2}{3}.
- circuitikz: position and adjust current and voltage arrowsby cis on January 24, 2026 at 7:17 pm
I'm trying to recreate this image on 5mm grid paper using the original dimensions. It's not a big problem; I'm just looking for some fine-tunings inside the circuitikz-package. I've tested a few keys, but I'm wondering: What is the correct method: to add a longer voltage arrow that's a bit further away from the source? to add a current arrow at the shown position in a package-like way (regular TikZ is clear)? PS: I would also like to reduce the (global setting!) size of the arrowheads and the control points ("poles", I haven't quite understood chapter 6.1 yet); but that might be too much for one thread. MWE: [I've only set a small excerpt here to address the problems. I can easily add the rest later by myself.] \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[font=\footnotesize\sffamily, european resistors, circuitikz/resistors/width=0.425,% default 0.8 circuitikz/bipoles/generic/height=0.165,% default 0.3 circuitikz/bipoles/thickness=1.0, % default 2 circuitikz/bipoles/vsource/width=0.35, circuitikz/bipoles/vsource/height=0.35, %circuitikz/bipole/is voltage=false, %circuitikz/voltage/distance from node=5.0875,% old: 0.8 %circuitikz/voltage shift sources adjust=4.525,% default: 0.5 %voltage shift=0.125,% optional ] \draw[gray!25, step=5mm] (-1.5,0.5) grid (4,-4); \draw[] (0,-2) to[vsource, v<=12V, mirror] (0,0) -- (1.5,0); \draw[] (0.5,0) to[R=15, *-*] (0.5,-1) to[R, a=25, -*] (0.5,-2); \end{circuitikz} \end{document}
- Package draftmark conflicts with siunitxby user172294 on January 24, 2026 at 3:55 pm
I would like to use both packages draftmark and siunitx in the same document. When I do this I get the error ! Undefined control sequence. \@BTswitch ->{\CT@arc@ \hrule \@height \@thisrulewidth }\futurenonspacelet \... As soon as I comment out either \usepackage{siunitx} or \midrule, it works. Here is what I tried \documentclass[11pt,a4paper]{article} \usepackage{siunitx} \usepackage{booktabs,tabularx} \usepackage[draft]{draftmark} \begin{document} \begin{tabularx}{\textwidth}{ll} head1 & head2 \\ \midrule 123 & 456\\ 123 & 456\\ \end{tabularx} \end{document} Obiviously, there is no problem when I comment out \usepackage[draft]{draftmark} Can anyone help? Thanks.
- Help trying to customise toc with tagging supportby David Purton on January 24, 2026 at 12:25 pm
I'm trying to customise the TOC using built in commands to allow for tagging support, but I'm running in to some behaviour I can't figure out. In the following MWE, the I set \contentsline@text@2@format to \emph and the the line is formatted as expected. But if I set it to \MakeUppercase the label structure breaks (in this case notice the missing space after the subsection number). Am I doing this wrong? I'm struggling to trace the code through to find out why this happens. %! TeX Program = lualatex \DocumentMetadata{ lang=en, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on } \documentclass{article} \ExplSyntaxOn \cs_set_nopar:cpn { contentsline@text@2@format } { \emph % Fails with \MakeUppercase } \ExplSyntaxOff \begin{document} \tableofcontents \subsection{A section heading} \end{document}
- A new kind of ligature, connected d/pby ivo Welch on January 24, 2026 at 3:58 am
I have been trying to coerce Claude to help me, but it is hilariously bad. I am trying to create a new character that looks like d <space> p, where the <space> becomes a connector. The font is charter, math, which I can pull off from newtxmath or mathdesign, which means the input is modestly slanted. \documentclass[12pt]{standalone} \usepackage{XCharter} \usepackage[charter,vvarbb]{newtxmath} \usepackage{amsmath} \begin{document} \fontsize{200}{172}\selectfont \ensuremath{d \kern22pt p} \end{document} I have blown this up here, but I shall need it in my normal font lateron. The result is supposed to look somewhat like: Obviously, one can do quite a bit better than me and my pen, especially, but not only at the lower left corner of my new connector. I will use this, in standard font size, a few hundred times in my document. Is it easy to create such a character? What program should I use? A low learning curve is a lot more important than versatility for further designs in the future. Once I have the character, how do I best use it in my document? Should I try to create its own one-character font, or just create a few PNG files at the right sizes that a \dp\ macro then inserts?
- Can I add a symbol to indicate that a footnote has been split across pages?by Draconis on January 23, 2026 at 9:05 pm
My university's thesis formatting guidelines are extremely stringent about margins, which means when a footnote gets split across pages (because the \footnotemark is on the bottom line of the page, so including the entire footnote would push the mark onto the next page), there's not much I can do to fix it. I can't, for example, expand the text box slightly, or insert some additional whitespace at the bottom. Proofreaders have found this confusing. So with the better typographical solutions being off-limits, I would like to at least indicate to the reader that the footnote continues on the next page. Is it possible to indicate some sort of symbol, such as a rightward-pointing arrow, at the point where a footnote has been split across pages, to indicate that it's continued elsewhere? I know some periodicals do this when an article is split across pages. MWE adapted from here: \documentclass[oneside]{book} \usepackage{lipsum} \usepackage[splitrule]{footmisc} \begin{document} \lipsum[1-3] \lipsum[1] New paragraph, which is really long, so long in fact that it spans more than one line. New paragraph, which is really long, so long in fact that it spans more than one line. \footnote{Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour.} % \lipsum \end{document} Current result: What I would like: some kind of symbol (perhaps a ➤?) at the end of the first page, showing that the footnote continues elsewhere and isn't just broken off. \usepackage[splitrule]{footmisc} indicates on the next page that there's a continuation, but I would like a marker on the first page as well. This question, this question, and this question ask the same thing, but none of them includes a MWE; I'm hoping that providing one will help find an answer.
- How to position TikZ shapes directly centered under text labels in a table-like layout?by Oregon Math Tutor on January 23, 2026 at 7:13 pm
I'm creating a geometry reference sheet with a table-like layout using TikZ. I need: the shape label horizontally centered in the cell each figure centered beneath the label As the image shows, I can't achieve this alignment. This image shows my desired output: This image (partial screen shot) shows what the current code renders: Current approach: Using \node for labels positioned with anchor=east Drawing shapes inside \begin{scope}[shift={...}] blocks Each row has a label on the left, shape in the middle-left, and properties on the right Thanks very much for taking time to assist me! mwe: \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{amssymb} \usetikzlibrary{calc, shapes.geometric, arrows.meta, decorations.markings} % Use Helvetica (similar to Arial) for a clean look since custom fonts caused errors \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} % Define colors to match the original image \definecolor{colSquare}{RGB}{156, 188, 156} % Muted Green \definecolor{colRect}{RGB}{128, 128, 128} % Greyish \definecolor{colPara}{RGB}{255, 105, 120} % Pink/Red \definecolor{colRhom}{RGB}{190, 140, 190} % Purple \definecolor{colKite}{RGB}{180, 230, 200} % Mint Green \definecolor{colTrap}{RGB}{245, 170, 60} % Orange \definecolor{colText}{RGB}{128, 0, 128} % Purple text for headers \definecolor{colLine}{RGB}{70, 130, 180} % Blue grid lines \begin{document} \begin{tikzpicture}[ thick, % Style for shape outlines myshape/.style={draw=black, line width=1pt}, % Custom tick marks for sides tick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-2.5pt,-2.5pt) -- (2.5pt,2.5pt);}}}}, dtick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-1.5pt,-2.5pt) -- (2.5pt,2.5pt) (-4.5pt,-2.5pt) -- (-0.5pt,2.5pt);}}}}, % Custom arrows for parallel lines parrow/.style={postaction={decorate, decoration={markings, mark=at position 0.55 with {\arrow[scale=1.5,black]{>}}}}} ] % --- Grid Layout --- % Horizontal lines \draw[colLine] (-4, 1.5) -- (12, 1.5); \draw[colLine] (-4, 0) -- (12, 0); \draw[colLine] (-4, -4) -- (12, -4); \draw[colLine] (-4, -8) -- (12, -8); \draw[colLine] (-4, -12) -- (12, -12); \draw[colLine] (-4, -16) -- (12, -16); \draw[colLine] (-4, -20) -- (12, -20); \draw[colLine] (-4, -24) -- (12, -24); % Vertical separator \draw[colLine] (3.5, 1.5) -- (3.5, -24); % Headers \node[text=colText, scale=2] at (-0.25, 0.75) {Shape}; \node[text=colText, scale=2] at (7.75, 0.75) {Properties}; % --- Row 1: Square --- \begin{scope}[shift={(0,-2)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Square}; \coordinate (S1) at (2.5, -1.2); \coordinate (S2) at (4.9, -1.2); \coordinate (S3) at (4.9, 1.2); \coordinate (S4) at (2.5, 1.2); \fill[colSquare] (S1) -- (S2) -- (S3) -- (S4) -- cycle; % Ticks drawn manually to ensure rotation alignment looks just like the image \draw[myshape] (S1) -- (S2) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S2) -- (S3) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S3) -- (S4) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S4) -- (S1) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (S1) -- (S3); \draw (S2) -- (S4); % Right angle at center \draw (3.7,0) ++(0.2,0.2) -- ++(-0.2,0.2) -- ++(-0.2,-0.2); % Corner right angles \draw (S1) ++(0.3,0) -- ++(0,0.3) -- ++(-0.3,0); \draw (S2) ++(-0.3,0) -- ++(0,0.3) -- ++(0.3,0); \draw (S3) ++(-0.3,0) -- ++(0,-0.3) -- ++(0.3,0); \draw (S4) ++(0.3,0) -- ++(0,-0.3) -- ++(-0.3,0); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item All sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect at $90^\circ$. \end{itemize} \end{minipage} }; \end{scope} % --- Row 2: Rectangle --- \begin{scope}[shift={(0,-6)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Rectangle}; \coordinate (R1) at (2.5, -0.9); \coordinate (R2) at (5.0, -0.9); \coordinate (R3) at (5.0, 0.9); \coordinate (R4) at (2.5, 0.9); \fill[colRect] (R1) -- (R2) -- (R3) -- (R4) -- cycle; % Sides ticks \draw[myshape] (R1) -- (R2) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R2) -- (R3) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (R3) -- (R4) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R4) -- (R1) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (R1) -- (R3); \draw (R2) -- (R4); % Corners \draw (R1) ++(0.2,0) -- ++(0,0.2) -- ++(-0.2,0); \draw (R2) ++(-0.2,0) -- ++(0,0.2) -- ++(0.2,0); \draw (R3) ++(-0.2,0) -- ++(0,-0.2) -- ++(0.2,0); \draw (R4) ++(0.2,0) -- ++(0,-0.2) -- ++(-0.2,0); % Diagonal marks (triple tick) % Manually drawing triple ticks on diagonals \draw[line width=0.8pt] (3.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.4, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.1, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.3, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.4, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.1, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.3, -0.1) -- ++(0.1,-0.2); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item Opposite sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect each other. \end{itemize} \end{minipage} }; \end{scope} \end{tikzpicture} \end{document}
- Raise integral signs with limitsby Knudsen on January 23, 2026 at 2:14 pm
Is there a way to raise an integral sign slightly and bring the limits together with it? For example, in \documentclass{report} \begin{document} \[ \int_0^1 \sqrt{a+b\sqrt{a+b\sqrt{a+b\sqrt{x}}}} dx \] \end{document} the integral can benefit from being enlarged and moved up a small bit, even if it going to take it out of alignment with part of the formula.
- TikZ Feynman W loop with Z radiationby Beth Long on January 23, 2026 at 12:55 pm
I want to make the following diagram: But this: \documentclass[a4paper,12pt]{article} \usepackage[compat=1.1.0]{tikz-feynman} \usepackage{xcolor} \definecolor{uctgreen}{rgb}{0,0.45,0} \newcommand\uct[0]{{\color{uctgreen}{u}\color{red}{c}\color{blue}{t}}} \tikzfeynmanset{ every diagram={very thick}, } \begin{document} \resizebox{5cm}{5cm}{ \begin{tikzpicture}[yscale=0.7, xscale=1.4] \begin{feynman} % ~~~ defining the vertices ~~~~~~ \vertex (i1) ; \vertex[below right=of i1] (v1); \vertex[ right=of v1] (v2); \vertex[above right=of v2] (o1); % ~~~ Z-related ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \vertex at ($(v1)!.5!(v2) - (0,15mm)$) (v3); % middle, below \vertex[below=1cm of v3] (v4); % <<< Z "length" % ~~~ lower part ~~~~~~~~~~~~~~ \vertex[below left = 2cm of v4] (i2); % one way to modify \vertex[below right= 2cm of v4] (o2); % ~~~ drawing this diagram ~~~~~~~~~~~~~~~~~~~~~ \diagram*{ {[edges={fermion}](i1) --[edge label=s] (v1) --[edge label=\uct] (v2) --[edge label=d] (o1)}, (v1) --[photon, half right, edge label'=W] (v2), (v3) --[photon, edge label'=Z] (v4), {[edges={fermion}](i2) --[edge label'=$\nu$] (v4) --[edge label'=$\nu$] (o2)}, }; \end{feynman} \end{tikzpicture} } \end{document} produces this: How can I add labels to both sides of the W and make the W-Z vertex match up?
- Is it possible simplify this lualatex code?by xcn on January 23, 2026 at 8:39 am
The following code is used to retrieve and round a variable defined via \directlua. Is it possible to remove the luaround function and replace {\IfValueTF{#1} {luaround(#2, #1)} {#2}} with something like {\IfValueTF{#1} {("%." .. #1 .. "f"):format(#2)} {#2}}? \documentclass[12pt]{article} \usepackage{luacode} \begin{luacode*} function luaround(x, n) return string.format('%.' .. n .. 'f', x ) end \end{luacode*} \NewExpandableDocumentCommand{\usevar}{om}{% \directlua{tex.sprint(% {\IfValueTF{#1} {luaround(#2, #1)} {#2} } % IfValueTF )} } \begin{document} \directlua{ x=0.345 y=2 } \usevar[2]{x} \end{document}
- hyperref + algorithm2e + zref-clever = 🐛: referencing an algorithm and a line in it produces the same type name for both 😢by Mark McGregor on January 22, 2026 at 7:11 pm
We try to reference a line in a shy algorithm and the algorithm itself with zref-clever. Running pdflatex twice on \documentclass{article} \pagestyle{empty} \usepackage{hyperref} \usepackage{algorithm2e} \usepackage{zref-clever} \zcRefTypeSetup{algocf}{ name-sg=Alg.\@, Name-sg=Alg.\@ } \zcRefTypeSetup{AlgoLine}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{algocfline}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{line}{ Name-sg=line, name-sg=line } \begin{document} \begin{algorithm}\LinesNumbered \caption{My great algorithm}\label{algLabel} \KwOut{The oh so great output of my great algorithm} command1\; command2\nllabel{lineLabel}\; command3 \end{algorithm} \zcref[S]{algLabel} contains \zcref{lineLabel}. \end{document} yields As we see, the second type name is “Alg.”, whereas we'd expect “line”. If we comment out hyperref, we get “Alg. 1 contains line 2.” as expected. So far we failed to get different type names for the two references in the presence of hyperref, so you can blame it. At the same time, given that algorithm2e has been unmaintained for about 8½ years and zref-clever for slightly over 1 year, you can blame them, too. Anyway, what is the technical root cause of the failure? Any bugfix, patch, or workaround?
- Unexpected tabular vertical alignmentby itobito on January 22, 2026 at 4:52 pm
I'm having a difficult time understanding the vertical alignment of columns of tables created via tabular. My Code \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{ | p{2.5cm} | m{2.5cm}| b{2.5cm} | } \hline cell1 dummy text dummy text dummy text& cell2 & cell3 \\ \hline cell4 & cell5 dummy text dummy text dummy text & cell6 \\ \hline cell7 & cell8 & cell9 dummy text dummy text dummy text\\ \hline \end{tabular} \end{document} This example is pretty much taken directly from the Overleaf Tables documentation, with the difference being the varying column alignments. I'd expect the code above to produce Expected table with the text in the first column top-aligned, the text in the second column middle-aligned, and the text in the third column bottom-aligned. However, the code above actually produces Actual table I know it's possible (and easier) with the tabularray package, but I'd like to understand why. Why do my actual table's columns have seemingly incorrect vertical alignments?
- Plotting a rational function in tikzby mf67 on January 21, 2026 at 9:17 pm
I'm trying to plot a rational function, but I constantly get dimensions too large, even if the plot frame is within the page and the function is within limits. \documentclass{book} \usepackage{pgf,tikz,pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{tikzpicture}[declare function={r(\x)=(-\x*\x*\x*\x+600*\x*\x*\x-135000*\x*\x+10125000*\x)/(2109375*(30000-200*\x));}] \begin{axis}[ x=0.05cm,y=1cm, xmin=0, xmax=160, ymin=0, ymax=1, xlabel={\(x\)}, ylabel={\(y\)} ] \draw[domain=0:160,smooth,samples=100] plot ({\x},{r(\x)}); \end{axis} \end{tikzpicture} \end{document} What could be wrong? TIA. This is how the graph looks in Mathematica
- 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 workby Zarko on January 21, 2026 at 9:36 am
I'm curious, why second example in the following MWE doesn't works. Well, I can leave with first example, but anyway ... I'd rather prefer to use the second one. \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, node contents={} }, ] % first example: works fine \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some long one line text] {} (0,2); % second example: gives error "Cannot parse this coordinate." \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] (0,2); \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] {} (0,2); \end{tikzpicture} \end{document} Result of the first example is: Addendum: However, if I move inserting of node after drawing a path: \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, color=blue, node contents={} }, every pin/.add style = {}{blue}, ] \draw[Jvmes=4mm/red] (0,0) -- (0,2) node [Npin=4mm/left:some text, pos=0.5]; \end{tikzpicture} \end{document} than it works as expected: I hope that Henri Menke will extend his comment (which help me understand what is going on at my examples) to an answer.
- How to change color of equals sign without disturbing alignment?by Arya1050 on January 21, 2026 at 8:42 am
\documentclass{beamer} \begin{document} \begin{frame} \begin{align*} A &= B \\ &\textcolor{blue}{=} C \end{align*} \end{frame} \end{document} I want the last equals sign to be colored blue, but this code disrupts the alignment. It also brings the 'C' closer to the equals sign. How can I fix this? ChatGPT turned out to be of no help. Note: I don't have any particular purpose for doing this. I was just experimenting out of curiosity on my actual slides. Just wanted to see if this problem could be solved in any case.
- alignment of diagrams in xy-picby Olga on January 20, 2026 at 7:10 pm
I'm learning to draw commutative diagrams using the xy-pic package. I don’t know how to insert pictures on this forum yet, so I’ll write what I got with xymatrix: \documentclass[12pt,reqno]{report} \usepackage[all,cmtip]{xy} \usepackage[T1]{fontenc} \usepackage[russian]{babel} \begin{document} $$\xymatrix{% Z \ar@{-->}[r]_h \ar `u/8pt[r] `[rr]^{g} [rr] & \displaystyle Y \ar[r]_f & X }$$ $$\xymatrix{% F(Z) \ar[r]_{\alpha} \ar `u/8pt[r] `[rr]^{F(g)} [rr] & \displaystyle F(Y) \ar[r]_{\beta} & F(X) }$$ \end{document} I would like to align both charts in width and and want to turn the ends of the arrows $g$ and $F(g),$ respectively, towards $X$ and $F(X).$ Edit. Here's what I got with your help:
- Drawing a thick arrow with different fill and outline colorsby aaragon on January 20, 2026 at 11:46 am
Drawing this type of arrow turned out to be quite complex. I looked at the macro in this post and modified accordingly so that I get the shape I want. However, that macro only prints a single color arrow and it looks painfully difficult to modify to get what I want. Therefore, I thought that I would "emulate" the result by printing two superposed arrows, an original one and one scaled slightly so as to mimic that I have a different border color. This is what I have so far: \documentclass{standalone} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{calc, arrows.meta, bending} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \makeatletter \tikzset{ ararrow/.default={open}{open}, ararrow/.code 2 args={% \tikz@addoption{% \pgfset{tips=true}% draw tips even if the path isn't. \pgfgetpath\currentpath \pgfprocessround{\currentpath}{\currentpath}% \pgf@decorate@parsesoftpath{\currentpath}{\currentpath}% \pgfsetarrowsstart{% Triangle[bend, length=1.*(\pgf@decorate@totalpathlength), width =0.08*(\pgf@decorate@totalpathlength), % <-- added line join=round,#1] } \pgfsetarrowsend{% Stealth[ angle'=60, length=0.22*(\pgf@decorate@totalpathlength), width =0.26*(\pgf@decorate@totalpathlength), line join=round,#2]}% \tikz@mode@drawfalse % disable drawing of path } }, ararrow **/.style={ararrow={}{}}, ararrow oo/.style={ararrow={open}{open}}, ararrow *o/.style={ararrow={}{open}}, ararrow o*/.style={ararrow={open}{}}, } \makeatother \begin{document} \begin{tikzpicture} \coordinate (P) at (0,0); \coordinate (Q) at (1,1); \coordinate (C) at ($(P)!0.5!(Q)$); % outer arrow \draw[blue, ararrow **] (P) to[bend left=45] (Q); % inner arrow: same curve, scaled about C \begin{scope}[ shift={(C)}, scale=0.9, shift={($-1*(C)$)} ] \draw[yellow, ararrow **] (P) to[bend left=45] (Q); \end{scope} \end{tikzpicture} \end{document} which produces the image you see. Ideally, it would be great if the macro can be modified to get what I need so the user can simply type: \draw[draw=blue, fill=yellow, ararrow **] (P) to[bend left=45] (Q);
- Automatically reserve space at bottom of second column on first page in twocolumn articleby Srikanth Mohankumar on January 20, 2026 at 9:33 am
I need to automatically reserve empty space at the bottom of the second column on the first page only in a two-column article. This space will be used later for stamping a thumbnail image during PDF post-processing. Requirements: Only affect the first page, second column Reserve approximately 100pt of blank space at the bottom of the column The text in the second column should be shorter to leave this space empty First column should remain at normal height Should be automatic (no manual commands in document body) Must work with LuaLaTeX (TeX Live 2025) I've tried various approaches with @opcol and @outputdblcol but they either create space at the top instead of bottom, or affect all pages instead of just the first page. \documentclass[twocolumn]{article} \usepackage{lipsum} \makeatletter % Need solution here to reserve 100pt at bottom of second column on page 1 \makeatother \begin{document} \title{Sample Document} \author{Author Name} \maketitle \lipsum[1-20] \end{document} Expected result: The second column on page 1 should have normal text at the top, but stop 100pt before the bottom, leaving that space blank for later thumbnail insertion. What I've tried:I attempted using \afterpage with \footnotetext to create the reserved space: \afterpage{\footnotetext{\fbox{\vbox to 100pt{second column reserved space}}}} This works well for short paragraphs, but fails when long paragraphs continue onto the second page - the reserved space appears on the wrong page. I've also tried various approaches with @opcol and @outputdblcol hooks, but they either create space at the top instead of bottom, or affect all pages instead of just the first page. MWE: \documentclass[fleqn,twocolumn]{article} \usepackage{lipsum} \usepackage{afterpage} \makeatletter % Need solution here to reserve 100pt at bottom of second column on page 1 \makeatother \title{Sample} \author{John Doe} \begin{document} \maketitle % This approach fails with long paragraphs \afterpage{\footnotetext{\fbox{\vbox to 100pt{second column reserved space}}}} \begin{abstract} \lipsum[2] \end{abstract} \section{Introduction} Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. Based on prior theoretical literature on gender differences in ambiguity aversion, we put to the test the hypothesis that female workers are more prone to compete when the structural ambiguity of bidding situations is reduced in an online-work setting. \footnote{Number test.} \end{document}