Week
- How to draw/visualize/simulate to show the diffence between the two almost identical curves?by Black Mild on September 1, 2026 at 9:45 am
This question is related to an interesting question on mathSE. The blue curve $E$ is the ellipse $\left(\frac{4x}{\pi}\right)^2+\left(\frac{y}{\ln\left(\sqrt2+1\right)}\right)^2=1$ and the red curve $L$ is $y^2=\ln^2\left(\sqrt2\cos x-\sqrt{\cos(2x)}\right)$ are almost identical in shapes. So far several answers show that they are different (some 1/10000) but almost identical (it's still open for that exact value/measure of how different they are). Naturally we want to see the difference. The question is to draw/visualize/simulate how different they are. It's interesting in mathematics but challenging in drawing due to very small diffrences. I can draw them (the code below is a MWE); the below left is E over thicker L, the below right is L over a thicker E; however we can not see the difference. Any tools (tikz, pgfplot, asymptote, luadraw, julia, ...) are allowed (standalone can be integrated into LaTeX/beamer). I just think of f(x)-g(x), f(x)/g(x), ... then scale by 10000 in graph, but not yet clear and complete. Please explain some maths behind your way, if any. // https://asymptote.ualberta.ca/ // https://math.stackexchange.com/questions/5147646/why-is-this-curve-almost-an-ellipse-y2-ln2-left-sqrt2-cos-x-sqrt-cos2x/5148177 // The blue curve $E$ is the ellipse $\left(\frac{4x}{\pi}\right)^2+\left(\frac{y}{\ln\left(\sqrt2+1\right)}\right)^2=1$. import graph; usepackage("amsmath"); size(12cm); real a = pi/4; // \approx 0.7854 real b = log(sqrt(2)+1); // = arcsinh(1) \approx 0.8814 write(a); write(b); // The ellipse E real xE(real t) { return a*cos(t); } real yE(real t) { return b*sin(t); } // The curve L real yL_upper(real x) { // Tránh sai số dấu phẩy động lân cận nghiệm bằng hàm max real u = sqrt(max(cos(2*x), 0)); return log(u + sqrt(u^2 + 1)); } real yL_lower(real x) { return -yL_upper(x); } // draw on a picture with pen void draw_curve_E(picture pic=currentpicture, pen p) { draw(pic, graph(xE, yE, 0, 2*pi), p); } void draw_curve_L(picture pic=currentpicture, pen p) { path upper = graph(yL_upper, -a, a, operator ..); path lower = reverse(graph(yL_lower, -a, a, operator ..)); draw(pic, upper -- lower -- cycle, p); } pen penE = blue+1pt; pen penL = red+1pt; pen draw_first = opacity(.3) + 4pt; picture picaxes, picE, picL, picEL, picLE; real extra = .1; xaxis(picaxes, -a-extra, a+extra, gray); yaxis(picaxes, -b-extra, b+extra, gray); add(picE,picaxes); add(picL,picaxes); add(picEL,picaxes); add(picLE,picaxes); draw_curve_E(picE, penE); string sE=" \begin{minipage}[C]{6cm} \[ \left(\frac{4x}{\pi}\right)^2+ \left(\frac{y}{\ln(\sqrt2+1)}\right)^2=1 \] \begin{align*} a&=\pi/4 \approx 0.7854\\ b&=\ln(\sqrt2+1)\\ &=\operatorname{arsinh}(1)\approx0.8814 \end{align*} \[ \frac{x^2}{a^2}+\frac{y^2}{b^2}=1 \] \end{minipage}"; label(picE,Label(scale(.6)*sE,penE),(-a-extra,0),W); draw_curve_L(picL, penL); string sL=" \begin{minipage}[C]{6cm} $$y^2=\ln^2\left(\sqrt2\cos x-\sqrt{\cos(2x)}\right)$$ $$2\sin^2x +\sinh^2 y=1$$ \end{minipage}"; label(picL,Label(scale(.6)*sL,penL),(a+extra,0),E); draw_curve_E(picEL, penE + draw_first); draw_curve_L(picEL, penL); draw_curve_L(picLE, penL + draw_first); draw_curve_E(picLE, penE); real dx=1, dy=1.8; add(shift(-dx,0)*picE); add(shift(dx,0)*picL); add(shift(-dx,-2dy)*picEL); add(shift(dx,-2dy)*picLE); label("They are different but almost identical!",(0,-dy-.2)); label("How do we see their difference ?",(0,-2dy-b-.8)); //shipout(bbox(2mm,invisible)); shipout(bbox(2mm,Fill(.2yellow+.8white)));
- How to draw realistic, semi-3D chemistry glassware (volumetric flask) in pure TikZ?by user446526 on September 1, 2026 at 8:34 am
I am trying to recreate an educational chemistry diagram illustrating the dilution of a solution using pure TikZ. Here is the target image I want to emulate (specifically the realistic, glossy 3D look of the glassware and liquid): I have made an initial attempt at drawing the volumetric flask and adding some basic gradients to simulate a 3D effect and control the water level. Here is my current Minimal Working Example (MWE), which is stripped of all custom fonts and language packages, along with a screenshot of my current output: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm, y=1cm] % Water level control \def\waterlevel{-0.5} % Main flask path \def\flaskpath{ (0,-2.115) .. controls (1.85,-2.0) and (0.2,-0.45) .. (0.225,-0.01) .. controls (0.15,1.95) and (0.25,1.55) .. (0.25,1.725) .. controls (0.175,2.15) and (0.3,2.15) .. (0.3,2.225) .. controls (0.2,2.35) and (-0.2,2.35) .. (-0.3,2.225) .. controls (-0.3,2.15) and (-0.175,2.15) .. (-0.25,1.725) .. controls (-0.25,1.55) and (-0.15,1.95) .. (-0.225,-0.01) .. controls (-0.2,-0.45) and (-1.85,-2.0) .. cycle } % 1. Flask glass (3D transparent background) \fill[left color=gray!10, right color=gray!30, middle color=white, opacity=0.4] \flaskpath; % 2. Liquid with 3D gradient \begin{scope} \clip \flaskpath; \fill[left color=blue!60!black, right color=blue!40, middle color=blue!15, opacity=0.85] (-2,-2.2) rectangle (2, \waterlevel); % Liquid surface line \draw[blue!80!black, thick, opacity=0.6] (-1, \waterlevel) -- (1, \waterlevel); \end{scope} % 3. Flask outline \draw[line width=1.3pt, color=black!75] \flaskpath; % 4. Top stopper/neck details \draw[line width=1.3pt, color=black!75] (-0.3,2.225) .. controls (-0.15,2.125) and (0.15,2.125) .. (0.3,2.225); \draw[line width=1.3pt, color=black!75] (-0.25,2.275) .. controls (-0.15,2.2) and (0.15,2.2) .. (0.25,2.275); \draw[line width=1.3pt, color=black!75, left color=gray!5, right color=gray!40, middle color=white] (0.25,2.275) .. controls (0.15,2.325) and (0.15,2.375) .. (0.175,2.425) .. controls (0.45,2.5) and (0.3,2.7) .. (0,2.675) .. controls (-0.3,2.7) and (-0.45,2.5) .. (-0.175,2.425) .. controls (-0.15,2.375) and (-0.15,2.325) .. (-0.25,2.275) .. controls (-0.1,2.325) and (0.1,2.325) .. (0.25,2.275); \draw[line width=1.3pt, color=black!75] (-0.25,2.625) .. controls (-0.15,2.575) and (0.15,2.575) .. (0.25,2.625); % 5. Calibration mark (red ring on the neck) \draw[line width=1pt, red!70!black] (-0.23, 1.2) .. controls (-0.1, 1.15) and (0.1, 1.15) .. (0.23, 1.2); \end{tikzpicture} \end{document} My question: How can I further improve the shading, highlights, and transparency of this TikZ code to closely match the professional, glossy 3D rendering seen in the target image? (Note: I am looking for a pure TikZ solution and prefer not to use pst-labo or external 3D software if possible).
- Failed to modify \input@pathby lyl on September 1, 2026 at 2:33 am
I want to make seach paths in my project like this: \documentclass{article} \usepackage{graphics} % [#1:optional arg,a list of paths delimited by comma, would be added to "./, lib/, material/"] % {#2:a path searched from} \ExplSyntaxOn \newcommand{\setsearchpath}[2][./, lib/, material/]{ \def\pathcomb{} \clist_map_inline:nn {#1} { \tl_put_right:Nx \pathcomb { {#2\tl_trim_spaces:n {##1}} } } \expandafter\graphicspath\expandafter{\pathcomb} \def\input@path{\pathcomb\input@path} }%\setsearchpath \ExplSyntaxOff \begin{document} \setsearchpath{../} \includegraphics{paperclip} \input{test} %This causes error. \end{document} Test this code showes that the set of graphic paths works all rigth, the input paths however fails. What's wrong with my code? And how to make my \setsearchpath work?
- How to align this text in the first letter?by Alastair Stratford on September 1, 2026 at 1:02 am
I'm currently a freshman taking Math program. I don't have any much to do so I want to learn LaTeX. Yet when I try to align this in the center, it looks like this: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} u &= x^2-4 & v &= -2e^{-x/2} \\ du &= 2x & dv &= e^{-x/2} \end{align*} \end{document} I don't now how to compile this here, but here's the picture I want to align the it in the first letter, which is in d, and I want to tighter the space of it. How can I do it?
- Ratio inside scalebox doesn't workby AGI on August 31, 2026 at 8:37 pm
my main problem that I'm looking forward to solving and understanding is the following: With the graphicx package we have the \scalebox{}[]{} macro. I don't quite know the most technical parts but I do know about tokenization of TeX code and category codes but the thing is that if I try to use calc in order to use the \ratio macro to produce a dynamical scaling of the expresion I get an error. A snippet of my code (example +packages loaded) would be \documentclass{article} \usepackage{etoolbox} \usepackage{mathtools} \usepackage{graphicx} \usepackage{cancel} \usepackage{amssymb} \usepackage{xparse} \usepackage{ifthen} \usepackage{calc} \usepackage{intcalc} \usepackage{forloop} \usepackage{nicematrix} \usepackage{xfp} \NewDocumentCommand{\set}{+m}{\ifblank{#1}{\varnothing}{ \scalebox{1}[\ratio{\heightof{#1}}{\heightof{X}}]{ \raisebox{0.04em}{\{} } #1 \scalebox{1}[\ratio{\heightof{#1}}{\heightof{X}}]{ \raisebox{0.04em}{\} } }}} \begin{document} %induces error %$\set{}$ %$\br{X}$ \renewcommand{\set}{\ifblank{#1}{\varnothing}{ \scalebox{1}[1.15]{ \raisebox{0.04em}{\{} } #1 \scalebox{1}[1.15]{ \raisebox{0.04em}{\}} $\set{}$ %produces \varnothing $\set{a,B}$ %produces {a,B} with adjusted height of braces \renewcommand{\br}[1]{\raisebox{0.1em}{[} #1 \raisebox{0.1em}{]} $\mathds R\br{X}$ %produces set of polinomials with coeficients in R and variable X with adjusted braces \end{document} I have tried using 1*\ratio... and expl3 but those also gives errors. These are the error messages I see I also know about mathtools and \DeclareMathDelimiterX but I also want code that handles translating of the expresion, like in \newcommand{\br}[1]{\raisebox{0.1em}{[} {#1} \raisebox{0.1em}{]}} Which, for what I know isn't possible with it. I hope you know how to solve this and can help me. What I want is that it scales with respect to the height of X for reference. Edit2: So for more added context, I also defined a macro for an adjusted integral (I'm a bit picky with symbols hahaha) and I would also (just to be sure) that it can scale by that much. \NewDocumentCommand{\integral}{+O{} +O{} +m +m +O{}}{\ifthenelse{\equal{#5}{partial}}{ \mathchoice{ \scalebox{1.1}[1.25]{$\displaystyle \int_{{#1}}^{{#2}}$}\kern0.25em{ \scalebox{1}{$\displaystyle {#3} \, \partial{}{#4}$}} }{ \scalebox{1}[1.1363]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.8}{${#3} \, \partial{}{#4}$} }{ \scalebox{0.6}[0.68]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.5}{$ {#3} \, \partial{}{#4}$} }{ \scalebox{0.55}[0.57]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.4}{$ {#3} \, \partial{}{#4}$}} }{ \mathchoice{ \scalebox{1.1}[1.25]{$\displaystyle \int_{{#1}}^{{#2}}$} \kern0.25em{ \scalebox{1}{$\displaystyle {#3} \, \diff{}{#4}$}} }{ \scalebox{1}[1.1363]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.8}{${#3} \, \diff{}{#4}$} }{ \scalebox{0.6}[0.68]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.5}{$ {#3} \, \diff{}{#4}$} }{ \scalebox{0.5}[0.57]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.4}{$ {#3} \, \diff{}{#4}$}} } } This is the largest symbol I have adjusted for personal use.
- Circle with tkz-euclide and transform shape goes wrongby Sander on August 31, 2026 at 6:41 pm
I'm using tkz-euclide to draw a circle with center M through point A: \documentclass{article} \usepackage{tikz} \usepackage{tkz-base} \usepackage{tkz-euclide} \begin{document} \tikzset{ xaxe style/.style ={-}, yaxe style/.style ={-}, } \begin{tikzpicture}[scale=0.6, transform shape] \tkzInit[xmin=-3,xmax=7,ymin=-4,ymax=6] \tkzGrid[color=black!20](-3.5, -4.5)(7.5, 6.5) \tkzDrawX[left space=0.5, right space=0.5] \tkzDrawY[up space=0.5, down space=0.5] \tkzLabelX[orig=false] \tkzLabelY[orig=false] \tkzDefPoint(0,0){O} \tkzLabelPoint[below left=2pt](O){\(O\)} \tkzDefPoints{2/1/M, -2/-2/A} \tkzDrawCircle[draw=blue!80!black, line width=.75pt](M,A) \tkzDrawPoints[fill=black, size=4](M,A) \tkzLabelPoint[below left](A){\(A\)} \tkzLabelPoint[below right](M){\(M\)} \end{tikzpicture} \end{document} The result of this code is a circle with center M, but not through A: Apparently this is caused by using transform shape in combination with scale=0.6. When I remove transform shape everything works fine. Does anybody know how to make tkz-euclide draw the correct circle in combination with transform shape?
- `\tl_replace_all` doesn’t work with countersby fauve on August 31, 2026 at 2:55 pm
The goal I try to make a macro witch transform arabic digits (0123456789) into farsi ones (). The final goal is to transform counters, espaceilaly page counters intor farsi form. The current situation I made the command, it work when I just use normal input numbers, but it fail when I give it a counter. MWE \documentclass{article} \usepackage{fontspec} \newfontfamily\arabicfont[ Ligatures=TeX, Script=Arabic, Language=Persian, ]{IranNastaliq} % Conversion des chiffres occidentaux en chiffres persans \ExplSyntaxOn \NewDocumentCommand{\persiandigits}{m} { \tl_set:Nn \l_tmpa_tl {#1} \tl_replace_all:Nnn \l_tmpa_tl {0} {۰} \tl_replace_all:Nnn \l_tmpa_tl {1} {۱} \tl_replace_all:Nnn \l_tmpa_tl {2} {۲} \tl_replace_all:Nnn \l_tmpa_tl {3} {۳} \tl_replace_all:Nnn \l_tmpa_tl {4} {۴} \tl_replace_all:Nnn \l_tmpa_tl {5} {۵} \tl_replace_all:Nnn \l_tmpa_tl {6} {۶} \tl_replace_all:Nnn \l_tmpa_tl {7} {۷} \tl_replace_all:Nnn \l_tmpa_tl {8} {۸} \tl_replace_all:Nnn \l_tmpa_tl {9} {۹} \tl_use:N \l_tmpa_tl } \ExplSyntaxOff \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{% \thepage\quad \arabicfont\persiandigits{\thepage} } \begin{document} Chiffres normaux : 12345 Chiffres persans : {\arabicfont\persiandigits{12345}} Numéro de page : {\arabicfont\persiandigits{\the\value{page}}} \end{document} Rendernig Chiffres normaux : 12345 Chiffres persans : ۱۲۳۴۵ Numéro de page : 1 <- here the problem happend The question How to make \persiandigits even work with \thepage ?
- Two columns of itemsby Andy Fletcher on August 31, 2026 at 8:54 am
I'm creating a list of items in two columns as the picture show, with the first half in the left and the second one in the right. In the process I used minipage, but the items are not horizontal aligned, line by line. For instance, in the example, item 1 and 3 are not under the same horinzontal line. There is a way to creating these two columns such that, in each line, the items are in the same horinzontal line? Thanks. \documentclass{article} \usepackage{amsmath} \usepackage{enumitem} \begin{document} \begin{enumerate} \begin{minipage}[l]{0.45\textwidth} \item a. \item b. \end{minipage} \begin{minipage}[l]{0.45\textwidth} \item c: $\dfrac{\dfrac{a}{b}}{2}$. \item d \end{minipage} \end{enumerate} \end{document}
- Why box255 has non-zero depth when height is sufficient?by Igor Liferenko on August 31, 2026 at 5:50 am
If we run TeX on this file \immediate\write16{vsize=\the\vsize} \def\pagebody{\immediate\write16{ht=\the\ht255 \space dp=\the\dp255 } \box255 } \hbox{A\vrule depth1pt B} \eject \end we get this output vsize=643.20255pt ht=643.20255pt dp=1.0pt Why height of box255 is equal to vsize while the height of hbox is less then vsize? Also, vsize is large enough to contain height+depth of hbox, but box255 has depth of hbox. Why? Where is this behavior documented in TeXbook?
- Suppressing an expl3 warning [duplicate]by Andrew Stacey on August 30, 2026 at 10:58 pm
I've installed TeXLive 2026, and for some reason there's a mismatch between expl3 versions: the package that got installed and the LaTeX format. I get a warning when a package loads expl3 explicitly: ! LaTeX Error: Mismatched LaTeX support files detected. (LaTeX) Loading 'expl3.sty' aborted! (LaTeX) (LaTeX) The L3 programming layer in the LaTeX format (LaTeX) is dated 2026-03-20, but in your TeX tree the files require (LaTeX) at least 2026-04-28. For immediate help type H <return>. ... l.78 \ExplLoaderFileDate{expl3.sty}} % While I can remove the explicit load of expl3 from my own packages, I find that there are still plenty in the TL tree that load it for themselves (the current culprit being unicode-math). What's the best way to get rid of this warning? Did a step fail to run when I last updated TeXLive (and if so, how do I force it?)? The reason why I can't just ignore it is that it's messing up some automatic scripts that rely on LaTeX's exit codes.
- Including Octave source code and output in LaTeX document?by Kevin Zembower on August 29, 2026 at 7:56 pm
all, I'm trying to create a LaTeX document that contains both source Octave code and output, like the way that Rmarkdown can be used to create a LaTeX document with both R source code and its output. Here's an example of what I'm trying to do, in a file named 'Ex.tex': \documentclass{article} \title{Exercise 1.1 T1} \author{Kevin Zembower} \date{} \begin{document} \maketitle \section{T1} This is an example from the documentation: ```{octave,engine.path='/usr/bin/octave',results='asis',echo=TRUE} x=-10:0.1:10; plot (x, sin (x)); print -djpg ./myfigure.jpg ``` Import the generated figure: ![My Plot of sin()]{./myfigure.jpg} \end{document} I don't know whether to put this code in a .Rnw, or .tex file. I'm not sure whether to use the << >> or ```{} delimiters. I'm producing the document in Emacs with LaTeX and Polymode enabled. I'm familiar with the latex interpreter in Octave, but I don't want to use it. I want more control over the document's appearance than the markdown in Octave allows. Can I use KnitR to combine Octave and LaTeX? I tried to use the ```{} delimters with the code in a .tex file, but when it's processed with pdflatex, it doesn't execute the Octave code. Am I missing a step to knit or sweave the code? Any help getting started? Any advice or guidance is appreciated. I think I'm confusing KnitR, Rmarkdown and LaTeX codes, with a lot of frustration. -Kevin
- Designing consistent, good-looking inline TikZ nodes for keyboard keys and menu itemsby Marco Moldenhauer on August 29, 2026 at 6:38 pm
I am creating my own inline TikZ commands for a Blender tutorial. So far, I have defined three commands: \KeyboardLetter{...} for keyboard letters, such as \KeyboardLetter{A} \KeyboardSymbol{...} for keyboard symbols, such as \KeyboardSymbol{\shift} \BlenderMenu{...} for Blender menu items, such as \BlenderMenu{Object Mode} My main requirement is that all three types of inline nodes should have the same height, regardless of their contents. I am not particularly happy with my current design (see the output below). How could I improve the design so that keyboard letters, keyboard symbols, and Blender menu items look like they belong to the same visual system? Maybe someone has a creative idea or a nice design suggestion? 🙂 my Code \documentclass{article} \usepackage{menukeys} \tikzset{ keystroke/.style={ draw=black!50, fill=yellow!20, %drop shadow={shadow xshift=0.15ex,shadow yshift=-0.15ex,fill=black,opacity=0.7}, rectangle, %rounded corners=0.8pt, inner xsep=1.5pt, inner ysep=1.5pt, line width=0.3pt, %minimum width=0.21cm, %minimum height=0.21cm, font=\sffamily\small, %text=blue!75!black, %anchor=south } } \newcommand*\KeyboardLetter[1]{% \tikz[baseline=(key.base)] % \node[keystroke](key) {#1} ;% } \newcommand*\KeyboardSymbol[1]{% \tikz[baseline=(key.base)]{% \node[keystroke,inner sep=1.5pt] (key) {\phantom{A}}; \node[ inner sep=0.8pt, transform shape, scale=0.75 ] at (key.center) {#1}; }% } \newcommand*\BlenderMenu[1]{% \tikz[baseline=(key.base)] % \node[% keystroke, %signal, fill=red!5 ](key) {#1} ;% } \begin{document} \KeyboardSymbol{\tab}\KeyboardLetter{A}\KeyboardLetter{P}\KeyboardLetter{=}\KeyboardSymbol{\shift}\KeyboardLetter{,}\BlenderMenu{Object Mode}\BlenderMenu{Edit Mode} \end{document} my Output
- Again: too much whitespace between integral sign and integrandby Jürgen on August 29, 2026 at 3:40 pm
This follow-up question refers to this question. I tried to use the proposal from MadyYuvi, but with this code \documentclass{scrartcl} \usepackage{kpfonts-otf} \removenolimits{\int} \removenolimits{\oint} \let\oldint\int \newcommand{\newint}{\oldint\hspace{-10cm}} \let\int\newint \begin{document} \begin{equation} I = \int_0^x S ds \end{equation} \begin{equation} I = \oint_0^x S ds \end{equation} \end{document} I can't see any effect. What am I doing wrong? -- EDIT: Implementing \AtBeginDocument With the hint from DavidCarlisle I use the code \documentclass{scrartcl} \usepackage{kpfonts-otf} \removenolimits{\int} \removenolimits{\oint} \AtBeginDocument{% \let\oldint\int \newcommand{\newint}{\oldint\!\!} \let\int\newint } \begin{document} \begin{equation} I = \int_0^x S ds \end{equation} \begin{equation} I = \oint_0^x S ds \end{equation} \end{document} and the result is
- tcolorbox suboptimal connexion with dotted borderlineby Denis Bitouzé on August 29, 2026 at 2:40 pm
The example of a dotted borderline in the tcolorbox's documentation (currently page 207): \documentclass{article} \usepackage{tcolorbox} \usepackage{lipsum} \tcbuselibrary{skins} \begin{document} \begin{tcolorbox}[enhanced,arc=3mm,boxrule=1.5mm, frame hidden,colback=blue!10!white, borderline={1mm}{0mm}{blue,dotted} ] \lipsum[2] \end{tcolorbox} \end{document} is miraculously well-connected. But, in general, the connexion is only suboptimal, as shown in the following picture (look at its southwestern corner), obtained by replacing \lipsum[2] by \lipsum[1] in the previous example: Is there a way to get an optimal connexion, I mean automatically, by computing the height of the box and adapting the size of the dots and/or of the space between them?
- How to achieve numbered zref-clever references in enumerated description list?by modallyFragile on August 29, 2026 at 1:15 pm
I want a to write lists which include both a number (like enumerate) and a short description (like description). I can do that as described here. I also want to be able to refer to the numbers of these lists with zref-clever. How can I achieve this? I've got as far as making the list work, and getting zref to recognise references as items, but I can't work out how to get zref to print the relevant number. MWE: \documentclass{article} \usepackage{zref-clever} \usepackage{enumitem} \newcounter{enumdescription} \newlist{enumdescription}{description}{3} \zcsetup{countertype = {enumdescription = item}} \setlist[enumdescription]{% before={ \zcsetup{currentcounter=enumdescription} \setcounter{enumdescription}{0}% start each list at }, font={ \refstepcounter{enumdescription} \normalfont\arabic{enumdescription}.~% \bfseries% } } \begin{document} \begin{enumdescription} \item[Foo]\label{foo} text. \item[Bar]\label{bar} text. \item[Baz]\label{baz} text. \end{enumdescription} Should say `item 1': `\zcref{foo}'. \end{document} (Also nice to have, since it may be useful, would be a way of using zcref's ref option to capture the descriptive labels, so I could do \zcref[ref=desclabel]{foo} and get Foo. But this isn't really important.) TIA!
- How to put tikz node at top left in a picture fitting all the A4 document?by Manuel Selva on August 29, 2026 at 8:55 am
I have the following document : \documentclass[a4paper]{article} \usepackage[a4paper,margin=0cm,landscape]{geometry} \usepackage{tikz} \usetikzlibrary{fit} \begin{document} \begin{tikzpicture}[remember picture, overlay] \coordinate (nw) at (current page.north west); \coordinate (se) at (current page.south east); \node [fill=red!10, fit=(nw) (se), inner sep=0pt] {}; \node [rectangle,fill=green,draw=black, minimum width=3cm, minimum height=3cm,anchor=north west] at (0, 0) {Manu}; \end{tikzpicture} \end{document} The Manu green rectangle is not in the top left corner of the resulting document while the red background done using fit correctly fits all the page. Why is the green rectangle shifted ?
- How make a tikzpicture filling an A4 page?by Manuel Selva on August 29, 2026 at 6:49 am
I want to use tikz to draw a diagram and I want this diagram occupy all the A4 space of my document (so that I can print it then). How can I achieve this ? Here is what I have for now : \documentclass[a4paper]{article} \usepackage{tikz} \usetikzlibrary{fit} \begin{document} \begin{tikzpicture}[remember picture, overlay] \node [fill=blue, fit=(current page.north west) (current page.south east), inner sep=0pt] {}; \end{tikzpicture} \end{document} But my problem is that I want to have a landscape A4 paper. Adding : \usepackage[a4paper,margin=0in,landscape]{geometry} results in a blue rectangle occupying only part of the document. It seems that current page.north west and current page.south east are no more valid with landscape ?
- Sections taking chapter number, subsections not numberingby GrahamF on August 29, 2026 at 12:49 am
This was working fine in June. Aftrer making edits, section numbering and toc not working properly. MWE: \documentclass[letterpaper, 9pt, oneside]{memoir} \usepackage{inconsolata} \usepackage[T1]{fontenc} % Font encoding \usepackage{lmodern, newpxmath} % Font family % Additional packages \usepackage{import} \usepackage{standalone} \usepackage{enumerate} % subsubsections and higher are numbered \setsecnumdepth{subsubsection} \maxsecnumdepth{subsection} \renewcommand\thesection{\arabic{chapter}} % Number format for sections \copypagestyle{chapter}{Ruled} \checkandfixthelayout % Required \sloppybottom \begin{document} \chapter{Business Requirement}\label{ch:requirement} \section{Background}\label{sec:background} Whilst the connectivity has been periodically upgraded, it is essentially the same functionality dating from 2006 when first implemented. The on-premise server is beyond end-of-life; the software version is out-of-date and represents a potential security vulnerability. Consequently, this project is to implement the next-generation connection. \section{Scope}\label{sec:scope} The following solution components are in scope for the project: \begin{itemize} \item A \item B \item C \item D \item E \item F \end{itemize} The user processes that trigger calculations are: \begin{itemize} \item 1 \item 2 \item 3 \end{itemize} \end{document} This produces the following pdf: My apologies - both for messing-up the Markdown (trying to provide more information) and for the MWE being, well ... minimal. My thanks for the feedback. Following advice above, the section and subsections are numbering, however, for the x-ref to work properly, I need the numbering to be chapter.section.subsection (e.g. 5.3.1 Schema Groups for Vendors) for the main matter and Alpha.section.subsection (e.g. G.3.1 Checklist) for appendices. If this is insufficient, I'll edit again to provide the full .sty and main.tex files. Partial success! \renewcommand\thesection{\arabic{chapter}.\arabic{section}} numbers the mainmatter correctly For the appendix, I used \renewcommand{\thechapter}{\Alph{chapter}} however sections and subsections are numbering as (e.g.) 2.1; 2.2 and what's required is B.1; B.2 etc.
- Alternative \oplus symbol when using newpx packageby rla on August 28, 2026 at 7:35 pm
When using newpx package I would like to change the \oplus and \bigoplus symbols to ones whose circles are slightly greater than the plus sign. I found a partial solution here How do I put a circle around an operator? \documentclass[a4paper, 10pt]{book} \usepackage{graphicx} \usepackage{mathtools} \usepackage{newpxtext} \usepackage[varg, smallerops]{newpxmath} \makeatletter \newcommand\incircbin {% \mathpalette\@incircbin } \newcommand\@incircbin[2] {% \mathbin% {% \ooalign{\hidewidth$#1#2$\hidewidth\crcr$#1\bigcirc$}% }% } \newcommand{\myoplus}{\incircbin{+}} \makeatother \begin{document} \[ \oplus \myoplus \] \[ \bigoplus \prod \sum \] \end{document} Similarly, I would like to define \mybigoplus operator which is basically a larger version of \myoplus. A first attempt would be to use \scalerel or \resizebox commands but that approach make the symbol look like a bold version. How to define a larger version of \myoplus with weight matching with others operator like the originals \prod and \sum from the newpx package? Furthermore, it will be good to have a solution that dynamically fits its size when \textstyle or \displaystyle are imposed.
- Relative paths in pgfkeys vs. usage in TikZby karlh on August 28, 2026 at 3:12 pm
This is more a curiosity (or bug report?) than it is an actual problem. That is, I know how to fix it/work around it, and I'm really asking about the design principle(s). Using \pgfkeys to set a key /pgf/bar is fine, but setting one /pgf/foo/bar will cause an error if the \pgf part is left off inside a TikZ path/node/etc. command: \documentclass{article} \usepackage{tikz} \pgfkeys{% /pgf/bar/.initial=1cm, /pgf/foo/bar/.initial=1cm, } \begin{document} \begin{tikzpicture} \path [bar=2cm] (0,0); \end{tikzpicture} \end{document} compare to \documentclass{article} \usepackage{tikz} \pgfkeys{% /pgf/bar/.initial=1cm, /pgf/foo/bar/.initial=1cm, } \begin{document} \begin{tikzpicture} \path [foo/bar=2cm] (0,0); \end{tikzpicture} \end{document} The latter gives the following error: ! Package pgfkeys Error: I do not know the key '/tikz/foo/bar', to which you passed '2cm', and I am going to ignore it. Perhaps you misspelled it. See the pgfkeys package documentation for explanation. Type H <return> for immediate help. ... l.13 \path [foo/bar=2cm] ( 0,0); ? Making the root path /tikz solves the problem, as does providing the full path /pgf/foo/bar, but given the statement in the TikZ documentation, section 12.4.1, I expected it to work: Is this supposed to work, or is there a reason this list is not followed when a slash is present in the key name?
- Full list by default available OpenType fonts in `fontspec` and `unicode-math`by moro11 on August 27, 2026 at 6:54 pm
Is there a (approximately) complete list of OpenType fonts available by default within fontspec and unicode-math? I was not able to find something similar. So maybe this post could also be used to collect some. Just to specify what i mean: it is clear that there can not be a complete list as any OpenType font file (.otf) is compatible, and what font files are available by default probably varies on your TeX installation and can be looked up in /texmf/fonts/opentype. But there are some preconfigured named fonts which are loaded by name instead of loading a specific font file. As a fontspec example, loading the named font STIX Two Text and the font file STIXTwoText-Regular.otf in the following MWE \documentclass{standalone} \usepackage{fontspec} \setmainfont{STIX Two Text} \begin{document} ABC \textbf{ABC} \end{document} \documentclass{standalone} \usepackage{fontspec} \setmainfont{STIXTwoText-Regular.otf} \begin{document} ABC \textbf{ABC} \end{document} lead to and , respectively. As a unicode-math example, loading the named font NewComputerModernMath and the font file NewCMMath-Regular.otf in the following MWE \documentclass{standalone} \usepackage{unicode-math} \setmathfont{NewComputerModernMath} \begin{document} $ABC$ $\symcal{ABC}$ \end{document} \documentclass{standalone} \usepackage{unicode-math} \setmathfont{NewCMMath-Regular.otf} \begin{document} $ABC$ $\symcal{ABC}$ \end{document} lead to and , respectively. It seems to me, that these named fonts are not just equivalent to loading a specific .otf file, but there is some configuration happening in the background. (I guess they combine several .otf files.) So my question: is there a (approximatly) complete list of preconfigured named fonts provided by fontspec and unicode-math, respectively? In case fontspec and unicode-math do not provide these named fonts themselves, such a list might not exist, nevertheless they have to look them up somewhere. So, in this case, is there a way to manually look up locally available named fonts instead of playing a guess-the-name game (just like i am able to look up available .otf files in /texmf/fonts/opentype)?
- Specify version=bold for specific font using unicode-mathby moro11 on August 27, 2026 at 5:38 pm
I am switching to unicode-math and have some trouble with the bold fonts. I know the intended way in unicode-math is to use \symbf, \symbfcal etc. which boldens characters, but no symbols like + or accents like \tilde. This is fine when boldface is used for schematics (e.g. to denote vectors). But sometimes, i want to use mathematics just in an all-bold environment (e.g. in section titles) where just everything should be bold. I know i could set a bold version of a math alphabet and switch to that using \boldmath or \boldsymbol instead of \symbfXY. (of course setting up these fonts has to be done carefully, as one might end up with two different bold fonts otherwise.) Now, i further want to have access to two calligraphic fonts \symcal and \symscr ideally with full support for both, but i can not get that to work. Consider the following MWE (the fonts are available at CTAN): \documentclass[varwidth]{standalone} \usepackage{unicode-math} \setmathfont{NewCMMath-Regular.otf} \setmathfont[version=bold]{NewCMMath-Bold.otf} \setmathfont[range={scr,bfscr}, StylisticSet=1]{NewCMMath-Regular.otf} \begin{document} $\symcal{A}$ (symcal) $\symbfcal{A}$ (symbfcal) {\boldmath$\symcal{A}$} (boldmath + symcal)\\ $\symscr{A}$ (symscr) $\symbfscr{A}$ (symbfscr) {\boldmath$\symscr{A}$} (boldmath + symscr) \end{document} producing What i want to have is I tried other configurations as well, such as: \setmathfont{NewCMMath-Regular.otf} \setmathfont[range={scr,bfscr}, StylisticSet=1]{NewCMMath-Regular.otf} \setmathfont[version=bold]{NewCMMath-Bold.otf} \setmathfont{NewCMMath-Regular.otf} \setmathfont[version=bold]{NewCMMath-Bold.otf} \setmathfont[range={scr,bfscr}, StylisticSet=1]{NewCMMath-Regular.otf} \setmathfont[version=bold, range={scr,bfscr}, StylisticSet=1]{NewCMMath-Bold.otf} I have the bad feeling that i found some hard limits of the unicode-math package. Is there any way to achieve this? I would also be happy with some workarounds if this is not possible. Maybe some adjusted .otf files. Or redefining the mechanic behind \boldmath and \boldsymbol to additionally redefine \symscr and \mathscr with \symbfscr and \mathbfscr or something (i guess these are the only non-bold alphabets, so replacing them with bold version might not be ideal, but probably good enough?) I mean, we are talking about the second calligraphic font in combination with the lesser used bold mechanic, so the use-case is probably not the most relevant. Nevertheless it feels odd to not have support for that at all, especially, as this is no problem without unicode-math using the old 8-bit engine.
- How to duplicate `\vert` and reduce its thickness at larger sizes?by Nyx on August 27, 2026 at 1:13 pm
I regularly use newpx for my LuaLaTeX documents with the font setup being similar to § 5, Example I of the documentation but using Asana Math as the OTF math font: \usepackage{newpxtext} \usepackage{unicode-math} \setmathfont{Asana Math} Unfortunately, I find that Asana Math's \vert is too thick at larger sizes for my taste. The following is version 1 of the MWE (with \otfmathtrue being uncommented) of my current problem: % !TEX program = lualatex \documentclass{article} \usepackage{mathtools} \usepackage{mleftright} % math fonts \newif\ifotfmath \otfmathtrue \ifotfmath \usepackage[ warnings-off={ mathtools-colon, mathtools-overbracket, }, ]{unicode-math} \setmathfont{Asana Math} \else \renewcommand*{\rmdefault}{minzpl} \usepackage[T1]{fontenc} \usepackage{newpxmath} \fi % \abs macro \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % \set macro from https://tex.stackexchange.com/a/763668 \ExplSyntaxOn \newcommand*{\suchthatvert}{\vert} \NewDocumentCommand{\set}{sO{}m} { \group_begin: \seq_set_split:Nnn \l__egreg_set_input_seq {\suchthat} {#3} \int_case:nnF { \seq_count:N \l__egreg_set_input_seq } { {1} { \__egreg_set_bylist:nnn {#1} {#2} {#3} } {2} { \__egreg_set_byproperty:nnee {#1} {#2} { \seq_item:Nn \l__egreg_set_input_seq {1} } { \seq_item:Nn \l__egreg_set_input_seq {2} } } }{OOPS!} \group_end: } \seq_new:N \l__egreg_set_input_seq \tl_new:N \l__egreg_set_st_tl \cs_new_protected:Nn \__egreg_set_byproperty:nnnn { \bool_if:nTF {#1} {% auto sizing \left\lbrace #3 \nonscript\;\middle\suchthatvert\nonscript\; #4 \right\rbrace } { \mathopen{#2\lbrace} #3 \mathrel{#2|} #4 \mathclose{#2\rbrace} } } \cs_generate_variant:Nn \__egreg_set_byproperty:nnnn {nnee} \cs_new_protected:Nn \__egreg_set_bylist:nnn { \bool_if:nTF {#1} { \left\lbrace } { \mathopen{#2\lbrace} } \group_begin: \clist_use:nn {#3} {,\penalty0~\hspace{0pt plus 3pt}} \group_end: \bool_if:nTF {#1} { \right\rbrace } { \mathclose{#2\rbrace} } } \ExplSyntaxOff \begin{document} \(\abs{x}\) \(\abs{A}\) \(\abs{M}\) \(\abs{S}\) \(\set[\big]{x \suchthat \dfrac{1}{2} < x < 3}\) \(\set[\Big]{x \suchthat \dfrac{1}{2} < x <3}\) \(\set[\bigg]{x \suchthat \dfrac{1}{2} < x < 3}\) \(\set*{x \suchthat \dfrac{1}{2} < x <3}\) \(\set[\Bigg]{x \suchthat \dfrac{1}{2} < x <3}\) \end{document} The following is version 2 of the MWE (with \otfmathtrue being commented) of my current problem: % !TEX program = lualatex \documentclass{article} \usepackage{mathtools} \usepackage{mleftright} % math fonts \newif\ifotfmath % \otfmathtrue \ifotfmath \usepackage[ warnings-off={ mathtools-colon, mathtools-overbracket, }, ]{unicode-math} \setmathfont{Asana Math} \else \renewcommand*{\rmdefault}{minzpl} \usepackage[T1]{fontenc} \usepackage{newpxmath} \fi % \abs macro \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % \set macro from https://tex.stackexchange.com/a/763668 \ExplSyntaxOn \newcommand*{\suchthatvert}{\vert} \NewDocumentCommand{\set}{sO{}m} { \group_begin: \seq_set_split:Nnn \l__egreg_set_input_seq {\suchthat} {#3} \int_case:nnF { \seq_count:N \l__egreg_set_input_seq } { {1} { \__egreg_set_bylist:nnn {#1} {#2} {#3} } {2} { \__egreg_set_byproperty:nnee {#1} {#2} { \seq_item:Nn \l__egreg_set_input_seq {1} } { \seq_item:Nn \l__egreg_set_input_seq {2} } } }{OOPS!} \group_end: } \seq_new:N \l__egreg_set_input_seq \tl_new:N \l__egreg_set_st_tl \cs_new_protected:Nn \__egreg_set_byproperty:nnnn { \bool_if:nTF {#1} {% auto sizing \left\lbrace #3 \nonscript\;\middle\suchthatvert\nonscript\; #4 \right\rbrace } { \mathopen{#2\lbrace} #3 \mathrel{#2|} #4 \mathclose{#2\rbrace} } } \cs_generate_variant:Nn \__egreg_set_byproperty:nnnn {nnee} \cs_new_protected:Nn \__egreg_set_bylist:nnn { \bool_if:nTF {#1} { \left\lbrace } { \mathopen{#2\lbrace} } \group_begin: \clist_use:nn {#3} {,\penalty0~\hspace{0pt plus 3pt}} \group_end: \bool_if:nTF {#1} { \right\rbrace } { \mathclose{#2\rbrace} } } \ExplSyntaxOff \begin{document} \(\abs{x}\) \(\abs{A}\) \(\abs{M}\) \(\abs{S}\) \(\set[\big]{x \suchthat \dfrac{1}{2} < x < 3}\) \(\set[\Big]{x \suchthat \dfrac{1}{2} < x <3}\) \(\set[\bigg]{x \suchthat \dfrac{1}{2} < x < 3}\) \(\set*{x \suchthat \dfrac{1}{2} < x <3}\) \(\set[\Bigg]{x \suchthat \dfrac{1}{2} < x <3}\) \end{document} I generally try to only use OpenType math fonts and use unicode-math's \setmathfont{...}[range={...}] or \setmathfont{...}[version=...] commands for additional glyphs or secondary fonts. In this particular case, I would like to duplicate the \vert macro into \suchthatvert and have the latter use the extensible delimiter from newpxmath (if that is possible) in order to have a \suchthatvert with reduced thickness at larger sizes without affecting other instances of \vert. Using \setmathfont{secondary-font.otf}[range={\vert}] with another OpenType math font would not work as it would affect \verts globally and using \setmathfont{secondary-font.otf}[version=secondary-font] would also not work as I believe it is not possible to do the following because of how \mathversion works: \newcommand*{\suchthatvert}{\mathversion{secondary-font}\vert\mathversion{default}}
- tikz pgfplot fill area between multiple graphs or pathsby paul_schaefer on August 27, 2026 at 12:22 pm
MWE: \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[ngerman]{babel} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usetikzlibrary{datavisualization.formats.functions} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture}[scale=1] \begin{axis}[ axis equal, % axis line style=thick, axis x line=center, ylabel={$y$}, xlabel={$x$}, major tick style = {black}, axis y line=middle, every axis y label/.style={ at={(current axis.above origin)}, inner sep=3, anchor=north east, }, every axis x label/.style={ at={(current axis.right of origin)}, inner sep=3, anchor=north east, }, xtick={-1,1}, xticklabels={$-\frac{w}{2}$,$\frac{w}{2}$}, ytick={1}, yticklabels={$h$}, yticklabel style={anchor=south west}, xmin=-1.75, xmax=3.25, ymin=-0.1, ymax=1.5, height=4cm, samples=100] \addplot[domain=-1:1,thick, name path=A] {1 - x * x}; \addplot[domain=0.5:2.5,thick, name path=B] {1 - (x-1.5) * (x-1.5)}; \draw[name path=C, thin] (1/3,8/9) -- (1.5,1); \path [name path=D] (\pgfkeysvalueof{/pgfplots/xmin},0) -- (\pgfkeysvalueof{/pgfplots/xmax},0); \addplot[black!15] fill between[of=C and A, soft clip={domain=0:0.75}]; \addplot[black!15] fill between[of=C and B, soft clip={domain=0.75:1.5}]; \addplot[black!40] fill between[of=B and D, soft clip={domain=0.5:0.75}]; \addplot[black!40] fill between[of=A and D, soft clip={domain=0.75:1}]; \end{axis} \end{tikzpicture} \end{document} results in a graph, where the areas between the both graphs are filled in gray. In this example I splitted the areas into four sections and colored them. Is there a possibility to fill the areas without splitting them into sections? A second problem is, that the separation of each area into two parts will sometimes result in in slight white vertical line between the colored areas. In my case it depends on the scaling of the pdf viewer I use. If there area could be described without separation this should not happen.
- How to draw 3D animation of reflection of a triangle about the bisector?by Learner on August 26, 2026 at 6:50 pm
I want to plot a 3D animation of an equilateral triangle about one bisector. I have plotted the steps by using tikz: \documentclass[a4paper,11pt]{article} \usepackage{tikz} \usepackage[margin=1.2cm]{geometry} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm] % First triangle: \begin{scope}[shift={(0,0)}] \coordinate (A) at (0,2); \coordinate (B) at (-1.732,0); \coordinate (C) at (1.732,0); % Median = axis of reflection \draw[dashed,very thick] (0,0) -- (0,2); % Triangle \draw[thick] (A) -- (B) -- (C) -- cycle; % Vertex labels \node[above] at (A) {$A$}; \node[below left] at (B) {$B$}; \node[below right] at (C) {$C$}; % Element \node at (0,-0.7) {I}; \end{scope} %Arrow from first triangle to second triangle \draw[->,thick] (2.2,1) -- (5.8,1); \node at (4,1.2) {s}; \node at (4,0.5) {$(\text{reflection})$}; %second triangle \begin{scope}[shift={(8,0)}] \coordinate (A) at (0,2); \coordinate (B) at (-1.732,0); \coordinate (C) at (1.732,0); % Reflect in the vertical median \begin{scope}[xscale=-1] % Triangle \draw[thick] (A) -- (B) -- (C) -- cycle; % Vertex labels \node[above left] at (A) {$A$}; \node[below left] at (B) {$B$}; \node[below] at (C) {$C$}; \end{scope} % Reflection axis \draw[dashed,very thick] (0,0) -- (0,2); \node at (0,-1) {II}; \end{scope} \end{tikzpicture} \end{document} which gives the following two triangles: I want to plot a 3D animation to display the reflection about the bisector.I would appreciate to do that. The vertices B and C will be changing every time but A will remain fixed. Note that the first triangle and the last triangle are same.
- tikz datavisualization place axis labels next to axis tipsby paul_schaefer on August 26, 2026 at 12:44 pm
MWE: \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usetikzlibrary{datavisualization.formats.functions} \begin{document} \begin{tikzpicture}[baseline=(current bounding box.center), >=Stealth]% \datavisualization[% school book axes,% visualize as smooth line,% x axis={% label={$x$},% include value={-1.25, 1.25},% ticks={% major at={% -1 as $-\frac{w}{2}$,% 1 as $\frac{w}{2}$% },% },% },% y axis={% label={$y$},% include value=1.5,% ticks={% major at={% 1 as $h$% },% node style={anchor=south west},% },% },% ]% data [format=function] {% var x : interval [-1.0:1.0];% func y = 1 - (\value x * \value x);% };% \end{tikzpicture} \end{document} provides the following graph: What do I have to change to place the axis description next to the arrow tips (shown in red)? Adding visualize label={x axis={goto pos=.5}}, to the x axis definition leads to a second label. Trying to change the node style using visualize label={node style={anchor=north}}, doesn't has any effect. How can I change/access the label inside the axis definition?
- Why does \pgfkeysvalueof give different results between nearly same codesby lyl on August 26, 2026 at 4:34 am
\documentclass{article} \usepackage{tikz} \begin{document} \pgfkeys{my family/my key/.initial=hello} \pgfkeysvalueof{my family/my key} % Running the above two lines of code gets nothing \pgfkeys{/my family/my key/.initial=hello} \pgfkeysvalueof{/my family/my key} % Running the above two lines of code gets right output as expected. % What causes such different results between the two block of codes? \end{document}
- Typeset a reference based on `zc@cntval`, not the \label / `\the` value?by Thibault de Villèle on August 25, 2026 at 8:35 pm
Note: this was posted into a Github issue on zref-clever's repository, but I figured it might also be a good idea to ask about it here. Note: all code blocks here, concatenated, form a MWE. This is only broken up to ease reading. I currently have a setup to make \labels to parts of a TikZ image using a custom counter named tikzcaption, relative to the figure counter (since none of those tikzpictures will be in a subfigure environment). I want a couple things to happen when I reference those labels: if I'm in the figure environment where this tikzpicture is shown, references should be typeset as figure ("tikzcaption" in \alph, typewriter text) ; if I'm not in that figure environment, references should be typeset as figure (regular figure numbering).("tikzcaption" in \alph, typewriter text). Here's the basic setup of the counter and the reference type: \documentclass{scrbook} \KOMAoption{parskip}{half-}% % Hyperref only included to get hyperlinks working. \usepackage{tikz, zref-clever, hyperref} \makeatletter% % Create the counter for parts of a TikZ image: \newcounter{tikzcaption} \counterwithin{tikzcaption}{figure} \renewcommand*{\thetikzcaption}{\thefigure.\texttt{\arabic{tikzcaption}}} % Typeset the parts of TikZ images as the figure ones for the main document: \zcRefTypeSetup{tikzcaption}{ name-sg = {figure}, name-pl = {figures}, Name-sg = {Figure}, Name-pl = {Figures}, } % Link tikzcaption <-> figure, as zref-clever doesn't seem to detect it: \zcsetup{counterresetby = { tikzcaption = figure }}% How I (think I should) achieve the behaviour I want is by having a custom figure-like environment where I can freely change commands. Here's a rough outline of how that works: \newif\ifinreftikzpicture% Used for a couple things relative to \caption... % #1: floating env parameters \NewDocumentEnvironment{reftikzpicture}{O{htp}} { \figure[#1]% Manually start the "figure" environment. \inreftikzpicturetrue% Signal we're in the reftikzpicture env. \setcounter{tikzcaption}{0}% % Override \thetikzcaption: \let\@outside@the@tikzcaption=\thetikzcaption% \renewcommand*{\thetikzcaption}{\texttt{\alph{tikzcaption}}}% % Make the reference "names" nil within the reftikzpicture env: \zcRefTypeSetup{tikzcaption}{% name-sg = {}, name-pl = {},% Name-sg = {}, Name-pl = {},% % Ideally, should not be needed since % \thetikzcaption switches to \ttfamily reffont={\ttfamily},% }% } { % Reset the original formatting of \thetikzcaption: \renewcommand*{\thetikzcaption}{\@outside@the@tikzcaption}% \inreftikzpicturefalse% \endfigure% End the figure environment manually. } % Create the \label inside a tikzpicture: % #1: Don't print the label on the tikzpicture. % #2: Node options for the label on that picture. % #3: What node is it a legend of? (can be a string) % #4: Position of the label inside the picture. % #5: The label name for \ref and friends. \NewDocumentCommand{\labeltikzat}{s O{} m m m}{ \refstepcounter{tikzcaption}% % Manually set the current counter value, and its name: \gdef\@currentcounter{tikzcaption}% \gdef\@currentlabel{\thetikzcaption}% \label{#5}% Label is #5 \IfBooleanF{#1}{% \begin{scope}[shift={#4}]% % Print the current label value in a node somewhere (#4) on the tikzpicture: \node[#2] (legend #3) at (0, 0) {\texttt{\alph{tikzcaption}}};% \end{scope}% }% } \makeatother% While this works (it sets a label and makes it referencable by zref-clever), it seems I cannot customize the typesetting of the label \zcref{} call beyond redefining the \the<counter> command. Furthermore, from the documentation it looks like the text to typeset is defined whenever the \label command is issued, and cannot be customized any further. See the document contents here: \begin{document} \begin{reftikzpicture}[ht] \centering% \begin{tikzpicture}[inner sep=0pt, outer sep=5pt]% \coordinate (circ) at (0,0);% \draw[thick, black] (circ) circle [radius=3cm];% \labeltikzat{circ}{(circ.center)}{fig/circ}% \end{tikzpicture} \caption{\zcref[S]{fig} is a \texttt{reftikzpicture}, with a single label named \zcref{fig/circ}.}% \label{fig} \end{reftikzpicture} Here are the expected and real values of the typeset references using \texttt{\string\zcref} for the different labels in the main document text: \begin{center} \begin{tabular}{p{4cm}|p{4cm}|p{4cm}} Label & Expected & Actual \\ \hline \hline \texttt{fig} & figure 1 & \zcref{fig} \\ \texttt{fig/circ} & figure 1.\texttt{a} & \zcref{fig/circ} \end{tabular} \end{center} \end{document} Gives the following document: However, I see the \zref@newlabel command records a \zc@cntval property which stores the current (local-only) value of the counter. Can I somehow use that value to print references (with hyperlinks and ranges+pairs formatting) within the reftikzpicture environment ? Using that counter to format the reference inside the reftikzpicture environment would allow for the references in the caption to be printed as they are now, but the references in the main document body would be printed as the expected values in the table. Full code: \documentclass{scrbook} \KOMAoption{parskip}{half-}% % Hyperref only included to get hyperlinks working. \usepackage{tikz, zref-clever, hyperref} \makeatletter% % Create the counter for parts of a TikZ image: \newcounter{tikzcaption} \counterwithin{tikzcaption}{figure} \renewcommand*{\thetikzcaption}{\thefigure.\texttt{\arabic{tikzcaption}}} % Typeset the parts of TikZ images as the figure ones for the main document: \zcRefTypeSetup{tikzcaption}{ name-sg = {figure}, name-pl = {figures}, Name-sg = {Figure}, Name-pl = {Figures}, } % Link tikzcaption <-> figure, as zref-clever doesn't seem to detect it: \zcsetup{counterresetby = { tikzcaption = figure }}% \newif\ifinreftikzpicture% Used for a couple things relative to \caption... % #1: floating env parameters \NewDocumentEnvironment{reftikzpicture}{O{htp}} { \figure[#1]% Manually start the "figure" environment. \inreftikzpicturetrue% Signal we're in the reftikzpicture env. \setcounter{tikzcaption}{0}% % Override \thetikzcaption: \let\@outside@the@tikzcaption=\thetikzcaption% \renewcommand*{\thetikzcaption}{\texttt{\alph{tikzcaption}}}% % Make the reference "names" nil within the reftikzpicture env: \zcRefTypeSetup{tikzcaption}{% name-sg = {}, name-pl = {},% Name-sg = {}, Name-pl = {},% % Ideally, should not be needed since % \thetikzcaption switches to \ttfamily reffont={\ttfamily},% }% } { % Reset the original formatting of \thetikzcaption: \renewcommand*{\thetikzcaption}{\@outside@the@tikzcaption}% \inreftikzpicturefalse% \endfigure% End the figure environment manually. } % Create the \label inside a tikzpicture: % #1: Don't print the label on the tikzpicture. % #2: Node options for the label on that picture. % #3: What node is it a legend of? (can be a string) % #4: Position of the label inside the picture. % #5: The label name for \ref and friends. \NewDocumentCommand{\labeltikzat}{s O{} m m m}{ \refstepcounter{tikzcaption}% % Manually set the current counter value, and its name: \gdef\@currentcounter{tikzcaption}% \gdef\@currentlabel{\thetikzcaption}% \label{#5}% Label is #5 \IfBooleanF{#1}{% \begin{scope}[shift={#4}]% % Print the current label value in a node somewhere (#4) on the tikzpicture: \node[#2] (legend #3) at (0, 0) {\texttt{\alph{tikzcaption}}};% \end{scope}% }% } \makeatother% \begin{document} \begin{reftikzpicture}[ht] \centering% \begin{tikzpicture}[inner sep=0pt, outer sep=5pt]% \coordinate (circ) at (0,0);% \draw[thick, black] (circ) circle [radius=3cm];% \labeltikzat{circ}{(circ.center)}{fig/circ}% \end{tikzpicture} \caption{\zcref[S]{fig} is a \texttt{reftikzpicture}, with a single label named \zcref{fig/circ}.}% \label{fig} \end{reftikzpicture} Here are the expected and real values of the typeset references using \texttt{\string\zcref} for the different labels in the main document text: \begin{center} \begin{tabular}{p{4cm}|p{4cm}|p{4cm}} Label & Expected & Actual \\ \hline \hline \texttt{fig} & figure 1 & \zcref{fig} \\ \texttt{fig/circ} & figure 1.\texttt{a} & \zcref{fig/circ} \end{tabular} \end{center} \end{document}
- Why is Adobe accessibility checker testing inside figures with PDF-based graphics?by Paul J Hurtado on August 25, 2026 at 5:13 pm
I've seen a few examples now of Adobe Acrobat's PDF checker flagging the contents of a figure graphic based on a PDF file, when the figure in the main document has alt text and should be passing. Is there a way to force it to not check those figure file contents? TO be clear: if the graphic were saved as, say, a PNG instead of a PDF, it wouldn't be flagging the issues. I don't want people to fix their accessibility report by converting those graphics to non-PDF formats. I'm not sure if this is related to this older issue and Form Xobjects: https://github.com/latex3/tagging-project/issues/945 Here is a MWE with two figures. The first gives Character encoding failures for the line segments used in the graph (but the beta on the vertical axis causes no failures), and the second figure gives Character encoding failures for the beta on the horizontal axis. FYI, I compiled the first figure PDF using lualatex (not pdflatex as mentioned in the file below) and it still gives Character encoding errors in the main document. The second figure needs to be created in R (using R Studio) by running the commands set.seed(1); hist(rnorm(1000),40,xlab=expression(beta),main="") then exporting and saving the figure as a PDF. You may need to compile the document below then compile xobject-figure.tex to generate that PDF. Alternatively, you can download the two figure PDFs, the document PDF, and LaTeX file below with this link: http://pauljhurtado.com/latex/tmp/MWE.zip. \begin{filecontents*}[overwrite]{xobject-figure.tex} \documentclass{standalone} % Deliberately use traditional TeX math fonts. \begin{document} \setlength{\unitlength}{1cm} \begin{picture}(5,4) % axes \put(0.5,0.5){\line(1,0){4}} \put(0.5,0.5){\line(0,1){3}} % deliberately problematic math character \put(0.05,2.0){$\beta$} % a little bit of graphical content \put(0.5,0.5){\line(1,1){3}} \end{picture} \end{document} \end{filecontents*} % Generate the external PDF with pdfLaTeX. \immediate\write18{pdflatex -interaction=batchmode xobject-figure.tex} % ------------------------------------------------------------ % Main accessible document % ------------------------------------------------------------ \DocumentMetadata{ lang=en-US, tagging=on, pdfstandard=ua-2 } \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{graphicx} \title{Acrobat Form XObject Character-Encoding Test} \author{Test Author} \begin{document} \maketitle This document contains externally generated PDF figures, represented in the document structure by a Figure tag with alternative text. Both give ``Character encoding'' failures when parsed by the Adobe Acrobat Accessibility checker (the $\beta$ in the second figure no longer causes problems if you omit \texttt{math/setup=\{mathml-SE,mathml-AF\}} from DocumentMetadata.) \begin{figure}[ht] \centering \includegraphics[ width=.45\linewidth, alt={A simple graph showing a diagonal line on coordinate axes.} ]{xobject-figure.pdf} \caption{A simple example graph.} \end{figure} The figure above is generated by xobject-figure.tex which should be created when you compile this document (compile that file to generate the PDF). The figure below was created in R Studio, by running the commands \texttt{set.seed(1); hist(rnorm(1000),40,xlab=expression(beta),main="")} and exporting the file as PDF saved to the file \texttt{Rplot.pdf}. \begin{figure}[ht] \centering \includegraphics[ width=.65\linewidth, alt={A simple graph showing a histogram of a sample from a standard Normal distribution of size N=1000.} ]{Rplot.pdf} \caption{A simple example graph.} \end{figure} \end{document}
- exam.cls and \raggedright \oneparchoiceby Leeser on August 25, 2026 at 3:12 pm
When using \raggedright in exam.cls and the oneparchoices or oneparcheckboxes environment, the choices are listed vertically rather than on the one line. MWE attached. If I comment out \raggedright it works as intended, leaving in \raggedright puts them in a vertical list. I'd be grateful if anyone has a solution to this. I have tried {\justify ...} and {% \rightskip=0pt plus 1em \parfillskip=0pt plus 1em \begin{oneparcheckboxes}...} and a few other tweaks but nothing works. \documentclass{exam} \begin{document} \raggedright % comment in/out \begin{questions} \question What is the minimum number of personnel that should be present in the laboratory when experimental work is in progress? \begin{oneparcheckboxes} \choice 1 \CorrectChoice 2 \choice 3 \choice 4 \end{oneparcheckboxes} \question What is the minimum number of personnel that should be present in the laboratory when experimental work is in progress? \begin{oneparchoices} \choice 1 \CorrectChoice 2 \choice 3 \choice 4 \end{oneparchoices} \end{questions} \end{document} EDIT POST ANSWERS FROM kabenyuk and David Carlisle Following testing of both answers, both answers worked as I'm sure you tried yourselves before posting. I compiled the answers and both worked. I then compiled my original faulty behaviour MWE without making any changes and it worked fine. I deleted all .aux etc files and recompiled my original file and all fine. Headscratching. I have selected the first answer by kabenyuk to mark a solution but both work.