Hot
- How to improve graphs of functions of two variables with jagged edges in pgfplots?by orion2112 on January 9, 2026 at 10:19 pm
In the spirit of creating "beautiful plots" of functions of two variables, I am reaching out to this community to try and find possible improvements in the way I have been using pgfplots and \addplot3. Here are 3 attempts at graphing the paraboloid $f(x,y)=x^2+y^2$. Attempt 1: plotting {x^2+y^2} in cartesian coordinates with no restriction on the z domain yields a plot that "hides part of itself" and doesn't readily show the "bowl" shape we all love: \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Smooth and ugly} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, domain=-3:3, y domain=-3:3, opacity=0.5 ] {x^2+y^2}; \end{axis} \end{tikzpicture} \end{document} Attempt 2: adding the "restrict z to domain=-3:3" option, but this produces a very jagged top edge to the paraboloid, and not a nice smooth circle. Adding samples reduces the jaggedness slightly but there is a limit to how many samples I can put before I get an error, and that isn't enough to get a smooth circle. \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Jagged edges at top} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, domain=-3:3, y domain=-3:3, restrict z to domain={-3:3}, opacity=0.5 ] {x^2+y^2}; \end{axis} \end{tikzpicture} \end{document} Attempt 3: using data cs=polar and a domain of 0:360 instead of -3:3 gets me to an acceptable graph that doesn't hide itself and that has a smooth border: \documentclass[tikz,12pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{colorbrewer} %For the colormap \begin{document} \begin{tikzpicture} \begin{axis}[ axis line style={very thick}, axis on top=false, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, zlabel style={rotate=90}, xtick={-3,-2,-1,0,1,2,3}, ytick={-3,-2,-1,0,1,2,3}, ztick={-3,-2,-1,0,1,2,3}, tick label style={font=\scriptsize}, no marks, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-3, zmax=3, view={130}{30}, title={Not jagged, but polar coords} ] \addplot3[ surf, samples=40, colormap/PuBu-9, shader=flat, data cs=polar, domain=0:360, y domain=-3:3, restrict z to domain={-3:3}, opacity=0.5 ] ({x},{y},{y^2}); \end{axis} \end{tikzpicture} \end{document} Problem solved? Not really. What if now I want to plot f(x,y)=x/(y-x)? If done in cartesian coordinates without restricting the z domain, the graph "hides itself". If done in cartesian coordinates and restricting the z domain, some of the edges are jagged. For instance: (I seem to notice that if the mesh line is parallel to one of the "walls" of the plot box, there is no jagged edge, but if a "square" of the mesh is outside the z domain, the whole square is erased, and not just the part that is outside the z domain). And here I don't see how polar coordinates would be usable to bypass that problem. "But, this is not a nice function, of course the graph will be ugly". Fair enough, but seeing that Desmos does it instantly and even allows you to rotate the plot smoothly, I was hoping that maybe it's possible to do better here: So, is there anything that can be done about this? Am I using this wrong? Or is it just a limitation of plotting surfaces in LaTeX? Thanks in advance for all the insight. Note: I am aware of the topic here and that it seems there are only rectangular (and not triangular) surface elements, but I am not sure the issue is the same nor how \clip and \begin{scope} were used to fix the issue. If this is the way to go, can someone explain what those commands do exactly?
- (Fake) caption above the first PDF pageby RedGreenBlue on January 9, 2026 at 9:52 pm
I have a TeX document where I would need to include 1 page images or PDFs (1 page, multiple pages). For PDFs I use pdfpages. I tried to come up with a command \newcounter{pdfanhang} \newcommand{\attachment}[4][0.8]{% #1=scale (optional, default 0.8), #2=Title, #3=Filename, #4=Explanation \stepcounter{pdfanhang} \newpage \phantomsection % 1. Add to Table of Contents \addcontentsline{toc}{subsection}{Anhang \thepdfanhang: #2} % 2. The Caption at the top \begingroup \captionsetup{labelformat=anhangformat} \captionof{figure}{\textbf{#2.} #4} \endgroup % 3. Labels for referencing \label{fig:pdf_anhang_\thepdfanhang} \label{pdf:#3} % 4. The File Import with scale from optional argument #1 \begingroup \edef\mypath{#3} \includepdf[pages=-, scale=#1, pagecommand={\thispagestyle{plain}}]{\mypath} \endgroup } But it does not really do what I want. The caption is on an extra page , followed by the PDF on the next page. I am trying to find a way to place the (fake) caption above the PDF attachment (1 side or multiple, in the letter case , only the first PDF pages) But the caption is always placed on a separate page. I don't know currently how to switch from including a PDF to image in my commend. Could you help me to improve my command "attachment", please? Place the caption above the first PDF page, or image, small space between caption and PDF. Caption should also have space for 3-5 sentences comments in the worst case Being able to include an image as well instead of PDF This is a mocking MWE, it only shows what is the current situation, I could not generate a pdf on the fly for you that I can include. Mocking MWE \documentclass{article} \usepackage{caption} \usepackage{hyperref} \newcounter{pdfanhang} % --- Mock includepdf --- \newcommand{\mockincludepdf}{% \clearpage \thispagestyle{plain} \centering MOCK PDF — Page 1 \clearpage \thispagestyle{plain} \centering MOCK PDF — Page 2 } \newcommand{\attachment}[3]{% \stepcounter{pdfanhang} \newpage \phantomsection \addcontentsline{toc}{subsection}{Anhang \thepdfanhang: #1} \captionof{figure}{\textbf{#1.} #3} \label{fig:pdf_anhang_\thepdfanhang} \mockincludepdf } \begin{document} \tableofcontents \attachment {Test attachment} {ignored} {This caption appears on a separate page.} \end{document}
- Create user copy of \if@partsw with \AtBeginDocument [duplicate]by Ethan Duckworth on January 9, 2026 at 5:44 pm
I would like to create a user copy of the \if@partsw flag something like this \documentclass{article} \newif\ifPart \AtBeginDocument{\makeatletter \if@partsw \Parttrue \else \Partfalse \fi \makeatother} \includeonly{foo} \begin{document} \include{foo} \include{bar} \ifPart % this should be true That's just one section % this should be shown \else That's both sections \fi \end{document} The above code does not set \ifPart to true, presumably because I don't understand the right way do use \AtBeginDocument or because of when \if@partsw gets set. But it does work if I move the \makeatletter...\makeatother to be after \includeonly or if I move it to be after \begin{document}.
- I would like to create a graph paper documentby Brion C on January 9, 2026 at 4:36 pm
I'm trying to create a graph paper document and have the text align to the grid (Not just superimposed on it). The text should at least align with baseline of the grid, but better yet, each character should be placed inside the grid like if you were handwriting on graph paper.
- Sideways table is misaligned, pushed all the way to the right [duplicate]by mingabua on January 9, 2026 at 2:33 pm
I have the following problem. I have a format template for the MSOM Journal (direct link). Now I want to display a table there vertically instead of horizontally. To do this, I would like to use the \sidewaystable environment. I have adjusted my table accordingly and inserted it into my code. Unfortunately, it does not work as desired. The table is completely aligned to the left (in my paper it is aligned to the right, but I couldn't reproduce that). See photo: How can I center the table? \documentclass[ijoc,dblanonrev]{informs4} \OneAndAHalfSpacedXII \usepackage{rotating} \usepackage{booktabs} \usepackage{multirow} \usepackage[nohyperlinks, printonlyused, nolist]{acronym} \usepackage[margin=1in]{geometry} \usepackage{amsfonts} \usepackage{amssymb} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{caption} \begin{document} \begin{sidewaystable}[p] \centering \footnotesize \caption{Comprehensive performance analysis over 25 scenarios per instance} \label{tab:comp_results_comprehensive} \setlength{\tabcolsep}{2pt} \renewcommand{\arraystretch}{1.3} \begin{tabular}{cc cc c cccccc c ccc c ccccc} \toprule % HEADER ROW 1 \multicolumn{2}{c}{\textbf{Inst.}} & \multicolumn{2}{c}{\textbf{Compact}} & & \multicolumn{6}{c}{\textbf{\ac{bnp}: Solution \& Reliability}} & & \multicolumn{3}{c}{\textbf{\ac{bnp}: Tree}} & & \multicolumn{5}{c}{\textbf{\ac{bnp}: Time Breakdown}} \\ \cmidrule(r){1-2} \cmidrule(lr){3-4} \cmidrule(lr){6-11} \cmidrule(lr){13-15} \cmidrule(l){17-21} % HEADER ROW 2 $|\mathcal{J}|$ & $|\mathcal{T}|$ & Time [s] & Gap [\%] & & $t_{tot}$ [s] & Gap [\%] & $t_{1st}$ [s] & $N_{Sol}$ & Opt? & Root Int. & & $D_{max}$ & Root Gap & Nodes & & $t_{MP} [\%]$ & $t_{SP} [\%]$ & $t_{Heur} [\%]$ & $t_{Root} [s]$ & $t_{Br} [\%]$ \\ \midrule % --- Block J = 5 --- \multirow{3}{*}{5} & 7 & \shortstack{10/12/15\\1.2} & \shortstack{0/0/0\\0} & & % \ac{bnp} Solution \shortstack{2/3/5\\0.8} & \shortstack{0/0/0\\0} & \shortstack{0.5/0.8/1\\0.2} & \shortstack{2/3/5\\1.1} & \shortstack{1/1/1\\0} & \shortstack{0/0/1\\0.2} & & % \ac{bnp} Tree \shortstack{1/1/1\\0} & \shortstack{0.5/1/2\\0.4} & \shortstack{1/1/1\\0} & & % \ac{bnp} Time Split \shortstack{5/10/15\\2} & \shortstack{40/45/50\\3} & \shortstack{10/15/20\\4} & \shortstack{1/2/3\\0.5} & \shortstack{0/0/0\\0} \\ \addlinespace & 14 & \shortstack{40/45/55\\4.1} & \shortstack{0/0/0\\0} & & \shortstack{6/8/11\\1.5} & \shortstack{0/0/0\\0} & \shortstack{1/2/3\\0.5} & \shortstack{3/5/8\\1.5} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{1/3/5\\1} & \shortstack{0.2/0.8/1.5\\0.3} & \shortstack{1/5/12\\3} & & \shortstack{8/12/18\\3} & \shortstack{55/60/65\\4} & \shortstack{10/12/15\\2} & \shortstack{3/4/5\\1} & \shortstack{1/2/5\\1} \\ \addlinespace & 28 & \shortstack{150/180/210\\15} & \shortstack{0/0/0\\0} & & \shortstack{18/22/29\\4} & \shortstack{0/0/0\\0} & \shortstack{5/8/12\\2} & \shortstack{5/10/15\\3} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{5/8/12\\3} & \shortstack{0/0.5/1\\0.2} & \shortstack{10/25/45\\10} & & \shortstack{10/15/20\\3} & \shortstack{70/75/80\\5} & \shortstack{5/8/10\\2} & \shortstack{10/12/15\\2} & \shortstack{2/5/8\\2} \\ \midrule % --- Block J = 10 (Base Case) --- \multirow{3}{*}{10} & 7 & \shortstack{90/110/140\\12} & \shortstack{0/0/0\\0} & & \shortstack{10/12/18\\2} & \shortstack{0/0/0\\0} & \shortstack{2/3/5\\1} & \shortstack{4/6/9\\2} & \shortstack{1/1/1\\0} & \shortstack{0/0/1\\0.1} & & \shortstack{1/1/3\\0.5} & \shortstack{1/1.5/2.5\\0.5} & \shortstack{1/1/3\\0.5} & & \shortstack{15/20/25\\4} & \shortstack{35/40/55\\6} & \shortstack{15/20/25\\3} & \shortstack{5/6/8\\1} & \shortstack{0/1/2\\0.5} \\ \addlinespace & 14 & \shortstack{1.1k/1.2k/1.5k\\150} & \shortstack{0/0/2\\0.5} & & \shortstack{35/45/60\\6} & \shortstack{0/0/0\\0} & \shortstack{10/15/20\\4} & \shortstack{8/12/18\\4} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{5/10/15\\4} & \shortstack{0.5/1.1/1.8\\0.4} & \shortstack{20/55/110\\25} & & \shortstack{12/18/22\\4} & \shortstack{50/58/65\\5} & \shortstack{8/10/15\\2} & \shortstack{15/20/25\\4} & \shortstack{5/10/15\\3} \\ \addlinespace & 28 & \shortstack{TL/TL/TL\\0} & \shortstack{2/4.5/8\\1.8} & & \shortstack{95/115/145\\14} & \shortstack{0/0/0\\0} & \shortstack{30/45/60\\10} & \shortstack{15/25/40\\8} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{20/35/60\\12} & \shortstack{0.1/0.4/0.9\\0.2} & \shortstack{150/320/580\\110} & & \shortstack{10/15/20\\3} & \shortstack{65/72/85\\8} & \shortstack{2/5/8\\2} & \shortstack{40/55/70\\10} & \shortstack{10/15/20\\5} \\ \midrule % --- Block J = 15 --- \multirow{3}{*}{15} & 7 & \shortstack{480/540/650\\55} & \shortstack{0/0/1.5\\0.3} & & \shortstack{22/29/40\\4} & \shortstack{0/0/0\\0} & \shortstack{5/8/12\\2} & \shortstack{6/10/15\\3} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{1/3/8\\2} & \shortstack{1.5/2.2/3.5\\0.8} & \shortstack{1/5/12\\3} & & \shortstack{20/25/30\\4} & \shortstack{40/45/55\\4} & \shortstack{15/20/25\\3} & \shortstack{10/12/18\\3} & \shortstack{1/3/5\\1} \\ \addlinespace & 14 & \shortstack{TL/TL/TL\\0} & \shortstack{5/8/12\\2} & & \shortstack{80/98/130\\12} & \shortstack{0/0/0\\0} & \shortstack{25/35/50\\8} & \shortstack{20/30/50\\10} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{10/25/45\\10} & \shortstack{0.8/1.5/2.2\\0.6} & \shortstack{80/150/280\\45} & & \shortstack{10/15/20\\3} & \shortstack{55/65/75\\7} & \shortstack{5/8/12\\2} & \shortstack{35/45/60\\8} & \shortstack{8/12/18\\4} \\ \addlinespace & 28 & \shortstack{TL/TL/TL\\0} & \shortstack{12/18/25\\4} & & \shortstack{210/245/320\\35} & \shortstack{0/0/0.1\\0.02} & \shortstack{80/120/180\\25} & \shortstack{40/60/90\\15} & \shortstack{0/1/1\\0.2} & \shortstack{0/0/0\\0} & & \shortstack{45/80/120\\25} & \shortstack{0.2/0.6/1.2\\0.3} & \shortstack{500/1.2k/3.5k\\850} & & \shortstack{5/10/15\\3} & \shortstack{70/80/90\\9} & \shortstack{1/3/5\\1} & \shortstack{80/110/150\\20} & \shortstack{15/20/25\\5} \\ \bottomrule \multicolumn{21}{l}{\footnotesize \textit{Note:} TL = Time Limit (3600s). `Opt?' is 1 if optimal sol. found. `Root Int.' is 1 if root node integral. `Nodes' = B\&B Nodes.} \\ \multicolumn{21}{l}{\footnotesize Time breakdown columns ($t_{MP}$ to $t_{Br}$) are percentage of total time. $t_{1st}$ and $t_{Root}$ are absolute seconds.} \end{tabular} \end{sidewaystable} \end{document} Note: To compile the code, you need the informs4.cls and informs4014.bst files.
- Strange dot shown in `circuitikz` if `line cap=round` is set only in PDF-XChange Editor?by Explorer on January 9, 2026 at 2:32 pm
I have the following code, with line cap=round: \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[ european, line cap=round, ] \draw (0,0) to [rmeter] (0,2) -- (1,2) |- (0,0); \end{circuitikz} \end{document} It shown as normal in "Adobe Acrobat Reader": However, with PDF-XChange Editor, the strange dot appeared by line cap=round... Edited: Mine PDF-XChange Editor's version is v10.5.2.
- Simple way to show/hide controls points in a Tikz line?by YaGoi Root on January 9, 2026 at 2:18 pm
In Tikz diagrams, one of the best ways to make controlled curved lines (such as pointing arrows in a flow chart) is using \draw with control points. For example, \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{shapes.arrows, arrows.meta} \begin{document} \begin{figure} \begin{tikzpicture} \draw[thick,->,>=Stealth, show controls] (0,0) .. controls (0.5,3) and (4.5,0).. (5,5); \end{tikzpicture} \end{figure} \end{document} However, I feel like it ends up being a sort of guessing game when trying to determine where to actually place the control points, because I have a hard time visualizing where the points are and how their position affects the curved line. I understand how the points effect the line very intuitively, but moving said points to the desired location is easier when you can see the points as well. Is there any simple way to "toggle" on a display of the control points, so that you can see them while editing the diagram, and then hide them when you've got the line that you want?
- LaTeX Error: Environment tblrtikzbelow undefinedby Phantom on January 9, 2026 at 1:54 pm
I want to make a long table with rounded corners using the tabularray package. For this I'm using the same code as in the example in the section 5.10 of the documentation. Which is loading the tikz through tabularray, and then using the tblrtikzbelow environment. But by doing so, I've got the error: LaTeX Error: Environment tblrtikzbelow undefined. Here is a MRE: \documentclass{article} \usepackage{tikz} \usepackage{tabularray} \UseTblrLibrary{tikz} \usepackage{lipsum} \usepackage{xcolor} \begin{document} \lipsum[1-4] \noindent \begin{tblrtikzbelow} \path[draw=blue, thick, rounded corners] (table.north west) rectangle (table.south east); \end{tblrtikzbelow} \NewTblrTheme{fancy}{ \DeclareTblrTemplate{caption-sep}{default}{~: } \DeclareTblrTemplate{contfoot-text}{default}{suite à la prochaine page} \DeclareTblrTemplate{conthead-text}{default}{(Suite)} } \begin{longtblr}[ theme = fancy, caption = {Test}, entry = {Test 1}, label = {tblr:test} ]{ colspec = {X[3,c,m]X[5,c,m]}, rowhead = 1, row{1} = {blue}, hlines = {blue}, vlines = {blue} } \bfseries\color{white}Title 1 & \bfseries\color{white}Title 2\\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ \end{longtblr} \end{document}
- circuitikz: how to get all in the same line width thicknessby cis on January 9, 2026 at 1:37 pm
Is there an easy way to get all in the same line width thickness? I tried to calc some things but I do not think this was correct: \pgfmathsetlengthmacro\lw{2.1pt}% wanted linewidth (circuitikz default 0.8pt) \pgfmathsetlengthmacro\lwc{0.8pt}% circuitikz default linewidth 0.8pt % ----> could this be read out somehow? \pgfmathsetmacro\th{\lwc/\lw}% needed bipoles/thickness % ---> do not think, this is correct \documentclass[margin=5pt]{standalone} \usepackage{tikz} \usepackage[]{circuitikz} %\ctikzset{bipoles/thickness=3} \pgfmathsetlengthmacro\lw{2.1pt}% wanted linewidth (circuitikz default 0.8pt) \pgfmathsetlengthmacro\lwc{0.8pt}% circuitikz default linewidth 0.8pt % ----> could this be read out somehow? \pgfmathsetmacro\th{\lwc/\lw}% needed bipoles/thickness % ---> do not think, this is correct \begin{document} \begin{tikzpicture}[european, line width=\lw, circuitikz/bipoles/thickness=\th,% default 2 %circuitikz/sources/symbol/thickness=\th,% default 1 ] \draw (0,3) to [sinusoidal voltage source, v=$u(t)$, ] (0,0); \draw (0,3) to[C=$C$] (4,3) to[resistor={$R$}] (4,0) to[battery1, invert] (0,0); \node[align=left, anchor=north west, fill=yellow!25] at (0,-1) { \textbf{Values}: \\ lw: \lw \\ th: \th \\ bipoles/thickness: \ctikzvalof{bipoles/thickness} \\ circuitikz/sources/symbol/thickness: \ctikzvalof{circuitikz/sources/symbol/thickness} ? \\ ...... }; \end{tikzpicture} \end{document}
- Create a textbox with a figure insideby Mike on January 9, 2026 at 1:34 pm
I would like to create a textbox that includes a figure. The text should wrap around the figure. I tried the following. \documentclass[11pt]{book} % --- 1. Essential Packages --- \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{wrapfig} \usepackage{caption} \usepackage{calc} \usepackage[most]{tcolorbox} \usepackage{helvet} \usepackage{lipsum} \tcbset{ figbox/.style={ enhanced, colback=white, colframe=blue, arc=0mm, fonttitle=\bfseries\sffamily, before skip=15pt, after skip=15pt, boxrule=0.5pt, } } % New environment: wrapbox % Arguments: 1=Side (l or r), 2=Width of figure, 3=Image path, 4=Caption \newenvironment{wrapbox}[4]{ \begin{tcolorbox}[figbox] \begin{wrapfigure}{#1}{#2} \centering \includegraphics[width=#2]{#3} \captionof{figure}{#4} \end{wrapfigure} \leavevmode }{ \par \vspace{0.5pt} % Minimal spacing \end{tcolorbox} } % --- 4. Document Content --- \begin{document} \chapter{Chapter} \section{Section} \begin{wrapbox}{r}{0.35\textwidth}{example-image-a}{Title} Some text to describe an example. \end{wrapbox} \lipsum[5] \end{document} However, the figure is not in the box and even overlaps with my other text that should come after the box. If I have enough text (meaning more than the picture size) it works.However, if I do not have enough text to cover the picture the box is too small and the text below overwrites the figure.
- How to stop PDF readers from reading wordy labels of hyperlinks?by Niranjan on January 9, 2026 at 10:34 am
I am working on a project that creates tagged PDFs. I am using latest TeX Live and standard methods prescribed by the project team. The PDF created is pretty good, but suppose there is a hyperlink with label mypkg-internal-label-1, NVDA with Acrobat reads it aloud (i.e., "Go to mypkg-internal-label-1". Generally package generated labels are cryptic and do not contribute to the general content of the document. Is there any way to suppress it? \DocumentMetadata{tagging=on} \documentclass{article} \usepackage{hyperref} \begin{document} \section{abc}\label{some-cryptic-text} \ref{some-cryptic-text} \end{document} Note that this is already answered in chat, posting it here for future reference.
- Table of Contents not populating after a certain pointby Anna Miller on January 9, 2026 at 2:54 am
I am compiling a thesis. After a certain point my table of contents (TOC) is not populating anymore subsections or subsubsections. It is strange, if I remove some subsections, the ones beneath them that would not have otherwise populated, do. It seems as if there is a limit to the amount of lines I can have in the TOC and it does not go beyond that - but this seems unlikely as I do not have a lot of entries.
- Rafael Bombelli's mathematical power notationby Eff on January 9, 2026 at 12:02 am
In the 1572 algebra book L'Algebra by Rafael Bombelli, he uses his own notation for powers. I want to reproduce this notation in LaTeX. Below is a screenshot from the book that shows how he wrote to the sixth power, the fifth power, etc. In general, x to the power of n is written as n above a kind of circular arc. I have found a good example where it is made nicely in LaTeX. But I don't know how to reproduce it. Can anyone offer a solution to writing this power notation in LaTeX?
- cuted package not found [closed]by crayman9 on January 8, 2026 at 11:37 pm
This is an issue similar to one I posted about 5 months ago, but with a different error this time. When I try to compile the following code \documentclass[twocolumn]{article} \usepackage{cuted} \begin{document} test \end{document} I get the error: ! LaTeX Error: File `cuted.sty' not found. I'm using TeXworks, and Help>About TeXworks gives 0.6.10 (MiKTeX 25.12).
- Long niceTabular on multiple pagesby Phantom on January 8, 2026 at 9:04 pm
I'm using the niceTabular environment from the niceMatrix package because I want the table to have a specific layout. The problem I have is my table is long, and like in the MRE below, the first few lines could fit the end of a page. But the niceTablular environment does not allow the page break. Is there a way to have a specific layout with the longtable environment? If not, is there a way to make the niceTabular break at the end of a page? \documentclass{article} \usepackage{lipsum} \usepackage{nicematrix} \usepackage{xcolor} \begin{document} \lipsum[1-4] \noindent \begin{NiceTabular}{X[3,c,m]X[5,c,m]}[hvlines,rules/color=blue,rounded-corners] \CodeBefore \rowcolor{blue}{1} \Body \RowStyle[color=white]{\bfseries} Title 1 & Title 2\\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ line & line \\ \end{NiceTabular} \end{document}
- Use a different math font only for \rightarrow while keeping Roboto as main fontby palloc on January 8, 2026 at 7:51 pm
I am working in standard pdfLaTeX (not XeLaTeX / LuaLaTeX) and using Roboto as the main font: \documentclass{article} \usepackage[sfdefault]{roboto} \usepackage{textcomp} \begin{document} 50 {\textmu}s $\rightarrow$ 100 {\textmu}s \end{document} Since Roboto does not contain arrow symbols, \rightarrow falls back to Computer Modern, which results in inconsistent typography. What I would like is: Roboto for all text only \rightarrow to come from Notomath pdfLaTeX only I currently have a workaround that does what I want, but I am pretty sure it is not the best solution: \usepackage[sfdefault]{notomath} % set everything to Notomath \usepackage[sfdefault]{roboto} % override what exists in Roboto, arrows are missing in Roboto, so they remain from Notomath Is there a cleaner way in pdfLaTeX to replace only \rightarrow with the Notomath version?
- How can I use the short-arched f and short-swashed Q in EB Garamond using the LuaLaTex compiler?by Nemgathos on January 8, 2026 at 7:07 pm
I use the texlive-full package for Linux. This is my minimum working example: %!TEX engine = lualatex \documentclass[ 12pt, a4paper ]{article} \usepackage[british]{babel} \usepackage{fontspec} \setmainfont[ Ligatures={NoRequired, NoCommon, NoContextual}, RawFeature={+calt} ]{EB Garamond} \begin{document} \section*{Minimum working example} \begin{enumerate} \item Qy ffi fi fa fä \item \textit{Qy ffi fi fa fä} \item \textbf{Qy ffi fi fa fä} \item \textbf{\textit{Qy ffi fi fa fä}} \end{enumerate} \end{document} The output looks as follows: I have already tried to tweak the option to RawFeature={-calt} or to use RawFeature={-ss06,-swsh} or Contextuals={NoSwash} but this has not helped so far. Also, I cannot use this solution or that one. Is there a way to solve the problem or are there some versions of EB Garamond where it is just impossible to fix this problem because the character variants cannot be addressed? Where can I find all the options that are available to tweak the features of this font version? There is so much confusion about “old” and “new” versions of the font that are either part of the texlive-full package or not. I would also like to use other features of the font that are described here. For example, I would like to use RawFeature={+cv06} but if I cannot even address other features, it is meaningless to pursue this endeavor right now. From what I have understood by looking at this answer, it is a fact that there is an “original” and a “new” version with different feature sets. But doesn’t the “original” version lack a proper bold cut? That is why I would like to use the “new” version but with the features listed in this question.
- PDF/A and PDF/X compatibility: Color questionsby schade96 on January 8, 2026 at 5:43 pm
In my previous question I attempted to make my PDF PDF/A-2B and PDF/X-4 conform. I went a bit further with this and discovered another issue: PDF/X-4 does not support bookmarks, which I definitely want. As a consequence, I actually need PDF/X-6 (which also seems to make external links easier to handle) and thus, because it is based on PDF 2.0, also need to bump the A-conformity to PDF/A-4. This is my current version of the latex code: \documentclass[a4paper]{article} \RequirePackage{pdfmanagement} % Bug patch, see https://github.com/latex3/pdfresources/issues/110#issue-3789290014 \ExplSyntaxOn \keys_define:nn { document / metadata } { _pdfstandard / X-6 .code:n = { \AddToDocumentProperties [document]{pdfstandard-X}{PDF/X-6} \__pdfmeta_xmp_add_pdfxid: } } \ExplSyntaxOff % Now set the actual metadata \SetKeys[document/metadata]{ pdfstandard = {A-4,X-6}, lang = en-US, pdfversion = 2.0, colorprofiles = { A = FOGRA39L_coated.icc,% X = FOGRA39L_coated.icc% } } % For now, keep it RGB. \usepackage[rgb]{xcolor} \usepackage{graphicx} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{fontspec} \usepackage{hyperref} \hypersetup{ colorlinks=true,% urlcolor={blue},% linkcolor={blue},% citecolor={blue},% pdfauthor={me},% pdftitle={pdfxtest},% pdfsubject={subject},% pdfversionid={someversion},% pdfkeywords={a,b,c}% } \ExplSyntaxOn \pdfmeta_xmp_add:n{<xmpMM:RenditionClass>default</xmpMM:RenditionClass>} \__pdfmeta_xmp_schema_new:nnn {Adobe~PDF~Schema} {pdf} {http://ns.adobe.com/pdf/1.3/} \__pdfmeta_xmp_property_new:nnnnn {pdf} {Trapped} {Text} {internal} {Indicates~whether~the~document~has~been~trapped.} \pdfmeta_xmp_add:n{<pdf:Trapped>True</pdf:Trapped>} \pdfmanagement_add:nnn{Info}{Trapped}{/True} % Don't forget to set the page size to A4. \pdfmanagement_add:nnx{Page}{TrimBox} {[0~0~595.276~841.89]} \pdfmanagement_add:nnx{Page}{BleedBox} {[0~0~595.276~841.89]} \ExplSyntaxOff \begin{document} document \\ \href{mailto:nobody}{mail to nobody} % % Construct the image for example like this: % python3 -c "import matplotlib.pyplot as p; p.scatter([0, 1], [0, 1], s=1, rasterized=True); p.savefig('testimage.pgf')" % sed -i '' 's/interpolate=true/interpolate=false/g' testimage.pgf \par\input{testimage.pgf} \end{document} As shown above, the final document only has one remaining compliance issue with the colors: RGB used but PDF/X OutputIntent not RGB If the destination profile of the OutputIntent in a PDF is not RGB, PDF/X prohibits that an object uses DeviceRGB. for all instances where any color is used. This applies to both PDF/A and PDF/X compliance. First of all, it seems that RGB is not generally forbidden by PDF/X, as long it is not DeviceRGB. So the first question is: Do I have an "alternative RGB" available here that is supported by (lua)latex? Sidenote: If it turns out there is no way around CMYK, the question is how I would convert the png files in a compatible way. One solution I found was converting them to pdfs using imagemagick: $ magick image.png -profile FOGRA39L_coated.icc -colorspace CMYK output.pdf More generally, one issue here is: For PDF/X-6 (and predecessors), the color profile must be a prtr (Printer) color profile. The second question is therefore: Are there any RGB printer profiles? I would assume that, if there are any, that these are very rare. Thus, for the moment, I need to assume that I need to make all colors CMYK and load \usepackage[cmyk]{xcolor} instead of \usepackage[rgb]{xcolor} or \usepackage{xcolor}. This however means that all colors now look different. This is of course somewhat expected, since those are different color models. However, I find that the difference is a bit too obvious. Consider this example: \documentclass{article} % Testing these two options: %\usepackage[rgb]{xcolor} \usepackage[cmyk]{xcolor} \definecolor{bluecmyk}{cmyk}{1, 1, 0, 0} \definecolor{bluergb}{rgb}{0, 0, 1} \begin{document} \color{blue}{\rule{1cm}{1cm}} \color{bluecmyk}{\rule{1cm}{1cm}} \color{bluergb}{\rule{1cm}{1cm}} \end{document} which becomes these two: As I understand it, what happens here and how close these colors match is very much device-dependent. After all, the monitor I am viewing this on is ultimately RGB. Is there anything I can do to get a better match between these two colors that I am missing? My ultimate goal is to keep the on-screen colors as close to the ones I am seeing with RGB. Of course, when printed, it may be that the colors are not fully reproduced, since printers are CMYK. Still, the digital version is slightly more important here. In principle I would be open to recompute all colors manually in terms of CMYK if necessary, but then I need to know if I can get a closer match.
- TikZ overlay alignment issues in nested tcolorboxes: PDFLaTeX (LTR) vs XeLaTeX/Polyglossia (RTL)by Med Elhadi Kh on January 8, 2026 at 3:48 pm
I am designing a complex lesson plan layout using tcolorbox. The design features specific vertical strips (margins) defined in the box's overlay. I use custom commands (\mrhala, \Time, \rems) based on TikZ to place content into these strips using absolute positioning relative to the page or box width. The Problem: The code works perfectly and aligns correctly when compiled with PDFLaTeX (LTR). However, my final document requires Arabic, so I must use XeLaTeX with polyglossia. When I switch to XeLaTeX, the horizontal positioning of these marginal notes breaks. They shift incorrectly or overlap, especially when used inside nested boxes. It seems that the coordinate calculations (e.g., \dimexpr, xshift) or the origin point (0,0) behave differently in the RTL context of XeLaTeX. Screenshots: Correct Output (PDFLaTeX): The marginal notes align perfectly with their columns. Incorrect Output (XeLaTeX with Polyglossia): The notes are shifted and misaligned. Minimal Working Example (MWE): \documentclass[a4paper]{article} \usepackage[margin=1cm]{geometry} \usepackage[most]{tcolorbox} \usepackage{amsmath,amssymb,mathtools,tikz,pifont,fontawesome,array,colortbl,varwidth,yagusylo,lipsum} \usetikzlibrary{calc,shapes.geometric,backgrounds} \renewcommand{\baselinestretch}{1.2} \pagestyle{empty} \parindent=0mm \newlength\BDmainW \newcommand\BDid{} % identifier of the current BoxDars \newlength\marahil \setlength\marahil{1.25cm} \newlength\modat \setlength\modat{1cm} \newlength\REMS \setlength\REMS{2.5cm} \newtcolorbox[auto counter]{BoxDars}{ enhanced,breakable, blanker,top=10mm, leftupper=\marahil+1mm, rightupper=\modat+\REMS+1mm, colback=white, bottom=3mm, before skip=3pt, after skip=10pt, parbox=false, before upper={% \edef\BDid{\thetcbcounter}% \setlength{\BDmainW}{\linewidth}% \tikz[remember picture,overlay]\coordinate (BDstart-\BDid) at (0,0);% }, overlay={ % Header background \draw[very thick,fill=orange!45] (interior.north west) rectangle ([yshift=-8mm]interior.north east); % Main Frame \draw[very thick,red!50!black] (interior.south west) rectangle (interior.north east); % --- Vertical Dividers --- % 1. Stages Divider (Left side) \draw[very thick,red!50!black] ([xshift=\marahil]interior.north west) -- ([xshift=\marahil]interior.south west); % 2. Remarks Divider (Right side) \draw[very thick,red!50!black] ([xshift={-\REMS}]interior.north east) -- ([xshift={-\REMS}]interior.south east); % 3. Time Divider (Right side, next to Remarks) \draw[very thick,red!50!black] ([xshift={-\modat - \REMS}]interior.north east) -- ([xshift={-\modat - \REMS}]interior.south east); % --- Header Labels --- % Stages Label (Left) \node[yshift=-4mm, font=\bfseries\small] at ([xshift=0.5*\marahil]interior.north west |- interior.north east) {Stages}; % Lesson Elements Label (Center) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={0.5*\linewidth +\marahil - \modat-\REMS}]interior.north west |- interior.north east) {Lesson Elements}; % Time Label (Right) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={ -(0.5*\modat+\REMS)}]interior.north east |- interior.north west) {Time}; % Remarks Label (Right) \node[yshift=-4mm, font=\bfseries\small] at ([xshift={-0.5*\REMS}]interior.north east |- interior.north west) {Notes}; }} \newcommand{\whichbox}{% \ifnum\value{tcblayer}=0 Outside any box% \else Box \Roman{tcblayer}% \fi } \newcommand{\Time}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr\BDmainW+1mm+\modat/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[anchor=base, text width=\modat, align=center] at ([yshift=#1]target) {% {\large\yagding[ifsymclock]{148}}\\#2% }; \end{tikzpicture}% } \newcommand{\rems}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr\BDmainW+1mm+\modat+\REMS/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[anchor=base, text width=\REMS, align=center, font=\small] at ([yshift=#1]target) {#2}; \end{tikzpicture}% } \newcommand{\mrhala}[2][0pt]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \coordinate (A) at (0,0); \coordinate (X) at ([xshift=\dimexpr-1mm-\marahil/2\relax] BDstart-\BDid); \coordinate (target) at (X |- A); \node[inner sep=0, rotate=90] at ([yshift=#1]target) {#2}; \end{tikzpicture}% } \newtcolorbox{box1}{ title=Title: \whichbox, colframe=blue!50!black, colback=blue!5 } \newtcolorbox{box2}{colframe=red!50!black, colback=red!5, title=Nested Box (Level 2)} \newtcolorbox{box3}{colframe=green!50!black, colback=green!5, title=Deep Nested Box (Level 3)} \begin{document} \begin{BoxDars} \section*{Main Lesson Content} This is the main text area. The margins are handled automatically. \mrhala{Start} \Time{10 min} \rems{Intro Note} \vspace{1cm} \begin{box2} We are now inside a nested box. Notice how the indentation changes for the text, but the margin notes below will still snap to the main columns. \mrhala{Step 2} \Time{30 min} \lipsum[1][1-2] \begin{box3} Inside a deeply nested box... Even here, the commands reference the physical page edge. \rems{Deep Note} \Time{15 min} \mrhala{Final} \end{box3} \end{box2} \rems[3mm]{Final remarks} \end{BoxDars} \end{document} Below is the code. If you run it with pdflatex, it works. If you uncomment the polyglossia lines and run with xelatex, it breaks. Question: How can I adapt the coordinate calculations (specifically \dimexpr logic inside \mrhala, \Time, and \rems) to be robust in XeLaTeX/RTL, so that the notes align to the physical columns of BoxDars regardless of the nesting level?
- tabularray indent after first table row and tablenotesby Matteo on January 8, 2026 at 3:42 pm
Hi I'm working on a table and wish to have a small indent after the first table row (Complete) for the following row names (Single and Dupli.). In fact, those are subcategories which sum adds up to form the value in Complete. For now, I found this hack of setting their alignment to the right but I was considering the possibility of using \multirow somehow and have everything in one entry; I'm not sure is the correct approach though. Also, I added a note under the table which happens to align all the way to the left instead of being positioned under the table and I'm unable to fix it... thanks in advance! MWE \documentclass[11pt]{article} \usepackage[letterpaper,left=0in,right=0in,top=1in,bottom=1in]{geometry} \usepackage{caption} \captionsetup[table]{name=Supplementary Table,labelfont=bf,position=top} \usepackage{tabularray} \UseTblrLibrary{siunitx} \UseTblrLibrary{booktabs} \usepackage{threeparttable} \begin{document} \begin{table}[htbp] \centering \caption{Gene completeness of the current \textsc{t2t} genomes} \begin{threeparttable} \scriptsize \begin{tblr}{ colspec={l*{12}{S[table-format=2.2,table-space-text-post=\unit{\percent}]}}, column{1}={font=\bfseries}, column{2-13}={}, row{1}={guard,font=\ttfamily,rowsep=1pt}, row{2}={guard,rowsep=1pt}, row{3}={guard,font=\itshape,rowsep=1pt}, cell{5,6}{1}={r}, row{4-Z}={rowsep=.5pt}, cell{4-8}{2-13}={appto={\%}}, hspan=minimal } \toprule & \SetCell[c=12]{halign=c} BUSCO & & & & & & & & & & & \\ \cmidrule{2-13} & \SetCell[c=1,r=2]{halign=c} CHM13v2 & \SetCell[c=1,r=2]{halign=c} GRCh38p14 & \SetCell[c=2]{halign=c} HG002v1.1 & & \SetCell[c=2]{halign=c} I002Cv0.7 & & \SetCell[c=2]{halign=c} REPv1.1 & & \SetCell[c=2]{halign=c} YAOv2.0 & & \SetCell[c=2]{halign=c} H9v1.0 \\ \cmidrule[lr]{4-5}\cmidrule[lr]{6-7}\cmidrule[lr]{8-9}\cmidrule[lr]{10-11}\cmidrule[l]{12-13} & & & hap1 & hap2 & hap1 & hap2 & hap1 & hap2 & hap1 & hap2 & hap1 & hap2 \\ \cmidrule{2-13} Complete & 99.81 & 99.83 & 99.81 & 99.80 & 97.61 & 99.82 & 97.60 & 99.83 & 99.72 & 99.70 & 99.60 & 99.86 \\ Single & 99.07 & 99.07 & 99.11 & 99.11 & 96.88 & 99.13 & 96.86 & 99.11 & 96.32 & 99.00 & 96.87 & 99.14 \\ Dupli. & 0.74 & 0.76 & 0.70 & 0.69 & 0.73 & 0.69 & 0.74 & 0.70 & 3.40 & 0.70 & 0.72 & 0.68 \\ Fragmented & 0.15 & 0.14 & 0.15 & 0.16 & 0.18 & 0.15 & 0.19 & 0.15 & 0.15 & 0.16 & 0.18 & 0.14 \\ Missing & 0.03 & 0.03 & 0.04 & 0.03 & 2.21 & 0.03 & 2.22 & 0.03 & 0.13 & 0.14 & 2.22 & 0.03 \\ \bottomrule \end{tblr} \centering \begin{tablenotes} \tiny \item[*] Total number of genes is \num{12277} according to \emph{mammalia\_odb12} \end{tablenotes} \end{threeparttable} \end{table} \end{document}
- Mixing LTR and RTL languages with lualatex, babel and \lettrineby Daniel Flipo on January 8, 2026 at 2:31 pm
The \lettrine command works as expected in documents written in monolingual LTR or RTL languages, but fails in multilingual documents in English and Hebrew as shown by the following example: \documentclass{article} \usepackage[bidi=basic, hebrew, english]{babel} \babelfont{rm}{Times New Roman} \babeltags{he = hebrew} \usepackage{lettrine} \renewcommand{\LettrineTextFont}{\upshape} % No small caps \begin{document} \lettrine{H}{ello} world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world. \begin{he} \lettrine[lines=3, refstring]{ב} שנות הששים הושפעתי מקליגרפיה עתיקה כמו זו של מגילות ים המלח והעתקתי ידנית פסקאות מן התנ"ך בסגנון הקליגרפיה של מגילות ים המלח. כשגרתי בישראל התחלתי לפתח סגנון משלי בקליגרפיה עברית. לפני כעשר שנים, לאחר שפרשתי, גליתי שיש תוכנות מחשב נגישות לעצוב פונטים. בערבי החורף הארוכים של צפון-מזרח ארה"ב, שפרתי בהדרגה את הגופן על המחשב. אחרי מספר שנים הצגתי על האינטרנט גופן True Type שקראתי לו "Mike Hebrew". דף הגופן הזה זכה ל- 58,000 בקורים ו- 25,250 הורדות של הגופן. הצעד הבא היה לעצב את הגופן על רמה מקצועית בטכנולוגיה עדכנית של Open Type. לגופן הזה קראתי "שונית," על שם רעייתי. \end{he} \lettrine[lines=3,lhang=.5]{H}{ello} world Hello world Hello world Hello Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world. \end{document} and its output: The Hebrew dropped cap is pushed into the right margin (as if option lhang=1 was passed to \lettrine)… Replacing the \begin{he} ... \end{he} environment by {\selectlanguage{hebrew} ... } doesn't fix the dropped cap placement.
- How to use turn coordinate specification in combination with global transforms like scale and shift?by dsacre on January 8, 2026 at 1:54 pm
Scenario Consider the following: One needs to draw from a point on a curve following its tangent direction. TikZ provides for this scenario the ([turn]<ANGLE>:<DISTANCE>) syntax. As one continues the image, it becomes too big for the page layout. In order to prevent having to recreate the complete image with a smaller size, one tries to use the scale parameter (globally on the tikzpicture or via scope does not make a difference for this scenario). MWE \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} % DESCRIPTION: Plain, no modification % STATUS: WORKING \draw[black] (0,0) arc(0:90:-1.5 and 1.5) arc(90:135:-2.0 and 2.0) --([turn]0:0.5) node[below]{plain} ; % DESCRIPTION: Scale % STATUS: FAIL \begin{scope}[scale=0.5] \draw[red] (0,0) arc(0:90:-1.5 and 1.5) arc(90:135:-2.0 and 2.0) --([turn]0:0.5) node[below]{scale} ; \end{scope} % DESCRIPTION: Shift % STATUS: FAIL \begin{scope}[xshift=5cm] \draw[red] (0,0) arc(0:90:-1.5 and 1.5) arc(90:135:-2.0 and 2.0) --([turn]0:0.5) node[below]{xshift} ; \end{scope} \end{tikzpicture} \end{document} Result As soon as transformation are applied, the result of the ([turn]<ANGLE>:<DISTANCE>) specification is wrong. Research so far It was tried to encapsulate the \draw command into a TikZ pic, hoping that this might act as a wrapper, but the result was identical. The corresponding section 13.4.2: Rotational Relative Coordinates of the TikZ manual specifies: The effect of this key is to locally shift the coordinate system so that the last point reached is at the origin and the coordinate system is “turned” so that the (x)-axis points in the direction of a tangent entering the last point. From that, I would assume that certain global transforms cannot/will not be taken into account properly. Question Is it possible to use the ([turn]<ANGLE>:<DISTANCE>) syntax under (global) transformations? If not, is there another option to achieve the same functionality or an easy way to implement it?
- Weird issue with thmtools and hyperref / cleverref [duplicate]by ChesterX on January 8, 2026 at 8:32 am
So I am having this issue with my setup. I am using hyperref and thmtools for referencing. It always shows the correct name and numbering in the compiled PDF, but for some of the references, clicking on it takes to a completely different one. If I don't use thmtools, at least the links work. But now it is not guessing the environment names correctly. The MWE explains it best. \documentclass{article} \usepackage{lipsum} \usepackage{hyperref} \usepackage[capitalize,nameinlink]{cleveref} \usepackage{thmtools} % Removing this solves the issue. \newtheorem{theorem}{Theorem}[section] \title{Very Important Stuff} \author{ John Doe\thanks{Department of Science, Scientific Institute of Science. \href{mailto:doe@doedle.com}{\texttt{doe@doedle.com}}} } \begin{document} \maketitle \begin{abstract} \lipsum[1] \end{abstract} \section{Introduction} \lipsum[1-3]\\[2em] See \autoref{thm:mainTheorem}. The autoref compiles correctly to ``Theorem 2.1", but clicking it takes to ``Theorem 1.1" (\autoref{thm:usefulTheorem}). The reference \autoref{thm:anotherUsefulTheorem} works exactly as intended. Similarly, \autoref{thm:anotherMainTheorem} compiles correctly to ``Theorem 2.2'', but points to ``Theorem 1.2'' (\autoref{thm:anotherUsefulTheorem}).\\[2em] \lipsum[1-2] \begin{theorem}\label{thm:usefulTheorem} \lipsum[1] \end{theorem} \lipsum[1-2] \begin{theorem}\label{thm:anotherUsefulTheorem} \lipsum[1] \end{theorem} \section{Main Stuff} \lipsum[1-2] \begin{theorem}\label{thm:mainTheorem} \lipsum[1] \end{theorem} \lipsum[1-2] \begin{theorem}\label{thm:anotherMainTheorem} \lipsum[1] \end{theorem} \lipsum[1-2]\\[2em] Even after ``Theorem 2.1'' has been defined, clicking on \autoref{thm:mainTheorem} takes to ``Theorem 1.1", while compiling correctly to ``Theorem 2.1''. Similarly \cref{thm:anotherMainTheorem} points to ``Theorem 1.2'', while compiling correctly to ``Theorem 2.2''.\\[2em] \lipsum[1-2]\\[2em] Cleverref has similar behavior as well : \cref{thm:mainTheorem} points to ``Theorem 1.1'', while printing ``Theorem 2.1''.\\[2em] \lipsum[1-2] \end{document} I have tried to compile the code on overleaf, with the same issue. But, if I change the TeX Live version to 2024, some of the issue goes away, but not all! This makes me think it has to be a some recently updated package. thmtools was last updated on 2023, so the culprit might be hyperref! Any help will be appreciated! Cheers.
- Attempting to place section heads in the outer a margin resulting in undesired vertical spacing and indentationby Gary on January 8, 2026 at 3:15 am
I'm trying to figure out my error in placing section heads in the outer margin. The result I'm getting is that there is too much vertical space before a Roman-numeral-annotated paragraph (indicated by \Rmnhd) that starts a section than one that does not start a section. That is shown in the first screen shot below. There is too much space between paragraphs I. and III.; for they should be just as II. and IV., both of which are slightly larger than the global white space. When I removed the \Rmnhd command, the vertical space appears correct but the indentation of paragraphs I. and III. is too short; yet II. and IV. appear to be indented according to the global \setupindenting. That is shown in the second screen shot below. I've tried experimenting with the options in \setuphead[section] but I have not been able to determine my error or omission. The example code is at the end. I do not doubt that I'm doing something very stupid and/or overlooking the obvious. Thank you for your assistance. \definepapersize[book][width=8.16in,height=10.66in][letter] \setuppapersize[book] \setuppagenumbering[alternative=doublesided,location=] \definelayout[main][ location=duplex, backspace=1.33in, topspace=0.33in, top=0.33in, topdistance=0in, width=5.0in, height=fit, headerdistance=0.125in, footerdistance=0.150in, header=\lineheight, footer=\lineheight, bottom=0.555in, bottomdistance=0in, leftedge=1.33in, rightmargin=1.375in, rightmargindistance=0.125in] \setupbodyfont[libertinus,12pt] \definefont[MarginOuterFont][name:chorus*default at 12pt][line=2.8ex] \definefontfeature [default] [default] [protrusion=quality,expansion=quality] \setupalign[justified,hyphenated,hanging,hz] \setupindenting[yes,medium,next] \setupinterlinespace[2.8ex] \define[0]\Rmnhd{\sc\blank[1ex]} % \define[0]\Rmnhd{\sc} \definetext[chapter][footer][pagenumber] \definepagebreak [ChapterPageBreak] [yes] \setuphead [chapter][ page=ChapterPageBreak, header=empty, footer=chapter, numbercommand=\sc, % command=\MyChapter, after=\blank[0.5ex], conversion=romannumerals] \definemargindata [inoutermargin] [outer][ margin=margin, width=\rightmarginwidth, line=2, location=outer, align=middle] \define[2]\MyHead{\inoutermargin{#1 #2}} \setuphead [section] [alternative=text, number=no, style=\MarginOuterFont, % See comment of Wolfgang Schuster at https://tex.stackexchange.com/q/757772/324837 % The default spacing (before={\blank[2*big]}) can be removed by using (before=,). before=, % after=, beforesection=, aftersection=, inbetween=, distance=0pt, textdistance=0pt, % insidesection=\indentation, indentnext=yes, command=\MyHead ] \definecommand Text \samplefile{ward} \starttext \startbodymatter[page=right] \startchapter[title={Inconsistent Added Spacing Before Rom. Nums.}] \samplefile{ward} \startsection[title={Section One}] {\Rmnhd I.\ An introductory sentence about Point One.}\Text \samplefile{ward} {\Rmnhd II.\ An introductory sentence about Point Two.}\Text \samplefile{ward} \stopsection \startsection[title={Section Two}] {\Rmnhd III.\ An introductory sentence about Point Three.}\Text \stopsection {\Rmnhd IV.\ An introductory sentence about Point Three.}\Text \stopchapter \startchapter[title={Consistent No Added Spacing Before Rom. Nums.}] \samplefile{ward} \startsection[title={Section One}] I.\ An introductory sentence about Point One. \Text \samplefile{ward} II.\ An introductory sentence about Point Two. \Text \samplefile{ward} \stopsection \startsection[title={Section Two}] III.\ An introductory sentence about Point Three. \Text \stopsection IV.\ An introductory sentence about Point Three. \Text \stopchapter \stopbodymatter \stoptext ADDED: I think I have the alternative wrong in \setuphead; and it should not be text or margin but margintext. Using that and setting before=\blank[1ex] (the same as in \Rmnhd) and adding \indentation to \Rmnhd appears to provide the desired result below. I assume that the \blank[1ex] is ignored in a \Rmnhd starting a section because the section is to control that white space following the title. Only changes to above example code are: \setuphead [section] [alternative=margintext, number=no, style=\MarginOuterFont, % See comment of Wolfgang Schuster at https://tex.stackexchange.com/q/757772/324837 % The default spacing (before={\blank[2*big]}) can be removed by using (before=,). before=\blank[1ex], %after=, beforesection=, aftersection=, inbetween=, %textdistance=0pt, % distance=0pt, % after=\indentation, % indentnext=yes, command=\MyHead ] \define[0]\Rmnhd{\sc\blank[1ex]\indentation}
- How can I make a multi-line table structure with repeated parameter values more visually appealing?by mingabua on January 7, 2026 at 6:07 pm
I have the following table. I am particularly interested in columns 1-2. There, I have three different values of \mathcal{T} for each value of \mathcal{J}. Unfortunately, I find the current display somewhat meaningless. How can I optimize it and make it look better? \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{booktabs} \usepackage{multirow} \usepackage{array} \usepackage{rotating} % für sidewaystable \usepackage{lipsum} % für Blindtext \usepackage{geometry} \geometry{a4paper, margin=2.5cm} \begin{document} \section{Introduction} \lipsum[1-3] \begin{sidewaystable}[p] \centering \footnotesize \caption{Comprehensive performance analysis over 25 scenarios per instance. Values denote: \textbf{Min / Median / Max} (top) and \textbf{Std. Dev.} (bottom). Time components MP, SP, Heur, Branch are reported as percentages of Total Time.} \label{tab:comp_results_comprehensive} \setlength{\tabcolsep}{2pt} \renewcommand{\arraystretch}{1.3} \begin{tabular}{cc cc c cccccc c ccc c ccccc} \toprule % HEADER ROW 1 \multicolumn{2}{c}{\textbf{Inst.}} & \multicolumn{2}{c}{\textbf{Compact}} & & \multicolumn{6}{c}{\textbf{B\&P: Solution \& Reliability}} & & \multicolumn{3}{c}{\textbf{B\&P: Tree}} & & \multicolumn{5}{c}{\textbf{B\&P: Time Breakdown}} \\ \cmidrule(r){1-2} \cmidrule(lr){3-4} \cmidrule(lr){6-11} \cmidrule(lr){13-15} \cmidrule(l){17-21} % HEADER ROW 2 $|\mathcal{J}|$ & $|\mathcal{T}|$ & Time [s] & Gap [\%] & & $t_{tot}$ [s] & Gap [\%] & $t_{1st}$ [s] & $N_{Sol}$ & Opt? & Root Int. & & $D_{max}$ & Root Gap & Nodes & & $t_{MP} [\%]$ & $t_{SP} [\%]$ & $t_{Heur} [\%]$ & $t_{Root} [s]$ & $t_{Br} [\%]$ \\ \midrule % --- Block J = 5 --- \multirow{3}{*}{5} & 7 & \shortstack{10/12/15\\1.2} & \shortstack{0/0/0\\0} & & \shortstack{2/3/5\\0.8} & \shortstack{0/0/0\\0} & \shortstack{0.5/0.8/1\\0.2} & \shortstack{2/3/5\\1.1} & \shortstack{1/1/1\\0} & \shortstack{0/0/1\\0.2} & & \shortstack{1/1/1\\0} & \shortstack{0.5/1/2\\0.4} & \shortstack{1/1/1\\0} & & \shortstack{5/10/15\\2} & \shortstack{40/45/50\\3} & \shortstack{10/15/20\\4} & \shortstack{1/2/3\\0.5} & \shortstack{0/0/0\\0} \\ \addlinespace & 14 & \shortstack{40/45/55\\4.1} & \shortstack{0/0/0\\0} & & \shortstack{6/8/11\\1.5} & \shortstack{0/0/0\\0} & \shortstack{1/2/3\\0.5} & \shortstack{3/5/8\\1.5} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{1/3/5\\1} & \shortstack{0.2/0.8/1.5\\0.3} & \shortstack{1/5/12\\3} & & \shortstack{8/12/18\\3} & \shortstack{55/60/65\\4} & \shortstack{10/12/15\\2} & \shortstack{3/4/5\\1} & \shortstack{1/2/5\\1} \\ \addlinespace & 28 & \shortstack{150/180/210\\15} & \shortstack{0/0/0\\0} & & \shortstack{18/22/29\\4} & \shortstack{0/0/0\\0} & \shortstack{5/8/12\\2} & \shortstack{5/10/15\\3} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{5/8/12\\3} & \shortstack{0/0.5/1\\0.2} & \shortstack{10/25/45\\10} & & \shortstack{10/15/20\\3} & \shortstack{70/75/80\\5} & \shortstack{5/8/10\\2} & \shortstack{10/12/15\\2} & \shortstack{2/5/8\\2} \\ \midrule % --- Block J = 10 (Base Case) --- \multirow{3}{*}{10} & 7 & \shortstack{90/110/140\\12} & \shortstack{0/0/0\\0} & & \shortstack{10/12/18\\2} & \shortstack{0/0/0\\0} & \shortstack{2/3/5\\1} & \shortstack{4/6/9\\2} & \shortstack{1/1/1\\0} & \shortstack{0/0/1\\0.1} & & \shortstack{1/1/3\\0.5} & \shortstack{1/1.5/2.5\\0.5} & \shortstack{1/1/3\\0.5} & & \shortstack{15/20/25\\4} & \shortstack{35/40/55\\6} & \shortstack{15/20/25\\3} & \shortstack{5/6/8\\1} & \shortstack{0/1/2\\0.5} \\ \addlinespace & 14 & \shortstack{1.1k/1.2k/1.5k\\150} & \shortstack{0/0/2\\0.5} & & \shortstack{35/45/60\\6} & \shortstack{0/0/0\\0} & \shortstack{10/15/20\\4} & \shortstack{8/12/18\\4} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{5/10/15\\4} & \shortstack{0.5/1.1/1.8\\0.4} & \shortstack{20/55/110\\25} & & \shortstack{12/18/22\\4} & \shortstack{50/58/65\\5} & \shortstack{8/10/15\\2} & \shortstack{15/20/25\\4} & \shortstack{5/10/15\\3} \\ \addlinespace & 28 & \shortstack{TL/TL/TL\\0} & \shortstack{2/4.5/8\\1.8} & & \shortstack{95/115/145\\14} & \shortstack{0/0/0\\0} & \shortstack{30/45/60\\10} & \shortstack{15/25/40\\8} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{20/35/60\\12} & \shortstack{0.1/0.4/0.9\\0.2} & \shortstack{150/320/580\\110} & & \shortstack{10/15/20\\3} & \shortstack{65/72/85\\8} & \shortstack{2/5/8\\2} & \shortstack{40/55/70\\10} & \shortstack{10/15/20\\5} \\ \midrule % --- Block J = 15 --- \multirow{3}{*}{15} & 7 & \shortstack{480/540/650\\55} & \shortstack{0/0/1.5\\0.3} & & \shortstack{22/29/40\\4} & \shortstack{0/0/0\\0} & \shortstack{5/8/12\\2} & \shortstack{6/10/15\\3} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{1/3/8\\2} & \shortstack{1.5/2.2/3.5\\0.8} & \shortstack{1/5/12\\3} & & \shortstack{20/25/30\\4} & \shortstack{40/45/55\\4} & \shortstack{15/20/25\\3} & \shortstack{10/12/18\\3} & \shortstack{1/3/5\\1} \\ \addlinespace & 14 & \shortstack{TL/TL/TL\\0} & \shortstack{5/8/12\\2} & & \shortstack{80/98/130\\12} & \shortstack{0/0/0\\0} & \shortstack{25/35/50\\8} & \shortstack{20/30/50\\10} & \shortstack{1/1/1\\0} & \shortstack{0/0/0\\0} & & \shortstack{10/25/45\\10} & \shortstack{0.8/1.5/2.2\\0.6} & \shortstack{80/150/280\\45} & & \shortstack{10/15/20\\3} & \shortstack{55/65/75\\7} & \shortstack{5/8/12\\2} & \shortstack{35/45/60\\8} & \shortstack{8/12/18\\4} \\ \addlinespace & 28 & \shortstack{TL/TL/TL\\0} & \shortstack{12/18/25\\4} & & \shortstack{210/245/320\\35} & \shortstack{0/0/0.1\\0.02} & \shortstack{80/120/180\\25} & \shortstack{40/60/90\\15} & \shortstack{0/1/1\\0.2} & \shortstack{0/0/0\\0} & & \shortstack{45/80/120\\25} & \shortstack{0.2/0.6/1.2\\0.3} & \shortstack{500/1.2k/3.5k\\850} & & \shortstack{5/10/15\\3} & \shortstack{70/80/90\\9} & \shortstack{1/3/5\\1} & \shortstack{80/110/150\\20} & \shortstack{15/20/25\\5} \\ \bottomrule \end{tabular} \end{sidewaystable} \section{Results Discussion} \lipsum[4-6] \section{Conclusion} \lipsum[7-8] \end{document}
- TikZ overlay alignment issues in nested tcolorboxes using absolute page coordinatesby Med Elhadi Kh on January 7, 2026 at 5:37 pm
I am designing a complex document layout using tcolorbox. The main container (BoxDars) has specific vertical strips (margins) defined in its overlay. I have created custom commands (\mrhala, \Time, \rems) to place content into these specific strips using TikZ overlays. The Problem: These commands work fine in the main box. However, when I use them inside nested boxes (e.g., inside box2 or box3), the horizontal positioning shifts incorrectly. I tried to compensate for the nesting depth using \value{tcblayer}, but the alignment is still inconsistent. Goal: I want the content of \mrhala, \Time, and \rems to strictly stick to their respective vertical columns defined in the parent BoxDars, regardless of how deep the nesting is. Here is my MWE: \documentclass[a4paper]{article} \usepackage[margin=1cm]{geometry} \usepackage[most]{tcolorbox} \usepackage{amsmath,amssymb,mathtools,,tikz,pifont,fontawesome,array,colortbl,varwidth,yagusylo,lipsum} \usetikzlibrary{calc,shapes.geometric,backgrounds} \renewcommand{\baselinestretch}{1.2} \pagestyle{empty} \parindent=0mm \def\marahil{1.25cm} \def\modat{1cm} \def\REMS{2.5cm} \newtcolorbox{BoxDars}{ enhanced,breakable, blanker,top=10mm, leftupper=\marahil+1mm, rightupper=\modat+\REMS+1mm, colback=white, bottom=3mm, before skip=3pt, after skip=10pt, parbox=false, overlay={ \draw[very thick,fill=orange!45] (interior.north west) rectangle ([yshift=-8mm]interior.north east); \draw[very thick,red!50!black] (interior.south west) rectangle (interior.north east); % Vertical lines (from RIGHT to LEFT for RTL labeling) % Rightmost divider: stages | rest \draw[very thick,red!50!black] ([xshift=\marahil]interior.north west) -- ([xshift=\marahil]interior.south west); % Next: stages | elemes cours | rest \draw[very thick,red!50!black] ([xshift={-\REMS}]interior.north east) -- ([xshift={-\REMS}]interior.south east); % Next: stages | elemes cours | times | rems \draw[very thick,red!50!black] ([xshift={-\modat - \REMS}]interior.north east) -- ([xshift={-\modat - \REMS}]interior.south east); \node[yshift=-4mm] at ([xshift=0.5*\marahil]interior.north west |- interior.north east) {stages}; \node[yshift=-4mm] at ([xshift={0.5*\linewidth +\marahil - \modat-\REMS}]interior.north west |- interior.north east) {elemes cours}; \node[yshift=-4mm] at ([xshift={ -(0.5*\modat+\REMS)}]interior.north east |- interior.north west) {times}; \node[yshift=-4mm] at ([xshift={-0.5*\REMS}]interior.north east |- interior.north west) {rems}; }} \newcommand{\whichbox}{% \ifnum\value{tcblayer}=0 Outside any box% \else Box \Roman{tcblayer}% \fi } \newcommand{\Time}[2][0]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \def\baseDist{-5.3} \pgfmathsetmacro{\timeShift}{\baseDist - 0.65 * (\value{tcblayer} - 1)} \coordinate (A) at (0,0); \coordinate (Edge) at (current page.north east |- A); \node at ([xshift=\timeShift cm, yshift=#1]Edge) { \begin{minipage}{1cm}\centering {\large\yagding[ifsymclock]{148}}\\ \normalsize {#2} \end{minipage} }; \end{tikzpicture}% } \newcommand{\rems}[2][0]{\leavevmode% \begin{tikzpicture}[remember picture,overlay] \def\baseDist{-3.6} \pgfmathsetmacro{\timeShift}{\baseDist - 0.55 * (\value{tcblayer} - 1)} \coordinate (A) at (0,0); \coordinate (Edge) at (current page.north east |- A); \node at ([xshift=\timeShift cm, yshift=#1]Edge) { {\begin{minipage}{2cm}\small\centering #2 \end{minipage}} }; \end{tikzpicture}% } \newcommand{\mrhala}[2][0]{\leavevmode% \tikz[overlay,remember picture,baseline=0pt]{% \def\baseDist{0.3} \pgfmathsetmacro{\newX}{\baseDist - (\value{tcblayer}-1)*0.3} \coordinate (A) at (0,0); \ifnum\value{tcblayer}>0 \coordinate (Edge) at (current page.north west |- A); \node[inner sep=0] at ([xshift=\newX cm, yshift=#1 mm]Edge) {\rotatebox{90}{#2}}; \fi }% } \newtcolorbox{box1}{ title=Title: \whichbox, colframe=blue!50!black, colback=blue!5 } \newtcolorbox{box2}{ title=Title: \whichbox, colframe=red!50!black, colback=red!5 } \newtcolorbox{box3}{ title=Title: \whichbox, colframe=green!50!black, colback=green!5 } \begin{document} helow \begin{BoxDars} Inside box1: \whichbox \mrhala{arg2} \Time{20} \begin{box2} Inside box2: \whichbox \mrhala{arg2} Inside box2: \whichbox Inside box2: \whichbox Inside box2: \whichbox Inside box2: \whichbox Inside box2: \whichbox Inside box2: \whichbox \begin{box3} Inside box3: \whichbox \Time{20} \end{box3} \end{box2} \rems{text text text} \begin{box3} Inside box3: \whichbox \rems{text text text} \end{box3} \end{BoxDars} \end{document} Question: How can I define the coordinates in my custom commands so that they ignore the indentation of nested boxes and align perfectly with the BoxDars vertical strips?
- Horizontal space between absolute value symbolsby J.-E. Pin on January 7, 2026 at 2:53 pm
Possibly related questions include Absolute values and height scaling on some symbols and Absolute Value Symbols but they do not seem to address my specific question. The code \documentclass[]{amsart} \begin{document} \LARGE $\lvert m_1 \rvert$ $\lvert m \rvert$ $|m_1|$ $|m|$ \end{document} produces the output in which $m$ is horizontally centred between the vertical bars, but $m_1$ is not. Wouldn't it be preferable for everything between the two bars to be automatically centred? In the meantime, is there any way to make my wish come true without too much work?
- How to typeset 'proof DAGS'by seldon on January 7, 2026 at 9:28 am
I'd like to render something like A ------------------------------ B C D ---------------- ------ E F ---------------------------- G In general, rather that rendering a proof tree I need to render a proof DAG, in which branches can sometimes rejoin. Is it possible with any of the existing packages?
- Forcing strict flush-left alignment in align* environments inside a minipage for algebra worksheetby Oregon Math Tutor on January 6, 2026 at 11:53 pm
Note: I attempted to mod the code in my OP by integrating Mr. Carlisle suggestions in the comments below. My implementation must be wrong because the render still results in the screenshot below. I am working on a math worksheet involving quadratic formula. My goal is to have every problem on the sheet strictly follow the alignment and layout of Problem #1 (top left in image below). Currently, Problem #1 renders correctly: The equation, variable list ($a=, b=, c=$), solution steps, and the final boxed answer are all flush-left. The vertical spacing is consistent. However, as seen in Problems #2, #3, and #4, the layout breaks when I introduce additional steps or explanatory text (e.g., "Set equal to 0"). These elements seem to force center alignment or inconsistent indentation, disrupting the visual flow. My Goal: code fix that forces Problems 2–4 to mimic the strict left-alignment and vertical spacing of Problem 1, regardless of whether there are extra text annotations or extra solution steps involved. This LaTeX project uses both .sty and .tex files (see below). Thanks very much for your assistance! I've tried long and hard to fix the problem without success. High probability that my .sty is not canonical LaTeX code. The document does compile in overleaf. mwe: .sty \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{quadratic-solutions}[2026/01/07 v2.2 Carlisle Fixes] % ================================================== % Core packages % ================================================== \RequirePackage[margin=0.75in]{geometry} \RequirePackage{xcolor} \RequirePackage{amsmath} \RequirePackage{amssymb} \RequirePackage{bm} \RequirePackage{calc} \RequirePackage{lmodern} % Essential for scalable fonts % ================================================== % Color definitions % ================================================== \definecolor{colorA}{RGB}{220, 53, 69} \definecolor{colorB}{RGB}{0, 123, 255} \definecolor{colorC}{RGB}{40, 167, 69} \definecolor{instructioncolor}{RGB}{80, 80, 80} \newcommand{\cola}[1]{{\color{colorA}#1}} \newcommand{\colb}[1]{{\color{colorB}#1}} \newcommand{\colc}[1]{{\color{colorC}#1}} % ================================================== % Header & Layout % ================================================== \newcommand{\assignmentheader}[2]{% \noindent\textbf{ASSIGNMENT #1 --- #2}\hfill\textbf{#1}\par \vspace{0.1in}\hrule\vspace{0.15in}% } \newenvironment{problembox}[2]{% \begin{minipage}[t]{0.48\textwidth}% \textbf{#1.} #2% }{% \end{minipage}% } \newcommand{\stephint}[1]{% \quad \text{\itshape\color{instructioncolor}(#1)}% } % ================================================== % Quadratic Formula Display % ================================================== \newcommand{\displayquadformula}{% \par\medskip \begin{center} \setlength{\fboxsep}{10pt}% \framebox{% {\fontsize{14}{17}\selectfont $x = \dfrac{-b \pm \sqrt{b^{2} - 4ac}}{2a}$}% }% \end{center} \medskip } % ================================================== % Solutions Environment (Strict Carlisle Fix) % ================================================== \newenvironment{solutions}{% \par\vspace{0.5em}% \noindent \setlength{\jot}{12pt}% <--- FIX: Percent sign prevents space $\displaystyle \begin{aligned}[t]% <--- FIX: Percent sign prevents space }{% \end{aligned}% <--- FIX: Percent sign prevents space $% \par\vspace{1em}% } % ================================================== % Final Answer Box % ================================================== \newcommand{\solutionbox}[2]{% \par\vspace{0.5em}% \noindent \setlength{\fboxsep}{8pt}% \framebox{$\displaystyle x = #1 \approx #2$}% \par\vspace{0.5em}% } \endinput .tex \documentclass[11pt]{article} \usepackage{quadratic-solutions} \begin{document} \assignmentheader{9-A}{QUADRATIC FORMULA PRACTICE} \noindent \textbf{PRACTICE:} Use the Quadratic Formula to solve each equation. Write answers as (a) exact values and (b) decimals rounded to the nearest hundredth. Show work. \displayquadformula \vspace{0.5cm} % ======================================================= % ROW 1 % ======================================================= \noindent \begin{problembox}{1}{$-x^{2} + 7x - 3 = 0$} \begin{solutions} \cola{a} &= \cola{-1},\quad \colb{b} = \colb{7},\quad \colc{c} = \colc{-3} \\ x &= \dfrac{-\colb{7} \pm \sqrt{\colb{7}^2 - 4(\cola{-1})(\colc{-3})}}{2(\cola{-1})} \\ x &= \dfrac{-7 \pm \sqrt{37}}{-2} \end{solutions} \solutionbox{\dfrac{-7 \pm \sqrt{37}}{-2}}{0.46 \text{ or } 6.54} \end{problembox} \hfill \begin{problembox}{2}{$x^{2} + 6x = 10$} \begin{solutions} x^{2} + 6x &= 10 \stephint{Set equal to $0$} \\ x^{2} + 6x - 10 &= 0 \\ \cola{a} &= \cola{1},\quad \colb{b} = \colb{6},\quad \colc{c} = \colc{-10} \\ x &= \dfrac{-\colb{6} \pm \sqrt{\colb{6}^2 - 4(\cola{1})(\colc{-10})}}{2(\cola{1})} \end{solutions} \solutionbox{-3 \pm \sqrt{19}}{1.36 \text{ or } -7.36} \end{problembox} \vspace{0.5cm} \hrule \vspace{0.5cm} % ======================================================= % ROW 2 % ======================================================= \noindent \begin{problembox}{3}{$2x^{2} = 4x + 3$} \begin{solutions} 2x^{2} &= 4x + 3 \stephint{Move terms left} \\ 2x^{2} - 4x - 3 &= 0 \\ \cola{a} &= \cola{2},\quad \colb{b} = \colb{-4},\quad \colc{c} = \colc{-3} \\ x &= \dfrac{4 \pm \sqrt{16 + 24}}{4} \end{solutions} \solutionbox{\dfrac{2 \pm \sqrt{10}}{2}}{2.58 \text{ or } -0.58} \end{problembox} \hfill \begin{problembox}{4}{$4x^{2} + 81 = 36x$} \begin{solutions} 4x^{2} + 81 &= 36x \stephint{Set equation $= 0$} \\ 4x^{2} - 36x + 81 &= 0 \\ \cola{a} &= \cola{4},\quad \colb{b} = \colb{-36},\quad \colc{c} = \colc{81} \\ x &= \dfrac{36 \pm 0}{8} \end{solutions} \solutionbox{\dfrac{36}{8}}{4.5} \end{problembox} \end{document}
- Define commands inside foreach loopby kaba on January 6, 2026 at 8:29 pm
I'm trying to define commands inside a pgffor \foreach loop, where the command-names depend both on the a macroparameter and the loop parameters. However, I get "First argument of '\NewDocumentCommand' must be a command.". What is wrong, and how can it be fixed? \documentclass[a4paper,12pt]{article} \usepackage{pgffor} \NewDocumentCommand{\CreateMyCommands}{m}{ \foreach \x/\a in {x/a,y/b} { \global\NewDocumentCommand{\csname #1\x\endcsname}{}{#1\a} } } \CreateMyCommands{f} \begin{document} \fx \fy \end{document} A smaller example which seems to demonstrate the problem is: \documentclass[a4paper,12pt]{article} \usepackage{pgffor} \foreach \x in {x} { \global\NewDocumentCommand{\csname f\endcsname}{}{a} } \begin{document} \f \end{document}