Hot
- The order of \pgfkeys always mattered in tikz's option?by Explorer on March 25, 2026 at 12:11 pm
I have the following code example: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \draw[->,>=latex] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \draw[>=latex,->] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,below=of tmp,node distance=.5cm] {below}; \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,node distance=.5cm,below=of tmp] {below}; \end{tikzpicture} \end{document} Which gives the following: What I get confused is that: ->,>=latex and >=latex,-> behaves the same below=of tmp,node distance=.5cm honer the default value node distance=1cm, and node distance=.5cm,below=of tmp honer the previous node distance=.5cm Why caused the difference between >= and node distance? How to know whether an option's order is important with \pgfkeys? Edited: As jps commented: Keys are generally ordered as key code is executed in the order given. Whether the order of keys then matters strongly depends on the key code. The way to know whether an option's order matters is to either know the implementation by heart, or trial and error and Jasper Habicht supplemented that: Some keys only store a value in a macro that is later retrieved (which is true for the arrow settings, for example). The values stored in the macros are only retrieved when the arrows is drawn, that is at the end of the path. But other keys actually use values that are stored in macros and if these values are set my other keys, the order is relevant. But as was said above: You really need to know how the implementation is exactly to know whether the first or the second holds in a specific case. Here below is my follow-up doubt: In my understanding, "TikZ keys are applied in the order they are given", so is the following always safer (avoid the unexpected behavior of below=of tmp,node distance=.5cm)? >=latex,->: define the arrow style at first, then set the arrow node distance=.5cm,below=of tmp: set the distance at first, then apply the position
- NVDA screen reader with MathML not working properlyby Tricia Bevans on March 25, 2026 at 6:58 am
I'm taking first steps to make accessible math pdf documents. I have used a simple template for a very basic document that compiles properly with luaLatex using the tool here:https://latex3.github.io/tagging-project/documentation/wtpdf/small-example but I want to listen to how it's read by a screen reader. I've downloaded NVDA and the MathCat add-on but nothing seems to read properly like it does in these demo videos: https://latex3.github.io/tagging-project/documentation/wtpdf/fulldoc I've tried to use the actual document from the videos as well to know I was using a document that was tagged properly but it still doesn't read things clearly as it's supposed to. I've tried in Adobe and Foxit. What am I missing? I'll be so grateful for any support I can get. I'm not very sophisticated in any aspect of this process so the simpler the explanations the better.
- Mix and match lowercase letters from different mathematical fontsby Yi Wang on March 25, 2026 at 4:17 am
I'm currently using the unicode-math package and I want to mix lowercase characters from different mathematical fonts. For example, lowercase Latin letters $x$ from XITSMath-Regular.otf and $u,v,w$ from NewCMM-Book.otf. I know that using setmathfont to replace all lowercase Latin letters works, but it doesn't work when I want to replace a single Latin letter. I used Gemini's solution, employing the range parameter of the \setmathfont command to replace individual letters, but this did not work; the lowercase letters I attempted to replace still displayed the NewCMMath font. \documentclass{article} \usepackage{unicode-math} % --- Font Configuration Start --- % 1. Set the main math font (New Computer Modern Book) \setmathfont{NewCMMath-Book.otf} % 2. Map all lowercase Latin letters to XITS Math % This covers a-z in italic (math) mode as the baseline for your request \setmathfont{XITSMath-Regular.otf}[ range=it/{latin-lowercase}, Scale=MatchUppercase ] % 3. Bring back u, v, w from NewCMMath-Book % (Hex: u="75, v="76, w="77) \setmathfont{NewCMMath-Book.otf}[ range={it/"75, it/"76, it/"77}, Scale=MatchUppercase ] % 4. Set f from Erewhon-Math % (Hex: f="66) \setmathfont{Erewhon-Math.otf}[ range=it/"66, Scale=MatchUppercase ] % 5. Set x from XITS Math % (Included in step 2, but isolated here for clarity and specific scaling) \setmathfont{XITSMath-Regular.otf}[ range=it/"78, Scale=MatchUppercase ] % --- Font Configuration End --- \begin{document} \section*{Math Font Mixing Test} The glyphs in the formula below are pulled from different fonts as requested: \begin{itemize} \item $f$: Erewhon-Math (distinctive hook/curve) \item $x$: XITS Math (Times-style) \item $u, v, w$: NewCMMath-Book (Computer Modern style) \item $a, b, c, y, z$: XITS Math \end{itemize} \[ f(x, u, v, w) = a + b + c + y + z \] \[ \int_{u}^{v} f(t) \, dt = \sqrt{x^2 + w^2} \] \end{document}
- Writing environment contents verbatim to a file and also keeping them inlineby seanmk on March 25, 2026 at 12:31 am
I would like to create an environment where the contents are both parsed as LaTeX and also written verbatim to a file. The reason is that I want to create a Jupyter-notebook-style environment where some code can be included in a listings-type environment and then the result of compiling and running that code is included after the code itself. I can write the contents verbatim to a file using VerbatimOut from fancyvrb: \newenvironment{mylisting}{% \VerbatimOut{myfile.c}% }{% \endVerbatimOut } I also can include the contents of that file using \lstinputlisting{myfile.c} after, but this does not end up being parsed the same way as including it inline. Specifically, escaping \labels for later \refs does not work when I use \lstinputlisting{myfile.c}. It seems like there should be a way to copy the contents of the environment into some kind of buffer to use twice, but I haven't been able to figure it out. Any help is appreciated!
- Help cant compile chemformula, compiler is hangingby Felipe9 on March 24, 2026 at 9:37 pm
When i try to compile with the line \ch{2 Fe2O3} uncommented, the compiler just hangs, never finishing, i dont get any errors MWE: \documentclass{article} \usepackage{chemmacros} \chemsetup[phases]{pos=sub} \begin{document} \ch{Fe2O3\sld{} + CO\gas{} <> Fe\sld{} + CO2\gas{}} % \ch{2 Fe2O3} \end{document}
- \end{twocolumn} doesn't workby Alex Degtyarev on March 24, 2026 at 8:58 pm
How do I go from two columns back to a single one? Here is a simple example that no one seems to address in the documentation. \documentclass{amsart} \begin{document} \columnsep1cm \begin{twocolumn} Two column text two column text two column text two column text \newpage Two column text two column text two column text two column text \newpage \end{twocolumn} Now, by the whole idea of ``environment'', this is supposed to continue in a single column, isn't it? \newpage Nevertheless, it sucks! Enhancements like \verb+\usepackage{multicol}+ do not make an iota of difference. \end{document}
- Refactor nested ifx statementby Thomas on March 24, 2026 at 4:53 pm
I'm in a situation where I have nested ifx statements that check if a value equal to another in a list of values. It results in this nested code : \documentclass{article} \begin{document} \def\name{Charlie} \def\nameA{Alice} \def\nameB{Bob} \def\nameC{Charlie} \def\nameD{Denise} \ifx\name\nameA Hello Alice ! \else \ifx\name\nameB Bonjour Bob ! \else \ifx\name\nameC Holà Charlie ! \else \ifx\name\nameD Gutten Tag Denise \else I'm sorry, you are ? \fi \fi \fi \fi \end{document} Is there a way to write this code shortly ? In Python, I would used elif, and in C++ a switch statement.
- Adjusting 'curviness' of edges in tkz-graphby Tarran M on March 24, 2026 at 3:05 pm
I am trying to make this edge not overlap with node number 5, and I didn't find anywhere in the documentation that would let me increase the length of the edge itself so that it curves more steeply. Any help would be appreciated! This is what I have so far: \begin{tikzpicture} \Vertex{1} \WE(1){7} \NOWE(7){5} \SOWE(7){2} \NOWE(2){6} \NOEA(1){3} \SOEA(1){4} \Edge(1)(7) \Edge(2)(5) \Edge[style=bend left](5)(1) \Edge[style=bend left](5)(7) \Edge[style=bend right](5)(6) \Edge[style=bend right](6)(2) \Edge[style=bend left](7)(2) \Edge[style=bend left](1)(2) \Edge[style=bend left](1)(3) \Edge[style=bend left](3)(4) \Edge[style=bend left](4)(1) \tikzset{EdgeStyle/.style={in=90,out=90}} \Edge[style=bend right](6)(1) \end{tikzpicture} with the output
- Chemfig: inconsistent `\chemmove` behaviorby Clydinite on March 24, 2026 at 2:59 pm
I am using chemfig to draw a reaction mechanism and \chemmove for electron flow. I've noticed a very strange behavior: when I draw arrows from/to other atoms, it works perfectly. However, when I use \draw (o1) .. controls +(180:0.5cm) .. (c1);, the arrow tip is significantly offset, no where near the intended carbon atom. I've already verified that the issue doesn't come from failure to compile twice. Here's the minimal reproducible example. \documentclass[border=10pt]{standalone} \usepackage{chemfig} \usepackage{tikz} \setchemfig{atom sep=7mm, bond offset=1.5pt, atom style={font=\small}} \newcommand{\chemneg}[2][45]{% \charge{#1:1pt=$\scriptscriptstyle-$}{#2}% } \begin{document} \schemestart \chemfig{*6(-(-NO_2)=-(-@{c1}C(=[2]O)-[:-30]O-CH_3)=-=)} \+ \chemfig{@{o1}\chemneg[90]{O}H} \arrow{->} \chemfig{*6(-(-NO_2)=-(-C(-[@{sb1}2]@{o2}\chemneg{O})(-[6]OH)-[@{sb2}:-30]@{o3}O-CH_3)=-=)} \arrow{->} \chemfig{*6(-(-NO_2)=-(-C(=[2]O)-[:-30]\chemneg{O})=-=)} \+ \chemfig{CH_3OH} \schemestop \chemmove[red, -stealth, shorten <= 2pt]{ \draw (o1) .. controls +(180:0.5cm) .. (c1); \draw (o2) .. controls +(180:0.5cm) .. (sb1); \draw (sb2) .. controls +(90:0.5cm) .. (o3); } \end{document}
- Proper language / babel / document settings for Swiss Standard Germanby kalle on March 24, 2026 at 2:03 pm
I would like to create a document following the Swiss Standard German variety, but I am getting incorrect quotation marks (I actually get question marks instead of quotation marks). What settings are recommended to fully support Swiss Standard German? MWE: \DocumentMetadata{ lang=de-CH, } \documentclass[nswissgerman]{report} \usepackage[nswissgerman,provide=*]{babel} \usepackage[german=swiss]{csquotes} \begin{document} \chapter{Einführung} \enquote{Dies ist ein Zitat, das besagt \enquote{sind Zitate nicht toll?}}, und doch wundere ich mich, ob es mit einer Gehaltserhöhung des Generalstabsvorstandsvorsitzenden klappen würde. \end{document}
- Setting fixed text labels for enumerate-based environment according to the item counterby Stephen on March 24, 2026 at 12:47 pm
\documentclass{article} \usepackage{enumitem} \newlist{syntax}{enumerate}{1} \renewcommand{\labelsyntaxi}{\bfseries\ifcase\value{syntaxi}\or Usage\or Argument\or Return\fi} \begin{document} \begin{syntax} \item aaa \item bbb \item ccc \end{syntax} \end{document} I've defined an enumerate-based environment (called syntax) and I want the first three labels are Usage, Argument and Return, respectively. However, the above code gives error. How to fix and what's the reason behind the error? Similar question: enumerate with custom alphabet for items
- Vertical distance between description and enumerate env [duplicate]by Gudrun on March 24, 2026 at 11:48 am
How to minimize the space between Workflow and the first item, please? Probably an easy question, but I was unable to figure it out myself. Many thanks for your help. \documentclass[a4paper]{article} \usepackage{enumitem} \begin{document} \begin{description}[style=nextline] \item[Tool:] Get a kitchen. \item[Workflow:]\leavevmode \begin{enumerate} \item Visit a location \item Pass the food into a processor \item Remove the solid pieces \item Enjoy \end{enumerate} \end{description} \end{document}
- How to stop the effect of the "\appendix" command [closed]by moumou85 on March 24, 2026 at 11:03 am
How to stop the effect of the \appendix command and return to regular numbering instead of letters.
- Index of topics at beginning of documentby Martin on March 24, 2026 at 10:20 am
I have a document, where I describe topics (one page per topic). I want to have a list of all topics together with some additional information at the beginning of the document. So far my solution is this: First I make a file whrere the list is at the end of the file. MWE (file called Themen.tex): \documentclass[a4paper,12pt]{scrartcl} \usepackage{longtable} \newcounter{nummer} \def\Uebersicht{% Nr. & Topic & A & Page \\\hline \endfirsthead Nr. & Topic & A & Page \\\hline \endhead } \usepackage{hyperref} \newcommand{\Thema}[3]{% \refstepcounter{nummer}\label{#3}% \begin{center} \LARGE #1 \end{center} \begin{table}[h!] \centering \begin{tabular}{p{4.3cm}p{1cm}p{11cm}} A: && #2 \end{tabular} \end{table} \hrule \appto\Uebersicht{\getrefnumber{#3} & #1 & #2 & \pageref{#3} \\} } \begin{document} \clearpage \Thema{A}{A}{A} \clearpage \Thema{B}{B}{B} \clearpage \Thema{C}{C}{C} \clearpage \Thema{D}{D}{D} \clearpage \clearpage \begin{longtable}[h!]{r|p{0.48\linewidth}|p{0.34\linewidth}|r} \centering \Uebersicht \end{longtable} \end{document} Afterwards, I rearrange the pages. MWE: \documentclass{scrartcl} \usepackage{pdfpages} \pdfximage{Themen.pdf}% Read entire PDF \edef\totalpages{\the\pdflastximagepages}% Store number of pages \edef\lastbutonepage{\number\numexpr\totalpages-1}% Store last page - 1 \begin{document} \includepdf[pages=last]{Themen} \includepdf[pages=1-\lastbutonepage]{Themen} \end{document} The problem is, that in the end, the cross-references to pages inside the document, as well as external links that I put in the description of the topics do not work. How can I achieve what I want with working links (either with my 2-file-solution or directly)?
- Custom date format for copyright years in a BibLaTeX style: c-prefixed date without breaking sortingby Marlon de Col on March 23, 2026 at 9:55 pm
I am writing a paper whose formatting rules for both citations and the bibliography require that the date of a reference, when it refers to the copyright year, be preceded by a lowercase "c" with no intervening space. Therefore, I would like to be able to assign the date field with the corresponding year preceded by the letter c by implementing a new date format, similar to formats such as <date>~, <date>?, etc., but restricted to accepting only the year. With this, the copyright year would be specified in the bib file as follows: date = {c<year>} Using the authoryear style from BibLaTeX as an example, the following MWE would apply: \documentclass{article} \usepackage[style=authoryear]{biblatex} \setlength{\parindent}{0pt} \begin{filecontents}{\jobname.bib} @article{aksin, author = {Aks{\i}n, {\"O}zge and T{\"u}rkmen, Hayati and Artok, Levent and {\c{C}}etinkaya, Bekir and Ni, Chaoying and B{\"u}y{\"u}kg{\"u}ng{\"o}r, Orhan and {\"O}zkal, Erhan}, title = {Effect of immobilization on catalytic characteristics of saturated {Pd-N}-heterocyclic carbenes in {Mizoroki-Heck} reactions}, journaltitle = {J.~Organomet. Chem.}, date = {c2006}, volume = 691, number = 13, pages = {3027-3036}, indextitle = {Effect of immobilization on catalytic characteristics}, } @article{glashow, author = {Glashow, Sheldon}, title = {Partial Symmetries of Weak Interactions}, journaltitle = {Nucl.~Phys.}, date = {c1961}, volume = 22, pages = {579-588}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \section{\citeauthor{aksin}} \verb|\cite{aksin}|: \cite{aksin}. \verb|\textcite{aksin}|: \textcite{aksin}. \section{\citeauthor{glashow}} \verb|\cite{glashow}|: \cite{glashow}. \verb|\textcite{glashow}|: \textcite{glashow}. \printbibliography \end{document} With this MWE, the desired output would be as follows: For reference, the document shown in this screenshot was compiled using the year field instead of date in the bib file; otherwise, the c<year> value is considered invalid and consequently ignored. However, in that case, sorting by year does not work. Given these requirements, is there a way to implement this? I have created a custom BibLaTeX style package with a few modifications that I use exclusively for this paper, so this would be implemented in the package files rather than in the document preamble.
- add xcolor definition to memoize contextby atticus on March 23, 2026 at 6:27 pm
this question is similar to add latex counter to memoize context, I just wanted these to be separated to make it easier to find the questions later. Basically this boils down to "where does xcolor" store its color definitions? So what needs to be added so in the following example the two externs have different contexts? \documentclass[a4paper]{article} \usepackage{memoize} \usepackage{tikz} \usepackage{xcolor} \colorlet{myColor}{blue} \NewDocumentEnvironment{step}{}{% \begin{tikzpicture}[myColor]% }{% \end{tikzpicture}% } \mmzset{auto={step}{ memoize, csname meaning to context={step}, csname meaning to context={environment step end aux\space} }} \begin{document} \begin{step} \node[draw,rectangle] {hello world}; \end{step} \colorlet{myColor}{red} \begin{step} \node[draw,rectangle] {hello world}; \end{step} \end{document} (with memoize the nodes are draw red in both pictures, without memoize the first is blue, the second is red)
- add latex counter to memoize contextby atticus on March 23, 2026 at 6:19 pm
I've been writing some latex code which should be able to memoize. As I'm really no expert regarding the latex internals, I'm having a hard time adding a counter to the context. I thought latex stores counter values in \c@<counter name> but still \documentclass[a4paper]{article} \usepackage{memoize} \usepackage{tikz} \newcounter{stepCnt} \setcounter{stepCnt}{0} \NewDocumentEnvironment{step}{}{% \begin{tikzpicture}% }{% \end{tikzpicture}% } \makeatletter \mmzset{auto={step}{ memoize, csname meaning to context={step}, csname meaning to context={environment step end aux\space}, csname meaning to context={c@stepCnt} }} \makeatother \begin{document} \begin{step} \node[draw,rectangle] {hello world -- counter at \arabic{stepCnt}}; \end{step} \stepcounter{stepCnt} \begin{step} \node[draw,rectangle] {hello world -- counter at \arabic{stepCnt}}; \end{step} \end{document} This leads to the following output: When disabling memoization: \documentclass[a4paper]{article} \usepackage{tikz} \newcounter{stepCnt} \setcounter{stepCnt}{0} \NewDocumentEnvironment{step}{}{% \begin{tikzpicture}% }{% \end{tikzpicture}% } \begin{document} \begin{step} \node[draw,rectangle] {hello world -- counter at \arabic{stepCnt}}; \end{step} \stepcounter{stepCnt} \begin{step} \node[draw,rectangle] {hello world -- counter at \arabic{stepCnt}}; \end{step} \end{document} seems to result in two externs with the same hash/context. Any idea how to fix this? Note: The construct with environment step end aux etc (basically "how to capture a NewDocumentEnvironment" is from https://github.com/sasozivanovic/memoize/issues/20.
- Why does \DocumentMetadata conflict with package mdframed?by Randall on March 23, 2026 at 5:05 pm
In an effort to meet federal (US) law for accessibility of documents, I have started experimenting with various accessibility enhancements for my LaTeX source files. (As a stable TeX user for over 30 years, this is a big change to process.) Following advice posted here and at the LaTex Tagging Project, I have been including the following as the first line in my source: \DocumentMetadata{lang = en, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on, tagging-setup={math/setup=mathml-SE}} I must say, this has thus far worked marvelously. When I compile using LuaLaTeX, I get a PDF that passes all my institution's accessbility checkers. So far, a lifesaver. The sole issue I've experienced is in using the package mdframed. When I attempt to use the package, as in something like \begin{mdframed} This is a key point! \end{mdframed} I get the following fatal error: l.74 This is a key point! ? h Try typing <return> to proceed. If that doesn't work, type X <return> to quit. No output is created. I have toggled on and off all reasonable combinations of packages, and the error only occurs when mdframed is invoked while the DocumentMetadata is inserted. I feel that I am a bit over my head here, so am looking for an explanation of this conflict or a fix for it. I fully admit that I may have something set incorrectly in the DocumentMetadata call, because I do not completely understand the effect that is having.
- htlatex hangs on a minimal document on Windows (MiKTeX 26.2)by LChmiel on March 23, 2026 at 4:47 pm
I have a reproducible problem with htlatex on Windows with MiKTeX 26.2. I tested it on a fresh single-user MiKTeX installation after a complete reinstall. Minimal example: \documentclass{article} \title{Publikacje} \author{Leszek J Chmielewski} \date{} \begin{document} \maketitle Test. \end{document} Command used: htlatex lchmiel_publications.tex "xhtml,charset=utf-8,html5" "" "" The process seems to hang after the first LaTeX pass. The terminal ends with: No file lchmiel_publications.aux. [1] [2] and then it does not continue. What I checked: ordinary latex compilation works the issue also happens for the minimal example above reinstalling MiKTeX did not help I also tested in a short directory path without spaces, with the same result So this does not seem to be caused by my document content. I also tried make4ht, but that was problematic as well: latex lchmiel_publications.tex tex4ht lchmiel_publications.dvi t4ht lchmiel_publications but this has output the file lchmiel_publications.html without any formatting, one line of text: Publikacje Leszek J Chmielewski Test. 1 Trials to include the formatting with CSS have failed (I cannot consider editing the html file manually). Has anyone seen this on MiKTeX 26.2 on Windows? Is there a known workaround or some TeX4ht-related component I should verify? Thank you.
- How to protect a comma in a name in biblatex (to cite someone known by a noble title)by Roel on March 23, 2026 at 4:08 pm
I would like to cite J. W. Strutt, who--to the best of my knowledge---is best known as Lord Rayleigh: https://archive.org/details/theorysound03raylgoog/page/108/mode/1up I think the name should appear as "J. W. Strutt, Baron Rayleigh" or---to facilitate looking up "Rayleigh" in a sorted list---"Rayleigh, J. W. Strutt, Baron". The latter format (also shown on archive.org) is something I don't see on a daily basis, so maybe there is a better way. This is how far I got. Since I don't think it is common to show his 'real' family name, but also it should not be abbreviated to initials, I treat it as a prefix. Mind that the extra comma in the name is something the bibliography system (biber+biblatex) will choke on, so I had to hide it. Unfortunately, simple wrapping {,} or obfuscating \char44 did not work so I ended up with this: \documentclass{article} \usepackage[ giveninits=true ]{biblatex} \usepackage[hidelinks]{hyperref} \addbibresource{main.bib} \begin{document} According to \textcite[\href{https://archive.org/details/theorysound03raylgoog/page/108/mode/1up}{p 108}]{Rayleigh1878ThSoundv2}: ``Measured by the resulting potential, a source of given magnitude, i.e. a source at which a given introduction and withdrawal of fluid takes place, is thus twice as effective when close to a rigid plane, as if it were situated in the open; and the result is ultimately the same, whether the source be concentrated in a point close to the plane, or be due to a corresponding normal motion of the surface of the plane itself.'' \printbibliography % Once more with names in a different format: \DeclareNameAlias{author}{family-given} \printbibliography[title={References with `family' name first}] \end{document} @preamble{{\newcommand{\comma}{,}}} @book{Rayleigh1878ThSoundv2, title = {The Theory of Sound}, author = {given=John William, prefix={Strutt\comma\ Baron}, family=Rayleigh}, publisher = {MacMillan \& Co., Ltd.}, date = {1896}, volume = {2}, url = {https://archive.org/details/theorysound03raylgoog} } This just doesn't feel right, but is there a better way?
- TikZ externalization fails with precompiled header (.fmt) and "Incomplete \iffalse" errorby dp21 on March 23, 2026 at 12:26 pm
I am trying to speed up the compilation of a complex project using a format file and tikz externalize. In particular I tried a setup like shown in the follwing MWE: preamble-min.tex \documentclass[a4paper,12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{external} \dump main-min.tex: \tikzset{ external/system call={% pdflatex -shell-escape -fmt=preamble-min \ -interaction=nonstopmode -jobname "\image" "\def\tikzexternalrealjob{\texsource}\input{\texsource}"% } } \tikzexternalize[prefix=tikz-cache/] \begin{document} \begin{tikzpicture} \begin{axis} \addplot+[raw gnuplot, mark=none] gnuplot { plot [-5:5] sin(x); }; \end{axis} \end{tikzpicture} \end{document} Compilation Steps: mkdir -p tikz-cache pdflatex -ini -shell-escape -jobname=preamble-min "&pdflatex preamble-min.tex" pdflatex -shell-escape -fmt=preamble-min main-min.tex The compilation stops with: ! Incomplete \iffalse; all text was ignored after line 19. <inserted text> \fi <*> main-min.tex Any ideas how to make this work well and robust? I am using texlive-2025.
- Shared counter between xsim and theoremenvironmentby Felix Benning on March 23, 2026 at 9:26 am
The package xsim introduces its own counter for exercises and stores the countervalue to reuse it for the solution. I would like it to share a counter with theorems but I did not manage to make this happen. Is there a way to do this? Essentially like \newtheorem{theorem}{Theorem}[section] \newtheorem{prop}[theorem]{Proposition} share a counter
- What prevents page number from incrementing when an exercise solution extends to a new page?by LaTeXereXeTaL on March 23, 2026 at 8:33 am
This is a followup to @cfr's wonderful answer to my previous question. I discovered that merely making a solution large enough for it to be typeset on the next page keeps the referenced page number from incrementing. However when I hover over the link to the solution's incorrect page number the popup shows the correct page number. I can't figure out what's causing this. I suspect the issue lies in the mechanism that creates the nonexistent counter, but I don't know how to go about debugging the problem. So my question is: what causes the solutions for the second and third exercises to be typeset on page 3 but have reference links displayed as page 2? MWE is identical to that from the linked answer except that \lipsum[1-4] is added to the solution of the second exercise. % Source - https://tex.stackexchange.com/a/761090 % Posted by cfr, modified by community. See post 'Timeline' for change history % Retrieved 2026-03-23, License - CC BY-SA 4.0 % !TEX program = lualatexmk % !TEX encoding = UTF-8 Unicode \documentclass{article} \usepackage[language=english]{lipsum} \usepackage{tcolorbox} \usepackage{hyperref} \hypersetup{colorlinks} \tcbuselibrary{skins,theorems} \newcounter{exercisecounter} \newcommand{\exercisecounterautorefname}{Exercise} \newcommand{\solutioncounterautorefname}{Solution} \makeatletter \newcommand*\ref@strimmer{} \def\ref@strimmer#1.#2\@nil{#2} \newif\if@solnref \newcommand*\de@ref{} \def\de@ref#1#2#3#4#5#6\@nil{ \def\tempa{#4}% \def\tempb{0}% \ifx\tempa\tempb \@solnreffalse \else \def\temp@ri{#1}% \def\temp@rii{#2}% \def\temp@riii{#3}% \@solnreftrue \edef\temp@riv{\expandafter\ref@strimmer #4\@nil}% \def\temp@rv{#5}% \fi } \NewTColorBox[use counter=exercisecounter,number within=section]{exercise}{m +!O{}} {% coltitle=black,% title={Exercise~\thetcbcounter:},% label={exer:#1},% attach title to upper=\quad,% after upper={\par\hfill {Solution on page~\pageref{soln:#1}}},% lowerbox=ignored,% savelowerto=\jobname-exercise-\thetcbcounter.tex,% record={\string\solution{#1}{\jobname-exercise-\thetcbcounter.tex}},% #2 }% \NewTotalTColorBox{\solution}{m m}{% coltitle=black,% title={Solution of Exercise~\ref{exer:#1} on page~\pageref{exer:#1}:},% attach title to upper=\par,% }{% \expandafter\de@ref\expanded{\csname r@exer:#1\endcsname}00000\@nil \if@solnref \MakeLinkTarget*{solutioncounter.\temp@riv}% \immediate\write\@auxout{% \string\newlabel{soln:#1}{{\temp@ri}{\thepage}{\temp@riii}{solutioncounter.\temp@riv}{\temp@rv}}% }% \fi \input{#2}% } \makeatother \tcbset{no solution/.style={no recording,after upper=}} \begin{document} \section{Exercises} \lipsum[1] \tcbstartrecording\relax \begin{exercise}{one} This is the first exercise. \tcblower This is the first solution. \end{exercise} I can cite \autoref{exer:one} on page~\pageref{exer:one} and solution \autoref{soln:one} on page~\pageref{soln:one}. \section{Another Section} \lipsum[1] \begin{exercise}{two} This is the second exercise. \tcblower This is the second solution.\lipsum[1-4] \end{exercise} \begin{exercise}{three} This is the third exercise. \tcblower This is the third solution. \end{exercise} \tcbstoprecording I can cite \autoref{exer:two} on page~\pageref{exer:two} and solution \autoref{soln:two} on page~\pageref{soln:two}. I can cite \autoref{exer:three} on page~\pageref{exer:three} and solution \autoref{soln:three} on page~\pageref{soln:three}. \newpage \section{Solutions} \tcbinputrecords \end{document} In the screenshot the links to the solutions for the second two exercises display as page 2 but hovering over them shows the page number as 3, which is indeed correct.
- Upgrading TexLive in LinuxMintby daniedtex on March 23, 2026 at 2:34 am
I'm a Linux Mint 22.2 user, and the latest version available in the APT repository is from 2023. Does anyone happen to know how to get the latest version (2026) of this tool? I've tried searching various forums, reading documentation, and everything else, but nothing has helped. I appreciate your help, and thank you very much for your attention.
- Tikz-cd arrow labels conflict with background colourby Amitai on March 22, 2026 at 6:11 pm
I'm using q.uiver.app to make commutative diagrams for a project. There is a feature that allows for the label of an arrow to be displayed directly above it. This creates a white background for the label, which clashes visually with the background box. Here is an example of what it looks like: Here is an example of the code for the commutative diagram, using {description} to overlay the text above the arrow: \[\begin{tikzcd} Q &&& \\ & P && X \\ \\ & {X'} && Y \arrow["{\exists!h}"{description}, dashed, from=1-1, to=2-2] \arrow["p"{description}, from=1-1, to=2-4] \arrow["q"{description}, from=1-1, to=4-2] \arrow["a"{description}, from=2-2, to=2-4] \arrow["b"{description}, from=2-2, to=4-2] \arrow["f"{description}, from=2-4, to=4-4] \arrow["g"{description}, from=4-2, to=4-4] \end{tikzcd}\] I'm using a template for the project; here is what the stylesheet uses to define the lemma/proof boxes: % proofs: proof \definecolor{prooflinecolor}{RGB}{103, 103, 103} % rgba(40, 40, 40, 180) %FORMAT \definecolor{proofbgcolor}{RGB}{247, 247, 247} % rgba(40, 40, 40, 10) %FORMAT \linedbox{@proof}{Proof}{proof}{proofbgcolor}{prooflinecolor} % this numbers the proofs, so we renew the environment to prevent that; but we still allow a title, so you can do e.g. "Proof (of Theorem 1.2.3)" \def\qed{\null\nobreak\hfill\ensuremath{\blacksquare}} % qed square %FORMAT switch \blacksquare to \square for the not-filled-in version \renewenvironment{proof}[1][]{\csname @proof*\endcsname{#1}{}}{\qed\csname end@proof*\endcsname} \def\flushproof{\vspace{-\parskip}} % put this before a proof to make it flush with the result it's proving How do I make this white background transparent? Or, if necessary, how do I set it to a certain colour (so that I can just choose the backdrop colour)?
- I am trying to make a really cool animation using Koch snowflakes, but don't know howby Jasper on March 22, 2026 at 3:28 pm
I was scrolling through reels earlier and came across a really cool animation: https://www.youtube.com/shorts/aQbq_Fpyyb4. Note: You can analyze the gif frame by frame using the method suggested by MS-SPO in the comments, or by using the website ez-gif, or by using custom python scripts. I interchangeably use ez-gif and python for these sorts of things, and in this instance used ez-gif. I did some digging and found this old post, which I modified slightly. % Source - https://tex.stackexchange.com/a/205608 % Posted by Mark Wibrow % Retrieved 2026-03-22, License - CC BY-SA 3.0 \documentclass[tikz, border=5]{standalone} \usetikzlibrary{lindenmayersystems} \tikzset{koch snowflake/.style={insert path={% l-system [l-system={rule set={F -> F-F++F-F}, axiom=F++F++F, step=0.75cm/3^#1, angle=60, order=#1,anchor=center}] -- cycle}}} \begin{document} \begin{tikzpicture} \path[fill=orange,koch snowflake=4]; \end{tikzpicture} \end{document} I am however without a clue as to how to go about producing this gif I found. I am seeking assistance in creating this gif.
- evenly-padded horizontal line separator in a table with rows with graphicsby Mampac on March 22, 2026 at 10:35 am
when defining a figure that holds a table of images, how do i ensure even and symmetric padding when using \hline in it? by default, there's no padding before the row that was \hlined. i have the following MRE: \documentclass{article} \usepackage{array} \usepackage{graphicx} \newcolumntype{I}{>{\centering\arraybackslash}m{0.18\linewidth}} % simulate images \newcommand{\fakeimg}{\rule{\linewidth}{2.5cm}} \begin{document} \begin{tabular}{c I I I} & A & B & C \\ row1 & \fakeimg & \fakeimg & \fakeimg \\ \hline row2 & \fakeimg & \fakeimg & \fakeimg \\ \end{tabular} \end{document} this produces the following image, where the rule is stuck tightly to the images on the second row: how do i define the padding in a controlled (tunable) manner so that the optional rule perfectly divides it in half (i want to add the divider only between specific pairs of rows)? i've tried interjecting a bunch of artifical spaces and padding in the rows before/after, but they all break apart when i wish for a small-scale padding of, say, 0.3ex: my attemps yield assymetrical padding where the padding before second row is smaller than padding after the first row.
- Using spy to zoom in on a curveby Nicolas on March 22, 2026 at 7:31 am
I want to show a zoom on a part of my curve with ``'spy```. The compilation of the code returns several errors to me : ! Missing \endcsname inserted. ; ! Extra \endcsname ; ! Illegal unit of measure (pt inserted) ... When I compile without the line of the spy, it works its problem. I don't understand where the problem is. If someone has an idea? \documentclass[12pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{xcolor} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usetikzlibrary{spy} \usepackage{siunitx} \sisetup{ output-decimal-marker={,}, inter-unit-product = \ensuremath{{}\cdot{}} } \definecolor{bleu}{RGB}{25, 90, 185} % Paramètres \pgfmathsetmacro{\Cb}{0.10} % mol/L (NaOH) \pgfmathsetmacro{\Va}{10} % mL \pgfmathsetmacro{\Vdil}{100} % mL \pgfmathsetmacro{\Vzero}{\Va+\Vdil} \pgfmathsetmacro{\na}{0.0008} % mol CH3COOH \pgfmathsetmacro{\Veq}{8} % mL \pgfmathsetmacro{\Ka}{1.8e-5} \pgfmathsetmacro{\lH}{349.6} \pgfmathsetmacro{\lNa}{50.1} \pgfmathsetmacro{\lOH}{198.0} \pgfmathsetmacro{\lAc}{40.9} % Ionisation initiale \pgfmathsetmacro{\Ca}{\na/(\Vzero/1000)} \pgfmathsetmacro{\Hinit}{sqrt(\Ka*\Ca)} \pgfmathsetmacro{\nHinit}{\Hinit*(\Vzero/1000)} \pgfmathsetmacro{\Vneutr}{\nHinit/\Cb*1000} % mL \begin{document} \begin{tikzpicture}[spy using outlines={circle, magnification=4, size=2cm, connect spies}] \begin{axis}[ width=15cm, height=10cm, xlabel={$V_b$ (\si{mL})}, ylabel={$\sigma$ (\si{\milli\siemens\per\centi\meter})}, xmin=0, xmax=26, ymin=0, ymax=4, grid=both, axis lines=left ] % -------------------------- % Neutralisation des H+ initiaux % -------------------------- \addplot[magenta, line width=1.7pt, smooth] coordinates { (0, 0.126) (0.398,0.018) }; % Avant Veq \addplot[magenta, domain=0.398:\Veq, samples=200,line width=1.7pt, smooth] { ( (\lNa*(\Cb*x/1000) + \lAc*(\Cb*x/1000) + \lH*sqrt(\Ka*((\na - \Cb*x/1000)/((\Vzero + x)/1000))) * ((\Vzero + x)/1000) ) / ((\Vzero + x)/1000) ) }; \addlegendentry{avant Veq} % Après Veq \addplot[magenta, domain=\Veq:25, samples=200, smooth, line width=1.7pt, forget plot] { (\lNa*(\Cb*x/1000) + \lAc*\na + \lOH*(\Cb*x/1000 - \na))/((\Vzero+x)/1000) }; % Volume équivalent \draw[black, line width=1.4pt, densely dotted] (axis cs:\Veq,0) -- (axis cs:\Veq,0.6); \node at (axis cs:\Veq,0.2) [ right, font=\small\bfseries] {$V_{\text{eq}}$}; % Zoom spy \spy [red] on (axis cs:0.4,0.05) in node[left] at (axis cs:1,2); \end{axis} \end{tikzpicture} \end{document}
- luadraw - Why is one of my points out of frame?by Matthew Leingang on March 21, 2026 at 9:35 pm
I'm new to luadraw and I'm trying to recreate the diagram below: Here is my code so far, and the result: % !TEX TS-program = LuaLaTeX \documentclass{standalone} \usepackage[3d]{luadraw} \begin{document} \begin{luadraw}{name=wedge} local a, b, c = 8, 6, 4 local xmax, ymax, zmax = a+1, b+1, c+1 local g = graph3d:new{ window3d = {0,xmax,0,ymax,0,zmax}, viewdir = {30,60}, size={10,10,0} } local xIntcpt, yIntcpt, zIntcpt = M(a,0,0), M(0,b,0), M(0,0,c) local P = M(4,0,0) local Q = interDD({P,vecJ},{xIntcpt,yIntcpt-xIntcpt}) local R = interDD({P,vecK},{xIntcpt,zIntcpt-xIntcpt}) g:Dscene3d( g:addPolyline({ {Origin,xmax*vecI}, {Origin,ymax*vecJ}, {Origin,zmax*vecK}, }), g:addPolyline( {xIntcpt,yIntcpt,zIntcpt}, {close=true,color="cyan"}), g:addFacet( {P,Q,R}, {color="cyan",opacity=0.5} ), g:addPolyline( {P,Q,R}, {close=true,color="cyan",style="dashed"} ), g:addLabel( "\\(x\\)",P,{pos="NW",dist=0.1}, a,xIntcpt,{pos="NW",dist=0.1}, b,yIntcpt,{pos="N",dist=0.1}, c,zIntcpt,{pos="NW",dist=0.1} ) ) g:Show() \end{luadraw} \end{document} The issue, as you can see, is that the point (0,6,0) is out of frame. I tried increasing ymax, that seems to have no effect. I tried changing the width in the size option, but that only stretches the diagram horizontally. I have tried different viewdir options, but they all cut the diagram off at one edge. I'm sure it's something basic that I'm missing, but I'm too much of a novice to notice. Any clues?
- tikz, scaling widths of linesby Zarko on March 17, 2026 at 2:39 pm
It seems (or is apparently) that thickness of lines is hard coded. Consequently when drawing a line, the use for example of scale=2 only makes the line longer and its thickness is not changed, see MWE below: \documentclass[margin=3mm, varwidth]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \tikzset{LA/.style = {-Straight Barb, line width=1mm}} \begin{document} \begin{tikzpicture} \draw[LA] (0,0) -- ++ (2,0); \end{tikzpicture} \begin{tikzpicture}[scale=2] \draw[LA] (0,0) -- ++ (2,0); \end{tikzpicture} \end{document} Is there some trick by which the thickness of the line will also be scaled? The best way would be as option of the line style, which will have effect just on this particular line. My quick search on this site so far didn't give me any suggestion ...