Hot
- Rendering tikz code as an image in a separate file, then using \includegraphics in the main file, whilst complying with PDF/UAby Carsten Yeung on September 18, 2025 at 4:57 am
I'm typing some lecture notes in LaTeX, and I want the document to be accessible (PDF/UA compliant). Extra guidance on LaTeX PDF-accessibility would be helpful. My main point of concern is with figures, namely tikz pictures. Right now I have separate files containing only a block tikz code (i.e. they are not meant to be compiled as PDF on their own). Here is the code for one of the pictures (called 1-Robot_arm.tex): \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,499); %set diagram left start at 0, and has height of 499 %Shape: Rectangle [id:dp7996705832338366] \draw [fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (292,271.57) -- (418.85,271.57) -- (418.85,292.03) -- (292,292.03) -- cycle ; %Shape: Triangle [id:dp46766492743083177] \draw (354.27,240.74) -- (372.57,271.05) -- (335.97,271.05) -- cycle ; %Shape: Ellipse [id:dp7340933088598973] \draw (349.44,235.75) .. controls (349.44,232.99) and (351.61,230.75) .. (354.27,230.75) .. controls (356.94,230.75) and (359.1,232.99) .. (359.1,235.75) .. controls (359.1,238.5) and (356.94,240.74) .. (354.27,240.74) .. controls (351.61,240.74) and (349.44,238.5) .. (349.44,235.75) -- cycle ; %Shape: Ellipse [id:dp005973911761530171] \draw (415.53,188.09) .. controls (415.53,185.33) and (417.69,183.1) .. (420.36,183.1) .. controls (423.02,183.1) and (425.19,185.33) .. (425.19,188.09) .. controls (425.19,190.85) and (423.02,193.08) .. (420.36,193.08) .. controls (417.69,193.08) and (415.53,190.85) .. (415.53,188.09) -- cycle ; %Shape: Ellipse [id:dp11916740467785225] \draw (480.84,219.07) .. controls (480.84,216.31) and (483,214.07) .. (485.67,214.07) .. controls (488.34,214.07) and (490.5,216.31) .. (490.5,219.07) .. controls (490.5,221.82) and (488.34,224.06) .. (485.67,224.06) .. controls (483,224.06) and (480.84,221.82) .. (480.84,219.07) -- cycle ; %Shape: Ellipse [id:dp5089566248001661] \draw (535.4,159.49) .. controls (535.4,156.74) and (537.56,154.5) .. (540.23,154.5) .. controls (542.9,154.5) and (545.06,156.74) .. (545.06,159.49) .. controls (545.06,162.25) and (542.9,164.49) .. (540.23,164.49) .. controls (537.56,164.49) and (535.4,162.25) .. (535.4,159.49) -- cycle ; %Straight Lines [id:da24129898895388247] \draw (358.74,232) -- (415.6,190.7) ; %Straight Lines [id:da7156324427284178] \draw (424.83,189.9) -- (481.69,216.12) ; %Straight Lines [id:da3344673958665092] \draw (488.6,215.32) -- (537.78,162.9) ; %Shape: Rectangle [id:dp7997395567781902] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (573,274.57) -- (699.85,274.57) -- (699.85,295.03) -- (573,295.03) -- cycle ; %Shape: Triangle [id:dp8751414593827821] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (635.27,243.74) -- (653.57,274.05) -- (616.97,274.05) -- cycle ; %Shape: Ellipse [id:dp397369418775106] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (630.44,238.75) .. controls (630.44,235.99) and (632.61,233.75) .. (635.27,233.75) .. controls (637.94,233.75) and (640.1,235.99) .. (640.1,238.75) .. controls (640.1,241.5) and (637.94,243.74) .. (635.27,243.74) .. controls (632.61,243.74) and (630.44,241.5) .. (630.44,238.75) -- cycle ; %Shape: Ellipse [id:dp8015587667504429] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (696.53,191.09) .. controls (696.53,188.33) and (698.69,186.1) .. (701.36,186.1) .. controls (704.02,186.1) and (706.19,188.33) .. (706.19,191.09) .. controls (706.19,193.85) and (704.02,196.08) .. (701.36,196.08) .. controls (698.69,196.08) and (696.53,193.85) .. (696.53,191.09) -- cycle ; %Shape: Ellipse [id:dp9016528494432301] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (761.84,222.07) .. controls (761.84,219.31) and (764,217.07) .. (766.67,217.07) .. controls (769.34,217.07) and (771.5,219.31) .. (771.5,222.07) .. controls (771.5,224.82) and (769.34,227.06) .. (766.67,227.06) .. controls (764,227.06) and (761.84,224.82) .. (761.84,222.07) -- cycle ; %Shape: Ellipse [id:dp4603779754744257] \draw (816.4,162.49) .. controls (816.4,159.74) and (818.56,157.5) .. (821.23,157.5) .. controls (823.9,157.5) and (826.06,159.74) .. (826.06,162.49) .. controls (826.06,165.25) and (823.9,167.49) .. (821.23,167.49) .. controls (818.56,167.49) and (816.4,165.25) .. (816.4,162.49) -- cycle ; %Straight Lines [id:da8780549111571742] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (639.74,235) -- (696.6,193.7) ; %Straight Lines [id:da9661299447896011] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (705.83,192.9) -- (762.69,219.12) ; %Straight Lines [id:da968665704316749] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (769.6,218.32) -- (818.78,165.9) ; %Straight Lines [id:da875843748729442] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (641,239) -- (706,239) ; %Straight Lines [id:da962155566323262] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (706,187) -- (764.5,142) ; %Straight Lines [id:da5621792793143086] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (771,224) -- (831.5,253) ; %Curve Lines [id:da962296076111877] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (687,237) .. controls (687.97,237) and (690.82,225.71) .. (680.04,210.43) ; \draw [shift={(679,209)}, rotate = 53.13] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da056932981651514614] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (797.5,237) .. controls (797.5,237.97) and (803.15,217.3) .. (789.79,202.37) ; \draw [shift={(788.5,201)}, rotate = 45] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da7809394891991979] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (733.5,168) .. controls (733.5,168.97) and (742.91,182.17) .. (736.17,202.13) ; \draw [shift={(735.5,204)}, rotate = 290.85] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; % Text Node \draw (332,214.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$O$}; % Text Node \draw (400,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 17; green, 1; blue, 1 } ,opacity=1 ] {$A$}; % Text Node \draw (493,223.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 19; green, 1; blue, 1 } ,opacity=1 ] {$B$}; % Text Node \draw (550,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$C$}; % Text Node \draw (693,212.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 24; green, 2; blue, 2 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{\alpha _{1}}$}; % Text Node \draw (741,167.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.11,0,0}{\alpha _{2}}$}; % Text Node \draw (806,204.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.06,0,0}{\alpha _{3}}$}; % Text Node \draw (745,192.4) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize,color={rgb, 255:red, 241; green, 16; blue, 16 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{-}$}; % Text Node \draw (652,193.4) node [anchor=north west][inner sep=0.75pt] {$l_{1}$}; % Text Node \draw (729,208.4) node [anchor=north west][inner sep=0.75pt] {$l_{2}$}; % Text Node \draw (784,167.4) node [anchor=north west][inner sep=0.75pt] {$l_{3}$}; \end{tikzpicture} and I insert them into the main document like this: \DocumentMetadata{ lang=en, uncompress, testphase=phase-III, pdfstandard = ua-1, pdfversion = 1.7 } \documentclass{article} \usepackage{amsmath, amssymb, enumerate, framed, multicol, tikz, amsthm, multirow, microtype,comment,float,verbatim,cancel} \usepackage[mode=buildnew]{standalone} \usepackage[margin=1in]{geometry} \usepackage[hidelinks]{hyperref} \usepackage{graphicx} \usetikzlibrary{matrix, positioning} \usetikzlibrary{calc} \usepackage{tagpdf} \tagpdfsetup{tabsorder=structure} \hypersetup{ pdflang={en-US}, pdftitle={Robot Kinematics and Dynamics Notes}, pdfdisplaydoctitle=true, pdfauthor={Carsten}, pdfsubject={Robot Kinematics and Dynamics}, pdfkeywords={Accessibility, LaTeX} } \begin{document} \begin{center} \input{1-Robot_arm} \end{center} \end{document} Inserting figures like this, and writing everything else up as normal, allowed the generated PDF to pass PAC (PDF Accessibility Checker) requirements. However, instead of directly inputting tikz code into my main document, I want to render the tikz pictures as separate PDFs, and use \includegraphics in the figure environment (so I can reference them) in the main document to display the picture. Note that just wrapping the \input{1-Robot_arm} in the figure environment gives a "no bounding box" error in PAC. I referred to this StackExchange post 'Standalone' TikZ pictures and tried applying it to my own code with the figure environment and adding alt-text (compiling with LuaLaTeX). The 1-Robot_arm.tex file: \documentclass[crop,tikz]{standalone} \begin{document} \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,499); %set diagram left start at 0, and has height of 499 %Shape: Rectangle [id:dp7996705832338366] \draw [fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (292,271.57) -- (418.85,271.57) -- (418.85,292.03) -- (292,292.03) -- cycle ; %Shape: Triangle [id:dp46766492743083177] \draw (354.27,240.74) -- (372.57,271.05) -- (335.97,271.05) -- cycle ; %Shape: Ellipse [id:dp7340933088598973] \draw (349.44,235.75) .. controls (349.44,232.99) and (351.61,230.75) .. (354.27,230.75) .. controls (356.94,230.75) and (359.1,232.99) .. (359.1,235.75) .. controls (359.1,238.5) and (356.94,240.74) .. (354.27,240.74) .. controls (351.61,240.74) and (349.44,238.5) .. (349.44,235.75) -- cycle ; %Shape: Ellipse [id:dp005973911761530171] \draw (415.53,188.09) .. controls (415.53,185.33) and (417.69,183.1) .. (420.36,183.1) .. controls (423.02,183.1) and (425.19,185.33) .. (425.19,188.09) .. controls (425.19,190.85) and (423.02,193.08) .. (420.36,193.08) .. controls (417.69,193.08) and (415.53,190.85) .. (415.53,188.09) -- cycle ; %Shape: Ellipse [id:dp11916740467785225] \draw (480.84,219.07) .. controls (480.84,216.31) and (483,214.07) .. (485.67,214.07) .. controls (488.34,214.07) and (490.5,216.31) .. (490.5,219.07) .. controls (490.5,221.82) and (488.34,224.06) .. (485.67,224.06) .. controls (483,224.06) and (480.84,221.82) .. (480.84,219.07) -- cycle ; %Shape: Ellipse [id:dp5089566248001661] \draw (535.4,159.49) .. controls (535.4,156.74) and (537.56,154.5) .. (540.23,154.5) .. controls (542.9,154.5) and (545.06,156.74) .. (545.06,159.49) .. controls (545.06,162.25) and (542.9,164.49) .. (540.23,164.49) .. controls (537.56,164.49) and (535.4,162.25) .. (535.4,159.49) -- cycle ; %Straight Lines [id:da24129898895388247] \draw (358.74,232) -- (415.6,190.7) ; %Straight Lines [id:da7156324427284178] \draw (424.83,189.9) -- (481.69,216.12) ; %Straight Lines [id:da3344673958665092] \draw (488.6,215.32) -- (537.78,162.9) ; %Shape: Rectangle [id:dp7997395567781902] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (573,274.57) -- (699.85,274.57) -- (699.85,295.03) -- (573,295.03) -- cycle ; %Shape: Triangle [id:dp8751414593827821] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (635.27,243.74) -- (653.57,274.05) -- (616.97,274.05) -- cycle ; %Shape: Ellipse [id:dp397369418775106] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (630.44,238.75) .. controls (630.44,235.99) and (632.61,233.75) .. (635.27,233.75) .. controls (637.94,233.75) and (640.1,235.99) .. (640.1,238.75) .. controls (640.1,241.5) and (637.94,243.74) .. (635.27,243.74) .. controls (632.61,243.74) and (630.44,241.5) .. (630.44,238.75) -- cycle ; %Shape: Ellipse [id:dp8015587667504429] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (696.53,191.09) .. controls (696.53,188.33) and (698.69,186.1) .. (701.36,186.1) .. controls (704.02,186.1) and (706.19,188.33) .. (706.19,191.09) .. controls (706.19,193.85) and (704.02,196.08) .. (701.36,196.08) .. controls (698.69,196.08) and (696.53,193.85) .. (696.53,191.09) -- cycle ; %Shape: Ellipse [id:dp9016528494432301] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (761.84,222.07) .. controls (761.84,219.31) and (764,217.07) .. (766.67,217.07) .. controls (769.34,217.07) and (771.5,219.31) .. (771.5,222.07) .. controls (771.5,224.82) and (769.34,227.06) .. (766.67,227.06) .. controls (764,227.06) and (761.84,224.82) .. (761.84,222.07) -- cycle ; %Shape: Ellipse [id:dp4603779754744257] \draw (816.4,162.49) .. controls (816.4,159.74) and (818.56,157.5) .. (821.23,157.5) .. controls (823.9,157.5) and (826.06,159.74) .. (826.06,162.49) .. controls (826.06,165.25) and (823.9,167.49) .. (821.23,167.49) .. controls (818.56,167.49) and (816.4,165.25) .. (816.4,162.49) -- cycle ; %Straight Lines [id:da8780549111571742] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (639.74,235) -- (696.6,193.7) ; %Straight Lines [id:da9661299447896011] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (705.83,192.9) -- (762.69,219.12) ; %Straight Lines [id:da968665704316749] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (769.6,218.32) -- (818.78,165.9) ; %Straight Lines [id:da875843748729442] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (641,239) -- (706,239) ; %Straight Lines [id:da962155566323262] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (706,187) -- (764.5,142) ; %Straight Lines [id:da5621792793143086] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (771,224) -- (831.5,253) ; %Curve Lines [id:da962296076111877] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (687,237) .. controls (687.97,237) and (690.82,225.71) .. (680.04,210.43) ; \draw [shift={(679,209)}, rotate = 53.13] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da056932981651514614] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (797.5,237) .. controls (797.5,237.97) and (803.15,217.3) .. (789.79,202.37) ; \draw [shift={(788.5,201)}, rotate = 45] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da7809394891991979] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (733.5,168) .. controls (733.5,168.97) and (742.91,182.17) .. (736.17,202.13) ; \draw [shift={(735.5,204)}, rotate = 290.85] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; % Text Node \draw (332,214.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$O$}; % Text Node \draw (400,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 17; green, 1; blue, 1 } ,opacity=1 ] {$A$}; % Text Node \draw (493,223.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 19; green, 1; blue, 1 } ,opacity=1 ] {$B$}; % Text Node \draw (550,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$C$}; % Text Node \draw (693,212.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 24; green, 2; blue, 2 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{\alpha _{1}}$}; % Text Node \draw (741,167.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.11,0,0}{\alpha _{2}}$}; % Text Node \draw (806,204.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.06,0,0}{\alpha _{3}}$}; % Text Node \draw (745,192.4) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize,color={rgb, 255:red, 241; green, 16; blue, 16 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{-}$}; % Text Node \draw (652,193.4) node [anchor=north west][inner sep=0.75pt] {$l_{1}$}; % Text Node \draw (729,208.4) node [anchor=north west][inner sep=0.75pt] {$l_{2}$}; % Text Node \draw (784,167.4) node [anchor=north west][inner sep=0.75pt] {$l_{3}$}; \end{tikzpicture} \end{document} And main.tex: \DocumentMetadata{ lang=en, uncompress, testphase=phase-III, pdfstandard = ua-1, pdfversion = 1.7 } \documentclass{article} \usepackage{amsmath, amssymb, enumerate, framed, multicol, tikz, amsthm, multirow, microtype,comment,float,verbatim,cancel} \usepackage[mode=buildnew]{standalone} \usepackage[margin=1in]{geometry} \usepackage[hidelinks]{hyperref} \usepackage{graphicx} \usetikzlibrary{matrix, positioning} \usetikzlibrary{calc} \usepackage{tagpdf} \tagpdfsetup{tabsorder=structure} \hypersetup{ pdflang={en-US}, pdftitle={Robot Kinematics and Dynamics Notes}, pdfdisplaydoctitle=true, pdfauthor={Carsten}, pdfsubject={Robot Kinematics and Dynamics}, pdfkeywords={Accessibility, LaTeX} } \begin{document} \begin{figure}[H] \centering \includegraphics[width=\linewidth, alt={Robot arm schematic}]{1-Robot_arm.tex} \end{figure} \end{document} But putting it through PAC receives the "Characters in text object cannot be mapped to unicode" error. Whilst constructing this minimal-working example (the above two code blocks) in a new project, I ran the main PDF through PAC, and it strangely passed all criteria, even though I effectively copied-and-pasted the code from my original project. So, this problem can be caused by something else in the main document, but I don't know what.
- Custom section title exampleby Ghassan Hamad on September 18, 2025 at 3:24 am
I need some help writing a code that reproduces the attached design. My tried is: \documentclass{standalone} \usepackage{tcolorbox} \usepackage{polyglossia} \setmainlanguage[numerals=maghrib]{arabic} \setotherlanguage{english} \newfontfamily\arabicfont[Script=Arabic,Scale=1.0]{Simplified Arabic} \begin{document} \begin{tcolorbox}[colback=cyan!20, colframe=cyan!20] تقويم على الباب الاول؟ \end{tcolorbox} \end{document}
- How to fix different captions line spacings inside of tikzposterby Théodore Targerian on September 18, 2025 at 2:07 am
I have no idea why each image capt has a different line spacing. Section of the image: \begin{subcolumns} \subcolumn{0.48} \block{}{ \begin{tikzfigure}[Árvore de contextos de uma CEMAV de ordem 10, contextos que proibem transições destacados.\label{arvore}] \fontsize{15}{15}\selectfont{ \begin{forest} %BIG FOREST OBJECT (10 LEVELS), WORKING FINE. \end{forest} } \end{tikzfigure}} \subcolumn{0.52} \block{}{ \begin{tikzfigure}[Esqueleto da CEMAV, ordem 3, contextos que proibem transições destacados.\label{skel}] \centering \fontsize{28}{29}\selectfont{ \begin{forest} %SMALLER FOREST, ALSO FINE \end{forest}} \end{tikzfigure}} \block{}{\centering \begin{tikzfigure}[Matriz de transição do esqueleto, transições com probabilidade positiva em vermelho.\label{matriz}] \includegraphics[width=0.2\textwidth]{Imagens/esqueleto_1.pdf} \end{tikzfigure} } \end{subcolumns} I am using tikzposter with these relevant configurations: \documentclass[25pt, a0paper, portrait, margin=1mm, innermargin=7mm, blockverticalspace=1mm, colspace=0mm, subcolspace=0mm]{tikzposter} \defineblockstyle{Minimal}{ titlewidthscale=1, bodywidthscale=1, titleleft, titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt, bodyverticalshift=0pt, roundedcorners=0, linewidth=0pt }{ \draw[draw=none, fill=none] (blocktitle.south west) rectangle (blocktitle.north east); \draw[draw=none, fill=none] (blockbody.south west) rectangle (blockbody.north east); } \useblockstyle{Minimal}
- Different subtitle-seprator for multiple languages other than Englishby glenncounty on September 18, 2025 at 1:28 am
I include articles and books written in many languages in my paper. The main language is English. I want to use . separator instead of :, between title and subtitle, for German and Danish langid. I tried the following example, but the second \renewcommand overrides the first one. Is there any possible solutions? If possible, ones that I can apply to multiple languages more than two. FYI, I use windows 10 pro x64, texlive 2025, lualatex. Here is the MWE. % !TeX TS-program = lualatex \documentclass[letterpaper,12pt]{article} \usepackage[german, danish, main=english, provide*=*]{babel} \usepackage[backend=biber]{biblatex-chicago} \renewcommand*{\subtitlepunct}{% \iffieldequalstr{langid}{german}% {\addperiod\space}% (when true) use a period for German entries {\addcolon\space}}% (when false) use a colon for all other entries \renewcommand*{\subtitlepunct}{% \iffieldequalstr{langid}{danish}% {\addperiod\space}% (when true) use a period for German entries {\addcolon\space}}% (when false) use a colon for all other entries \begin{filecontents}{\jobname.bib} @Book{Author1, Author = {German, Greg G.}, Year = {2012}, Title = {Title G}, subtitle = {subtitle G}, address = {adrs G}, publisher = {pub G}, langid = {german} } @Book{Author2, Author = {Danish, David D.}, Year = {2015}, Title = {Title D}, subtitle = {subtitle D}, address = {adrs D}, publisher = {pub D}, langid = {danish} } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} text1\autocite[][1]{Author1} text2\autocite[][2]{Author2} text3\autocite[][3]{Author1} text4\autocite[][4]{Author2} \end{document}
- An enumeration with apostrophesby Leandro Caniglia on September 17, 2025 at 11:31 pm
I'm trying to set up an enumeration that would produce two items P_3' and P_3''. My attempt \usepackage[shortlabels]{enumitem} \newcommand{\apostrophes}[1]{% \ifcase\numexpr#1\relax \or ' \or '' \or ''' \or '''' \or '''''% \else '''''\fi} \begin{enumerate}[label={p$_3$\apostrophes{\arabic*}},font=\scshape] \item \label{P3'} \item \label{P3''} \end{enumerate} so that I can then refer to the items with \newcommand{\Ptprime}{{\upshape\textsc{\ref{P3'}}}} \newcommand{\Ptdprime}{{\upshape\textsc{\ref{P3''}}}} However, I get a "missing number, treated as zero" error message. I've also tried \arabic{\value{enumi}}' and \arabic{\theenumi}' without luck (same error). How should I change my code, please? Compilable version \documentclass{article} \usepackage[shortlabels]{enumitem} \newcommand{\apostrophes}[1]{% \ifcase\numexpr#1\relax \or ' \or '' \or ''' \or '''' \or '''''% \else '''''\fi} \newcommand{\Ptprime}{{\upshape\textsc{\ref{P3'}}}} \newcommand{\Ptdprime}{{\upshape\textsc{\ref{P3''}}}} \begin{document} \begin{enumerate}[label={p$_3$\apostrophes{\arabic*}},font=\scshape] \item \label{P3'} There are four points in general position. \item \label{P3''} The incidence relation is not empty. \end{enumerate} The first item is number \Ptprime. The second item is number \Ptdprime. \end{document}
- Package `mylatexformat` known bad for lualatex (linux) pre-2022. Anything recent?by rallg on September 17, 2025 at 6:59 pm
The mylatexformat package was last updated in 2011, for MiKTeX on Windows. User feedback (found on this forum) indicates that it fails for LuaLaTeX both due to Lua code and OpenType fonts. Linux may also have a problem. But the most recent posts are pre-2022 LaTeX revisions. Has anything evolved in recent years, that would enable mylatexformat (or something similar) for LuaLaTeX, using OpenType fonts, on Linux? If the answer is no, then simply put it as a comment, so I can delete this question. I use a lot of arcane custom code, and custom fonts, so failure for me does not necessarily imply failure for other users.
- Define counters using a loopby Subhajit Paul on September 17, 2025 at 5:32 pm
I am preparing a template for a question paper in which the syllabus units are indicated alongside each question. Subsequently, I would like to generate a table showing the number of questions and the total marks corresponding to each unit. Since the number of units may vary depending on the course, I have defined \numunits as a variable. However, I am having difficulty creating the counters dynamically. Below is a MWE of my attempt. Any guidance would be greatly appreciated. \documentclass{exam} \newcommand\numunits[1]{\newcommand\zzunit{#1}} \numunits{3} \usepackage{tikz} \foreach \n in {1,...,\zzunit}{ \newcounter\csname unitmarks\expandafter{\romannumeral\n}\endcsname \newcounter\csname unitqn\expandafter{\romannumeral\n}\endcsname } \newcommand{\Unit}[2]{% \addtocounter{unitmarks\uppercase\expandafter{\romannumeral #1}}{#2} \refstepcounter{unitqn\uppercase\expandafter{\romannumeral #1}} } \begin{document} \begin{questions} \question \Unit{1}{2} First qn. \question \Unit{2}{3} Second qn. \question \Unit{3}{4} Third qn. \question \Unit{1}{5} Fourth qn. \end{questions} \begin{tabular}{| c | c | c |} \hline \foreach \n in {1,...,\zzunit}{ Unit \n & \theunitqn\expandafter{\romannumeral \n} & \theunitmarks\expandafter{\romannumeral \n}\\ \hline } \end{tabular} \end{document}
- How to achieve a constant A4 page width, a variable page height, constant margins, and KOMA-Script-like headers/footers in a scrbook/standalone class?by Amanuensis Frances on September 17, 2025 at 4:20 pm
For context, I usually write long-form documents in LaTeX with a package bundle of my own macros for (but not entirely exclusively requiring) the scrbook document class. I intend to start writing modular mathematics notes in LaTeX with a workflow similar to my usual scrbook setup but with the goal for my typeset notes to have: a constant A4-page-width (595.276pt), a variable page-height (not unlike standalone), constant margins, and also KOMA-Script-like headers/footers (including scrlayer-scrpage features). So far I've attempted the following solution (with standalone since I don't know how to achieve a variable page-height with scrbook) which, I believe, satisfies (only) the first three points of the above. % !TEX program = lualatex \documentclass[% border={10pt 10pt 10pt 10pt}, % left bottom right top multi=page ]{standalone} \usepackage{amsmath} \usepackage{blindtext} \usepackage{kantlipsum} \usepackage{setspace} % \usepackage{my-class-independent-macros} \begin{document} \begin{page}% % Somehow `\dimexpr 595.276pt - 10pt - 10pt\relax` returns a page width of % `596.37pt` according to `pdfinfo -box *.pdf | grep -E '(Page size:)|(Box)'` % so I hackily subtracted the difference to reach `574.178pt` \begin{minipage}{574.178pt} \onehalfspacing% \blindmathpaper% \end{minipage} \end{page} \begin{page}% \begin{minipage}{574.178pt} \onehalfspacing% \kant[1-2]% \end{minipage} \end{page} \end{document}
- How to customize inverse search for VSCode, LaTeX Workshop, and SumatraPDF: Ctrl+click trigger and line highlighting?by Riley on September 17, 2025 at 12:11 pm
Note: I originally posted this question on Stack Overflow. It was suggested that my question was off-topic there and I decided that this question would be a better fit for the TeX - LaTeX Stack Exchange community, so I am reposting it here. How to customize inverse search behavior (Ctrl+click, highlight) for VSCode LaTeX Workshop + SumatraPDF? I have successfully configured SyncTeX between VSCode (using the LaTeX Workshop extension) and an external SumatraPDF viewer. Both forward and inverse search are working correctly. Now, I would like to customize the inverse search behavior. My Current Configuration: Here are the relevant parts of my configuration files. The <My user name> placeholder is correct in my actual files. settings.json (in VSCode) { "latex-workshop.view.pdf.viewer": "external", "latex-workshop.view.pdf.external.viewer.command": "C:/Users/<My user name>/AppData/Local/SumatraPDF/SumatraPDF.exe", "latex-workshop.view.pdf.external.viewer.args": [ "-reuse-instance", "%PDF%" ], "latex-workshop.view.pdf.external.synctex.command": "C:/Users/<My user name>/AppData/Local/SumatraPDF/SumatraPDF.exe", "latex-workshop.view.pdf.external.synctex.args": [ "-forward-search", "%TEX%", "%LINE%", "-reuse-instance", "-inverse-search", "\"C:\\Users\\<My user name>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"C:\\Users\\<My user name>\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"", "%PDF%" ] } SumatraPDF-settings.txt ForwardSearch [ HighlightOffset = 0 HighlightWidth = 15 HighlightColor = #ff0707 HighlightPermanent = false ] InverseSearchCmdLine = "C:\\Users\\<My user name>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" "C:\\Users\\<My user name>\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js" --ms-enable-electron-run-as-node -r -g \"%f:%l\" My Questions: I would like to make two specific changes: 1. Change SumatraPDF's inverse search trigger from Double-Click to Ctrl + Click. By default, inverse search is triggered by a double-click in SumatraPDF. Is it possible to change this behavior to a Ctrl + Left Click action, similar to how many internal PDF viewers work? I couldn't find a setting for this. 2. Add a temporary highlight on the corresponding line in VSCode after inverse search. When an inverse search successfully jumps from the PDF to the .tex source file in VSCode, the cursor moves to the correct line. Is it possible to make VSCode briefly highlight that line (e.g., with a yellow background or a colored rectangle) to make the location more visible? I have already reviewed the following documentation but couldn't find a solution for these two points: LaTeX Workshop Wiki - Using SyncTeX with an external viewer SumatraPDF Documentation - Advanced Settings Any help would be appreciated.
- TikZ bounding box not calculated properly in standalone classby TheFox on September 17, 2025 at 10:37 am
I'm using tikz to create a figure with a ring and n nodes on it equally separated by an angle of 360° / n. Since I want the number of nodes to be arbitrary I defined a command which creates the tikzpicture: \newcommand{\drawfigure}[2]{% \def\n{#1} \begin{tikzpicture} \draw[dashed] (0,0) circle (\rring); \foreach \i in {0,...,\numexpr\n-1\relax}{ \pgfmathsetmacro{\angle}{360*\i/\n} \begin{scope}[shift={(\angle:\rring)}, rotate=\angle] \draw[fill=black!20] #2; \end{scope} } \end{tikzpicture} } where \rring is defined globally, the first argument is the number of nodes to create and the second the node to draw. For example if one wants circular/rectangular nodes he can pass as second argument the macro \nodecirc/\noderect: \def\nodecirc{% (0,0) circle (\rnode); } \def\noderect{% (-\rnode,-\rnode) rectangle (\rnode,\rnode); } The problem I stumbled across is related to the bounding box of tikzpictures for specific values of n, and only with the circular node. For example for n = 3 I obtain a white space above the upper node, but not below the lower one as in this picture (sorry for the white backgrounds, if I added a background color the bounding box would get bigger, just open the image in a new tab): a similar problem arises for n = 5: but not for n = 4: while as I said with the rectangular node everything works fine. The issue persists if I set the bounding box as \usetikzlibrary{bbox} \tikzset{% bezier bounding box } the only difference being now some nodes are cut off, for instance the lower one in the case n = 3: Here is a MWE: \documentclass[tikz]{standalone} %\usetikzlibrary{bbox} \tikzset{% %bezier bounding box } \def\rring{1} \def\rnode{0.4} \def\nodecirc{% (0,0) circle (\rnode); } \def\noderect{% (-\rnode,-\rnode) rectangle (\rnode,\rnode); } \newcommand{\drawfigure}[2]{% \def\n{#1} \begin{tikzpicture} \draw[dashed] (0,0) circle (\rring); \foreach \i in {1,...,\n}{ \pgfmathsetmacro{\angle}{360*\i/\n} \begin{scope}[shift={(\angle:\rring)}, rotate=\angle] \draw[fill=black!20] #2; \end{scope} } \end{tikzpicture} } \begin{document} \drawfigure{3}{\nodecirc} \drawfigure{4}{\nodecirc} \drawfigure{5}{\nodecirc} \drawfigure{3}{\noderect} \drawfigure{4}{\noderect} \drawfigure{5}{\noderect} \end{document} How can I solve the problem, possibly without setting manually the bounding box? Why does tikz behave like this, it shouldn't since every node is placed symmetrically with respect to the origin? EDIT: as suggested by @gernot the problem seems to be related to how the bounding box of each node is calculated. See these examples: for n = 3, and for n = 5, while in the case n = 4 every bounding box is computed correctly. The bounding boxes were drawn replacing the scope environment with: \begin{scope}[shift={(\angle:\rring)}, rotate=\angle, local bounding box=bbox] \draw[fill=black!20] #2; \end{scope} \draw[red] (bbox.south west) rectangle (bbox.north east); Still I don't understand where's the problem, and why symmetric nodes don't have symmetric bounding boxes...
- TeXstudio: only recompile a part, as nothing else has changedby Convexity on September 17, 2025 at 10:18 am
My TeXstudio file is huge. When I make changes on one page/segment only, I'd like to recompile it quickly. How? Criteria: I don't want to split the file into multiple files. Moreover, I'd prefer to have the whole file in the pdf. Therefore, "Preview" or \includeonly or the like is not the solution. However, I'd be fine with slight "bugs", such as the changes not affecting the other files even if they should (e.g., a changing theorem number on the one segment need not be updated elsewhere or vice versa). (After all, I can make a full compile when I'm ready with these small, quick edits and compiles.) Moreover, I'd be fine with me having to add some macros here and there, permanently and/or temporarily, etc. Additional question: is there a decent way TeXstudio could be improved to make this easy (by its developers)? It seems that very many people have roughly the same problem, so you can present several competing solutions. In the comments, I'll present myself below two "solutions" (inline "Preview" and \includeonly) that do not fill these criteria, so that others don't waste time in the same and so that some people might yet benefit of them.
- \hook_gput_code:nnn{begindocument/end}{.}{...} not taken into account if preceeded by another oneby Denis Bitouzé on September 17, 2025 at 10:05 am
(This question is a follow up of Spurious space before footnotemarks when both babel-french, fnpct and the reverse option of the latter are used) The answer was to add \setfnpct{before-footnote-space=0pt} after the \begin{document} and this can be done thanks to the \AddToHook{begindocument/end} hook: \documentclass[french]{article} \usepackage[paperwidth=5cm,paperheight=5cm]{geometry} \usepackage{babel} \usepackage{fnpct} \AddToHook{begindocument/end}{ \setfnpct{ before-footnote-space=0pt, reverse, } } \pagestyle{empty} \begin{document} \setfnpct{before-footnote-space=0pt} Foo\footnote{Bar.}\par\setcounter{footnote}{0} Foo\footnote{Bar.}. \end{document} This works pretty well, and even through a class thanks to \hook_gput_code:nnn {begindocument/end}{.}{...}: \begin{filecontents*}[overwrite]{myclass.cls} \ProvidesExplClass {myclass} {2025-09-16} {0.1} { My~Nice~Class. } % \hook_gput_code:nnn {begindocument/end}{.}{} % ← Uncomment to see the difference \LoadClass { article } \RequirePackage{fnpct} \RequirePackage[french]{babel} \hook_gput_code:nnn {begindocument/end}{.}{ % ← Hook with the code fixing the issue \setfnpct{ before-footnote-space=0pt, reverse, } } \end{filecontents*} \documentclass{myclass} \usepackage[paperwidth=5cm,paperheight=5cm]{geometry} \pagestyle{empty} \begin{document} Foo\footnote{Bar.}\par\setcounter{footnote}{0} Foo\footnote{Bar.}. \end{document} But what is strange is the following: if a (even empty) chunk of code is added to the same begindocument/end hook (see the line to be uncommented) before \RequirePackage{fnpct}, the one containing the code fixing the issue doesn't work anymore. As a workaround, one can label differently this hook: \hook_gput_code:nnn {begindocument/end}{./empty}{} and: \hook_gput_code:nnn {begindocument/end}{./fnpct}{ \setfnpct{ before-footnote-space=0pt, reverse, } } But why does this happen and is it possible to not rely on the labels?
- In jlreq.cls, how should I adjust the page size and inner margins of the document?by Panda Morty on September 17, 2025 at 9:12 am
I found that when I attempted to change a4paper to a6paper, the overall size of the document remained a4paper. And I hope to adjust the inner dimensions, but there is no mention of the relevant interface in jlreq.pdf. I am currently reading jlreq.pdf, which mentions "Requirements for Japanese Text Layout". What is it? Did it prevent me from adjusting the page size and inner margins of the document? The compilation method I use is: uplatex mwe.tex dvipdfmx mwe.dvi The mwe code is: \documentclass[tate, % paper=a4paper, twoside, gutter=2cm, head_space=2cm, foot_space=2cm]{jlreq} \usepackage{lipsum} \begin{document} \title{title} \author{author} \date{\today} \maketitle \section{section} \lipsum[1-50] \lipsum[1-5] \end{document}
- How to change the scrollbar color of the internal pdf viewer of TeXStudio?by schoop on September 17, 2025 at 8:43 am
This question: How to change color of scrollbar? was answered and explained how to change the scrollbar color in the TeXStudio Editor. It works perfectly. On my machine, the thumb and track of the scrollbar of TeXStudio's internal PDF viewer are almost the same, and I am wondering how to change the color of the scrollbar thumb, specifically of the internal PDF viewer? I assume probably it can also be done using qss, but I don't know how to get it to apply to the internal viewer.
- genealogytree: Reducing width of tree by zig-zagging siblingsby J...S on September 17, 2025 at 7:52 am
I have made a family tree using the geneologytree package like this: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{genealogypicture}[ template=database traditional, ] parent[id=parents]{ p[id=father]{ male, name = {Jack Doe}, } p[id=mother]{ female, name = {Jane Doe}, } c[id=c1]{ female, name = {Jane Doe}, } c[id=c2]{ male, name = {Jack Doe}, } c[id=c3]{ male, name = {Jack Doe}, } g[id=c4]{ female, name = {Jane Doe}, } c[id=c5]{ female, name = {Jane Doe}, } c[id=c6]{ male, name = {Jack Doe}, } c[id=c7]{ male, name = {Jack Doe}, } } \end{genealogypicture} \end{document} This is the output: This picture is quite wide and I wish to make it fit into a thinner space. One way of doing this that I can think of is by changing the vertical position of the siblings so that the sibling nodes are arranged in a zig-zag manner. This would allow us the 'shrink' the horizontal space while still leaving enough room for the labels. Something like this: How can this be done? I am using the traditional database template.
- why the "e" and "m" in the last terms look different from those in the first termsby brownser on September 17, 2025 at 7:28 am
I have this equation, \begin{equation} e m = - e^2 \bf{E} \mathcal{N}- e s \bf{v_d} \mathcal{N} + e m \end{equation} here the letter "e" looks different in terms 1,2 and 3,4. What is casuing this? How can I fix this? How can I make the "e" in terms 3 and 4 to look like that in 1 and 2. Thanks.
- genealogytree: How to make `traditional database` tree grow horizontally?by J...S on September 17, 2025 at 7:28 am
I am making a family tree using the geneologytree package like this: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{genealogypicture}[ template=database traditional, ] parent[id=parents]{ p[id=father]{ male, name = {Jack Doe}, } p[id=mother]{ female, name = {Jane Doe}, } c[id=c1]{ female, name = {Jane Doe}, } c[id=c2]{ male, name = {Jack Doe}, } c[id=c3]{ male, name = {Jack Doe}, } g[id=c4]{ female, name = {Jane Doe}, } c[id=c5]{ female, name = {Jane Doe}, } c[id=c6]{ male, name = {Jack Doe}, } c[id=c7]{ male, name = {Jack Doe}, } } \end{genealogypicture} \end{document} This is the output: I am using the traditional database template for a 'minimal' look. But is there a way to make this tree grow horizontally from the left to the right? Instead of growing from top to bottom? I tried using the timeflow=right option, but it seems that has no effect on the traditional database template. I tried genealogytree because that seemed to be most suited for drawing family trees. Perhaps I should be using something else?
- Arranging multiline texts in columnsby aDiv on September 17, 2025 at 6:17 am
Not sure how to correctly phrase the title, but I wanted to achieve the type of formatting shown in the image for Factories A-D: Is there a way to center align a multiline block of text and have it auto-adjust spacing based on the number of columns?
- Has \subnode broken or am I doing something daft?by cfr on September 16, 2025 at 10:56 pm
The following code compiles without error but gives unexpected (to me) results. In particular, the labels never 'settle'. As far as I can tell, LaTeX perpetually reports that the labels may have changed. The positions of the nodes jump from place-to-place (sometimes on different pages) accordingly. Now I know \subnode[]{}{} works - or did work. So either I am doing something very silly or something has broken (probably very recently) or both. \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark,fit} \begin{document} \begin{tikzpicture} \node {a \subnode{a}{sub} node}; \node [fit=(a),draw,inner sep=0pt,] {}; \end{tikzpicture} \end{document} This is essentially copy-pasted from tikzmark's manual, but I cannot get it to work. Certainly tikzmark does not seem to have been updated recently. However, pgf/tikz is from 2025-08-29 v3.1.11a (3.1.11a), so perhaps something has changed there. Another suspect may be LaTeX if anything to do with \mathchoice might have changed recently, since \subnode uses this internally.
- Drawing vertical and horizontal vectors along a Bézier curve (without local rotation)by lukewarn on September 16, 2025 at 10:26 pm
I’m trying to annotate a quadratic Bézier* curve in TikZ with vectors. Right now I can draw normal vectors (red arrows) at multiple points along the curve using the decorations.markings library. Here is a minimal working example: \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.markings,calc,arrows.meta} % <-- arrows.meta added \begin{document} \begin{tikzpicture} % Quadratic Bézier control points \coordinate (QB1) at (0,0); \coordinate (QB2) at (0,3); \coordinate (QB3) at (8,3); % Convert quadratic to cubic control points \path let \p1 = (QB1), \p2 = (QB2), \p3 = (QB3), \p4 = ({(1/3)*\x1 + (2/3)*\x2},{(1/3)*\y1 + (2/3)*\y2}), \p5 = ({(2/3)*\x2 + (1/3)*\x3},{(2/3)*\y2 + (1/3)*\y3}) in coordinate (QB_aux1) at (\p4) coordinate (QB_aux2) at (\p5); % The curve \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); % Normal vectors using arrows.meta syntax \draw[ postaction={ decorate, decoration={ markings, mark=between positions 0. and 1. step 0.1 with { \draw[color=red, -{Latex[length=1mm]}] (0,0) -- (0,0.5); } } } ] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); \end{tikzpicture} \end{document} Now, in addition to the red arrows (normals), I would like to draw vertical and horizontal arrows at the same positions. However, it seems that TikZ rotates every arrow into the local coordinate system of the decoration. As a result, I cannot find a way to get all arrows to stay vertical/horizontal in the global picture. Also, I don’t want the red vectors to become the vectorial sum of the horizontal and vertical components — they are all independent drawings. Question: How can I place these vertical and horizontal arrows at each marked position along the Bézier curve, aligned with the global axes, rather than with the curve’s local frame? * For some reason, if I use \draw[thick,black] (QB1) .. controls (QB2) .. (QB3); instead of \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); the curve doesn't look like a quadratic Bèzier.
- Ao recompilar aparece a primeira página do PDF [closed]by Marcos André Duarte on September 16, 2025 at 9:10 pm
Ao recompilar um documento o overleaf aparece a primeira página do PDF, gostária de saber como manter na página atual do PDF ao recompilar o documento. Using google translator the OP seems to say: When recompiling a document, the overleaf appears on the first page of the PDF. I would like to know how to keep it on the current page of the PDF when recompiling the document.
- Tikz & Boxes/Frames - How can I draw boxes/frames around word(s) inside Tikz nodes without defining new nodes?by user2379123 on September 16, 2025 at 9:10 pm
This is my code: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes, positioning, arrows.meta, fit} \usepackage{standalone} \begin{document} \begin{tikzpicture}[every node/.style={draw, rectangle, minimum width=5cm, minimum height=1.5cm, rounded corners=2mm}] \node[align=center] (a) {\bfseries Title\\ Word1 Word2}; \end{tikzpicture} \end{document} I will get this result: Sometimes it could be helpful to draw boxes/frames around text inside a Tikz node. I want to achieve following result: Do you know an easy way to obtain this goal?
- Why can't I use \StrLeft for this macro?by haifisch123 on September 16, 2025 at 7:47 pm
I'd like to have a macro which returns the first two letters of a weekday given a certain date (DD.MM.YYYY). For example "16.09.2025" would be "Tu". \documentclass{article} \usepackage{datetime} \usepackage{xstring} % input has the form "DD.MM.YYYY" % outputs first two letters of the weekday of a given date \newcommand{\strToWeekday}[1]{ \StrBefore{#1}{.}[\myDay]% \StrBehind{#1}{.}[\myYearAndMonth]% \StrBefore{\myYearAndMonth}{.}[\myMonth]% \StrBehind{\myYearAndMonth}{.}[\myYear]% \dayofweekname{\myDay}{\myMonth}{\myYear}[\myWeekday]% \StrLeft{\myWeekday}{2} } \begin{document} \strToWeekday{11.05.2023} % should return Th \strToWeekday{13.05.2023} % should return Sa \strToWeekday{16.09.2025} % should return Tu \end{document} Splitting the string, and getting (the long form of) the weekday works fine. But I couldn't manage to get only the first 2 letters of this longform. Thanks in advance for any help.
- Modified \bigcup and \bigcapby Jairo Bochi on September 16, 2025 at 6:40 pm
I'd like to define some modified \bigcap and \bigcup commands so that I could easily write code such as the following one, without having to adjust things by hand: \documentclass[12pt]{article} \begin{document} The intersection of a nested decreasing sequence of sets $A_1 \supseteq A_2 \supseteq \dots$ is denoted \[ \downarrow \hspace{-15pt} \bigcap_{n=1}^\infty A_n \, . \] Similarly, the union of a nested increasing sequence of sets $B_1 \subseteq B_2 \subseteq \dots$ is denoted $\uparrow \hspace{-10pt} \bigcup_{n=1}^\infty B_n$. \end{document}
- Defining a verbatim environment as a pair of commands (e.g., using c argspec), with optional argumentby Karl Berry on September 16, 2025 at 4:55 pm
I'm wondering if it's possible to use the new c arg spec (or any other method) in LaTeX to define a verbatim environment as a pair of commands. I also want the starting command to take an optional argument. My attempt, following the example in ltnews41, fails: \documentclass{article} \NewDocumentEnvironment{tubtyping}{!O{} c} {\begin{verbatim}#2 \end{verbatim} } {} \def\starttyping{\begin{tubtyping}} \def\stoptyping{\end{tubtyping}} \begin{document} \starttyping[foo] foo \stoptyping \starttyping bar \stoptyping \end{document} Not surprisingly, it gets the error Runaway argument? bar\obeyedline \stoptyping\obeyedline \end{document}\obeyedline \obeyedline \ET C. ! File ended while scanning use of \@xverbatim. I presume the verbatim environment can't recognize the \end{verbatim} since it's already been tokenized in the definition. I get similar errors with commands defined using traditional optional arguments (\newcommand\starttyping[1][]), etc., since (it seems) looking ahead for the [ freezes the tokens. I'm not worried about end of line behavior, having text on the \start or \stop lines, etc. It would just be helpful to have the basic idea work. This is with current (as of 2025-09-16) pdflatex-dev, LaTeX2e <2025-06-01> patch level 1 and L3 programming layer <2025-08-13>. I saw the previous question Defining a new environment extending a verbatim environment but it's not about L3. If anything in fancyvrb, listings, or any other verbatim package offers this functionality, I'd be happy to hear about it. I don't need to define it myself, I just couldn't find anything that provides it. P.S. I should mention, an alternative approach would be a way to change the end-verbatim string from \end{verbatim} to \stoptyping. Then \starttyping could take the optional arg and start the verbatim env, and the env could end normally. As far as I know the end-verbatim string cannot be changed, though.
- How to invert the order of "Figure" and the number in a caption?by David Nemeskey on September 16, 2025 at 4:12 pm
I am sure someone, somewhere has asked this question before, but I could not find it. I am generating a Beamer document from a pandoc markdown file. The slides are in Hungarian, so I simply switched to lang=hu. The figure captions I got (coming from babel, I guess) are in the same order as the English ones, which is not how we caption things in Hungarian: English: Figure 1: xyz "Hungarian": ábra 1: xyz Should be: 1. ábra: xyz Is there a way to change the order of the number and the label as in the last line? I am sure there is, as I have seen examples for it in publications I am positive were typeset with LaTeX. However, even the caption package seems to handle it as a single unit. MWE: \documentclass{beamer} \usepackage[hungarian,provide=*]{babel} \setbeamertemplate{caption}[numbered] \begin{document} \begin{frame} \begin{figure} \caption{text} \end{figure} \end{frame} \end{document} (As observed by @javier-bezos below, Beamer seems to be the culprit, since we get the correct form in a regular article.)
- How to draw the Ketamine molecular structure using ChemFig?by Marco Fanelli on September 16, 2025 at 11:27 am
How to draw the Ketamine molecular structure using ChemFig? Question I'm trying to draw the molecular structure of Ketamine (C₁₃H₁₆ClNO) using the chemfig package in LaTeX. I'm having trouble properly positioning the substituents on the benzene ring and connecting the cyclohexanone ring. What I've tried Here's my current attempt: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{*6(=-(-[:30](=[:90]O)-[:330]HN-[:30])=-(-Cl)=)} \end{document} Expected result
- Vertical dashed lines in tikz. Figure from Proofs Without Wordsby Richard on September 16, 2025 at 9:08 am
I’m trying to recreate a figure from Roger B. Nelsen’s Proofs Without Words: Exercises in Visual Thinking—specifically “Sums of Squares V” (Integer Sums, p. 81). My code gets everything right except the vertical dashed lines inside each unit square. Can these be drawn when using rectangle ++(1,1), or should I use a different approach? \documentclass[]{article} \usepackage [utf 8]{inputenc} \usepackage{soul} \usepackage {ulem} \usepackage{amsmath , bm} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{quotes,angles} \usetikzlibrary {arrows.meta} \usetikzlibrary{math} \usetikzlibrary {babel} \usetikzlibrary{calc} %for coordinate calc \usepackage{tikz,ifthen} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm,yscale=-1] % neutralize \i and \j only within this block \begingroup \let\i\relax \let\j\relax %First rectangle \foreach \i in {-1} \foreach \j in {0} \draw (\i,\j) rectangle ++(1,1); %Second rectangle \foreach \i in {0,1}{ \foreach \j in {0,1}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Third rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fourth rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fifth rectangle \foreach \i in {5,6,7,8}{ \foreach \j in {0,1,2,3}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Sixth rectangle \foreach \i in {9,10,11,12,13}{ \foreach \j in {0,1,2,3,4}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=4\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi\fi } } \endgroup \end{tikzpicture} \end{document}
- Using \add@accent to add a grave accent for a font that lacks the combining diacritic adds a left single quote insteadby Jigsaw on September 16, 2025 at 5:26 am
I'm writing a document using Minion Pro, and I need to typeset a character with a grave accent. Unfortunately, the character I want to typeset doesn't exist as a single glyph in Minion Pro. To make matters worse, Minion Pro seems lack combining diacritics altogether, as they show up as crossed rectangles. For example, the following MWE produces the subsequent result: \documentclass{article} \usepackage{fontspec} \setmainfont{Minion Pro} \begin{document} \`r \end{document} I've attempted to fix this by using \add@accent, but it doesn't work, instead adding a left single quote above the letter, instead of the desired grave accent: \documentclass{article} \usepackage{fontspec} \setmainfont{Minion Pro} \begin{document} \makeatletter \add@accent{`^^^^0060}{r} \makeatother \end{document} I can fix this by not using Minion Pro, which gives the look I want: But ideally I'd want to use Minion Pro, and grab something like the grave accent over e, but use it over r instead: Is there a way for me to do something like this, or something that could at least approximate it (e.g., using Minion Pro for the character, and pulling the accent mark from a similar font that has the combining diacritic)?
- pan and scan images, viewport and image resizingby Bob on September 16, 2025 at 4:25 am
I would like to avoid having to rip my photos manually. Take this simple case where I want to tile some photos and present them in a grid with each figure the exact same size as the others. But the subject matter was not a consistent distance from the camera, and you accidentally took one photo in portrait mode. So we need to zoom pan and crop each photo. Is there a way to adjust the pan, zoom, and rotation of an image without altering the viewport? I want to be able to define: a viewport in units relative to the pagesize (often \linewidth) a zoom factor that is unit-less an X and Y pan distance in units relative to the page size a rotation angle for good measure (always about the center of the viewport) When I try this using includegraphics the scale command changes the size of the viewport rather than the subject matter! Think of pinch zooming and panning and image on your phone, thats what I want. It seems that includegraphics is all in units relative to the picture? I need the opposite. p.s. I have faced this issue in the past and it goes un-answered 4 years later. Hopefully there is a proper solution and I just missed it. Image handling, zooming rotating panning and viewport ================================================================== Example of why I am having a hard time. I want to preface that because I made this example case using the same example-image-a, this example is sort of the inverse that I described before; rather than using photos of varying subject size and trying to make them match, I have intentionally scaled these differently then adjusted to make them the same size. But the point still stands. In order to make the first and second photo take up the same space on the page I had to manually calculate the viewport center then adjust it to compensate for the scale. \documentclass{article} \usepackage{graphicx} \usepackage{xparse} \begin{document} \fbox{\includegraphics[viewport = 0 0 320 240, scale = 0.5, clip]{example-image-a}} \clearpage \fbox{\includegraphics[viewport = 80 60 240 180 scale = 0.25, clip]{example-image-a}} \clearpage \fbox{\includegraphics[width = 160pt, height = 4in, keepaspectratio, viewport = 80 60 240 180 scale = 0.25, clip]{example-image-a}} \vspace{2in} \fbox{\includegraphics[viewport = 0 0 320 240, scale = 0.5, angle = 35, clip]{example-image-a}} \end{document} I was also having difficulty setting the frame width and hieght without distorting the image, as the keepaspectratio option seems be at odds with specifying both. Something very strange happens with rotation that I havnt sorted out yet.