• How can I create a horizontal line from the end of a section's text to the right margin in multicol environment?
    by tistieom on May 19, 2026 at 10:06 am

    In my document I'm using the multicol package. My section headers span across the whole page as I put them outside the multicol environment. I'd like to have a horizontal line spanning from the end of the section header text to the right margin, like the red line in the image. So far I tried using hrulefill and runin shape. In the MWE, the first heading 'Lorem ipsum' in single-column mode works like I want it to, but the same section format in two-column mode 'Dolor sit amet' does not span the whole page. The last one without runin shape, 'Consectetuer', has the horizontal line in the line below the section text. \documentclass{article} \usepackage{titlesec, lipsum, multicol} \titleformat{\section}[runin] {\fontsize{25}{26}\selectfont\bfseries} {\thesection}{7.5pt}{}[\hspace{0.5em}\hrulefill] % With runin shape \titleformat{\subsection} {\fontsize{25}{26}\selectfont\bfseries} {\thesection}{7.5pt}{}[\hspace{0.5em}\hrulefill] % Without runin shape \begin{document} \lipsum[1-3] \section{Lorem ipsum} % Works fine in single-column \lipsum[4-6] \section{Dolor sit amet} % Does not span the whole page \begin{multicols}{2} \lipsum[7-9] \end{multicols} \subsection{Consectetuer} % Hrule is on next line \begin{multicols}{2} \lipsum[10-12] \end{multicols} \end{document} I forgot to add, I tried this answer and this answer but both caused an error: Illegal parameter number in definition of \ttlf@section. <to be read again>

  • Lualatex error when adding accent package with oldStandard math package and unicode-math
    by Nasser on May 19, 2026 at 7:09 am

    I am using code from Old math fonts with proper math table which works great. I'd like to use that font. But once I add package accents lualatex gives error. I am using laulatex with TL 2026 on Linux Ubuntu Here is MWE (same code as above in preamble) \documentclass[12pt]{article} \usepackage{microtype} \usepackage{unicode-math} \setmainfont[% ItalicFont=OldStandard-Italic.otf, BoldFont=OldStandard-Bold.otf, BoldItalicFont=OldStandard-BoldItalic.otf, SmallCapsFeatures={Numbers=OldStyle}, FakeBold=0.1]{OldStandard-Regular.otf} \setmathfont[FakeBold=1]{OldStandard-Math.otf} \usepackage{amsmath} \usepackage{accents} \begin{document} \[ \left( i-1\right) \bar{z}=\left( 2-3i\right) ^{2}% \] \end{document} Compiled using lualatex gives >lualatex 4.tex This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) restricted system commands enabled. (./4.tex LaTeX2e <2025-11-01> .... ex))) (/usr/local/texlive/2026/texmf-dist/tex/latex/accents/accents.sty) (./4.aux) ! Missing number, treated as zero. <to be read again> \protect l.19 \left( i-1\right) \bar{z} =\left( 2-3i\right) ^{2}% ? If I comment out the accent package, then everything works fine >lualatex 4.tex This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) restricted system commands enabled. .... Output written on 4.pdf (1 page, 6142 bytes). Transcript written on 4.log. > I also saw an answer here Is accents package incompatible with unicode-math? which says to load the accent package before unicode-math But this did not work for me. \documentclass[12pt]{article} \usepackage{accents} \usepackage{microtype} \usepackage{unicode-math} \setmainfont[% ItalicFont=OldStandard-Italic.otf, BoldFont=OldStandard-Bold.otf, BoldItalicFont=OldStandard-BoldItalic.otf, SmallCapsFeatures={Numbers=OldStyle}, FakeBold=0.1]{OldStandard-Regular.otf} \setmathfont[FakeBold=1]{OldStandard-Math.otf} \usepackage{amsmath} \begin{document} \[ \left( i-1\right) \bar{z}=\left( 2-3i\right) ^{2}% \] \end{document} Now I get this error >lualatex 4.tex This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) .... (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amsopn.sty) ! LaTeX Error: Command \dddot already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.746 \hbox{\,\normalfont...}\vss}}}} ? I'd like to use accent package for something else. I was wondering why this happens and if it is possible to use the accent package with this font?

  • How do I suppress MetaFun’s “overloading primitive” log messages?
    by Harry on May 19, 2026 at 6:07 am

    In ConTeXt/MetaFun, I am intentionally saving/redefining primitive tokens locally. For example: \starttext \startMPcode def my_example = begingroup; save [; save ]; endgroup; enddef; my_example; \stopMPcode \stoptext This produces a log message like: metafun > log > overloading primitive '[' metafun > log > overloading primitive ']' Is there a supported way to disable or suppress these specific MetaFun diagnostic messages? I am not trying to hide TeX errors or MetaPost errors generally. I only want to suppress MetaFun’s informational logging about primitive overloading inside specific macros, because the logging is becoming unmanageable, i.e., hundreds of lines during just testing alone.

  • Remove extra vertical spacing with boxpos=t in listings
    by Bordaigorl on May 18, 2026 at 8:27 pm

    I want to put few listings using lstlisting in a tabular. They are of varying number of lines, so I'd like them to appear aligned at the top. I know I can control vertical alignment using the boxpos=t parameter. It works but inserts extra space at the top which for the life of me I cannot remove. The second table is almost perfect, how do I remove the extra empty line at the top? And why is it there? MWE: \documentclass[acmsmall]{acmart} \usepackage{listings} % for good measure: \lstset{aboveskip=0pt,belowskip=0pt} \begin{document} Spacing is good but vertically centered: \begin{tabular}{cc} \hline \begin{lstlisting} hello := "world"; there := 1; \end{lstlisting} & \begin{lstlisting} hello := "world"; there := 1; there := 1; \end{lstlisting} \\\hline \end{tabular} \bigskip Aligned at top by \texttt{[boxtop=t]} but extra space: \begin{tabular}{cc} \hline \begin{lstlisting}[boxpos=t] hello := "world"; there := 1; \end{lstlisting} & \begin{lstlisting}[boxpos=t] hello := "world"; there := 1; there := 1; \end{lstlisting} \\\hline \end{tabular} \end{document}

  • How to define a new labeled list environment (max depth = 1, label count = 2 or possibly alternating) for the two cases of mathematical induction?
    by Nyx on May 18, 2026 at 12:40 pm

    Here is my MWE: % !TEX program = lualatex \documentclass{article} \usepackage{enumitem} \usepackage{amsthm} \usepackage{unicode-math} \usepackage[default]{fontsetup} % For NewCM \usepackage{scalerel} % For \widthof \usepackage{kantlipsum} % For placeholder text % Redefine proof environment \NewEnvironmentCopy{oldproof}{proof} \renewenvironment{proof}[1][\proofname]{% \oldproof[\bfseries#1]% }{\endoldproof} % Configure list environments \setlist{% nosep, align = left, itemindent = 0pt, font = \normalsize\normalfont, before = \normalsize\normalfont } \newlist{inductioncases}{enumerate}{1} \setlist[inductioncases]{% leftmargin = \widthof{(Base case)} + 4pt, label = (Base case), labelsep = 4pt, labelwidth = \widthof{(Base case)}, listparindent = \parindent } % Number sets \newcommand*{\numberset}[1]{\symbf{#1}} \newcommand*{\nonnegativeintegers}{\numberset{Z}_{\geq 0}} \begin{document} \begin{proof} \begin{inductioncases} \item \kant[1][1-2] We have shown that \(P(0)\) is true. \item[(Induction step)] \kant[2][1-2] We have shown that for every \(k\) in \(\nonnegativeintegers\), \(P(k)\) being true implies \(P(k + 1)\) is true. \end{inductioncases} Therefore, by the principle of mathematical induction, we have sufficiently proven that for every \(n\) in \(\nonnegativeintegers\), \(P(n)\) is true. \end{proof} \end{document} I suppose I'm looking for a conditional/if-else way of labeling odd-numbered inductioncases \items with (Base case) and labeling even-numbered inductioncases \items with (Induction step). How would I achieve this?

  • Line across sphere
    by Sokoban on May 18, 2026 at 12:21 pm

    I am currently solving some Putnam math exercises for fun and I wanted to visualize some geometry questions. One exercises goes like this: Let S be a spherical cap, where the distance between two points is given by the length of the shortest great circle arc. Then there is no distance-preserving mapping to the Euclidean plane. I solved this exercise (which is not really that hard) and now I want to visualize the cap. I managed to get almost everything except the distance between the Nordpole and a point on the rim of the cap. This is what I got: \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=3] \draw (0,0) circle (1); \draw[thick] (-1,0) arc (180:360:1 and 0.28); \draw (-1,0) arc (180:0:1 and 0.28); \draw[dashed] (-0.85,0.5) arc (180:360:0.85 and 0.18); \draw[dashed] (-0.85,0.5) arc (180:0:0.85 and 0.18); \fill (0,1.) circle (0.015); \node[right] at (0,1.1) {$N$}; \fill (0,0.5) circle (0.015); \node[left] at (0,0.5) {$O$}; \coordinate (P) at (0.85,0.5); \fill (P) circle (0.015); \draw[thick] (0,0.5) -- (P); \node[above] at (0.4,0.5) {$r$}; \node[blue,right] at (0.45,0.93) {$R$}; \node[left] at (-0.88,0.55) {$C$}; \end{tikzpicture} \end{document} What is missing is now a line (spherical) from N to the rim but I want it in 3d not like in 2d where the letter R is right now but rather something like this: I tried my best but I have no clue on how to achieve this. Can someone help me? Also, I think I only need the cap of the sphere, not the whole object...

  • How to align equations in tabularray
    by Namal on May 18, 2026 at 8:09 am

    I am using tabularray with longtblr and I want to align the equation, but it seems that only $ work as math environment. I also tried to add another row with the second case in it, but it looks similar unaligned. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage[landscape, lmargin=0.5cm, rmargin=0.5cm]{geometry} \usepackage{tabularray} \UseTblrLibrary{amsmath} \pagenumbering{gobble} \begin{document} \centering \begin{longtblr}{|l|l|X[l]|X[3,c]|l|l|X[l]|} \hline 100 & Pause & {Anstabd} & \SetCell[r=2]{c} { $(CF=3) \Rightarrow \begin{+cases} 10, & 65525<Val\leq 65536; \\ \mathtt{0x10000}-Val, & 65436<Val\leq 65525; \\ 100, & 65436\leq Val; \\ \end{+cases} $ \\ $(CF=7) \Rightarrow \begin{+cases} 10, & 65376<Val\leq 65536; \\ \frac{\mathtt{0x10000}-Val}{16}, & 63936<Val\leq 65376; \\ 100, & 63936\leq Val; \\ \end{+cases} $ } & \SetCell[r=2]{}004 & \SetCell[r=2]{}Some Text & \SetCell[r=2]{}More Text \\ \hline[dotted] 03B7.4& {CCCCCCCCCCCCC} & 3=1-fach | 7=16-fach & & & & \\ \hline \end{longtblr} \end{document}

  • Why are `{` and `}` printed as `-` and `"` instead of as themselves when their category codes are changed to normal letters?
    by H4XeO6 on May 18, 2026 at 2:22 am

    Here is my minimal example (main.tex): \catcode`\{=11 \catcode`\}=11 hello}{ \bye I compiled it with tex main && dvipdfmx main.dvi and obtained main.pdf, which contains a single page printed as hello˝–. Actually, the issue could fixed up when I switch to a typewriter font: \catcode`\{=11 \catcode`\}=11 \tt hello}{ \bye Why does the default font produce this unexpected output? What is the underlying reason?

  • Effects of "intertext" within "align"
    by Michael Hardy on May 17, 2026 at 9:48 pm

    In the code below, the use of "intertext" with the words "and in general" has the effect that instances of ":=" above and below those words will be vertically aligned with each other. However, the last "intertext" near the end, was a (possibly misguided?) attempt to prevent that last phrase, beginning with the word "where", getting separated from what appears above it in case the house style of a publication to which I will submit this does not allow display breaks. But this causes extra vertical blank space to appear below that phrase: the space where something would appear on the next line if there were a next line. Is there a simple way to prevent a page break between the "where" phrase and the stuff above it without getting that extra which space below that? \begin{align} f_0\big( (\alpha)_{\alpha\in I} \big) : = {} & \sum_{\text{even } n\ge0} (-1)^{n/2} \sum_{A\in\binom In} \prod_{\alpha\,\in\,A} \sin\alpha \prod_{\alpha\,\in\,I\smallsetminus A} \cos\alpha, \\ \label{sine of sum} f_1\big( (\alpha)_{\alpha\in I} \big) : = % \sin \sum_{\alpha\in I} \alpha = {} & \sum_{\text{ odd } n\ge1} (-1)^{(n-1)/2} \sum_{_{A\in\binom In}} \prod_{\alpha\,\in\,A} \sin\alpha \prod_{\alpha\,\in\,I\smallsetminus A} \cos\alpha, \\ f_2\big( (\alpha)_{\alpha\in I} \big) : = {} & \sum_{\text{even } n\,\ge\,2} (-1)^{(n-2)/2} n \sum_{_{A\in\binom In}} \prod_{\alpha\,\in\,A} \sin\alpha \prod_{\alpha\,\in\,I\smallsetminus A} \cos\alpha, \\ f_3\big( (\alpha)_{\alpha\in I} \big) : = {} & \sum_{\text{ odd } n\,\ge\,3} (-1)^{(n-3)/2} (n-1) \sum_{_{A\in\binom In}} \prod_{\alpha\,\in\,A} \sin\alpha \prod_{\alpha\,\in\,I\smallsetminus A} \cos\alpha, \intertext{and in general,} f_i\big( (\alpha)_{\alpha\in I} \big) := {} & \!\!\!\! \sum_{\begin{smallmatrix} n \, \ge\,i \\ n\,\equiv\,i\bmod 2 \end{smallmatrix}} (-1)^{(n-i)/2} c_i(n) \sum_{A\in\binom In} \prod_{\alpha\,\in\,A} \sin\alpha \prod_{\alpha\,\in\,I\smallsetminus A} \cos\alpha \intertext{where $c_i(n)$ is the minimal polynomial of the set $\{\,n\in\{\,0,1,2,\ldots,i-1\,\} : n\equiv i\bmod2\,\}$.} \nonumber \end{align}

  • Tangential curve labels with 1D force-based collision avoidance along paths in pgfplots
    by cjorssen on May 17, 2026 at 8:44 pm

    I am trying to implement a dynamic labeling system for multiple curves within a pgfplots axis environment. The goal is to have curve labels that are both tangential (sloped) to their respective paths and capable of avoiding collisions by utilizing a 1D force-based relaxation mechanism to repel each other along the curves' domains. My Understanding of pgfplots Internals From what I understand of pgfplots internals, and please correct me if my assumption is flawed, the package operates on a deferred drawing (or accumulation) model, conceptually quite similar to how matplotlib handles figures in Python. It seems to split its workflow into distinct steps: A Survey Phase where it reads \addplot data, accumulates coordinates in memory, and computes the global axis limits. A Visualization Phase triggered at \end{axis} where it maps data coordinates to physical dimensions and emits the actual TikZ paths and nodes. Based on this understanding, it feels like the ideal place to inject a label-relaxation algorithm would be right between these two phases (perhaps using hooks like before end axis), after the data is parsed but before the final typesetting occurs. The Technical Bottleneck: The Node Bounding Box Dilemma The core difficulty I am facing is a classic "chicken-and-egg" problem: To know the dimensions (width, height, depth) of a label's bounding box for collision detection, TeX must first typeset the text into a box. However, we cannot definitively position or rotate that node along the path until the force-based algorithm has computed the final, relaxed $t$ parameters for all curves. If a LuaLaTeX-based approach is required to handle the physics/loop, I am completely open to it. But I am unsure how to elegantly pass TeX box dimensions into Lua, or how to query the generated curve paths before the rendering phase. Minimal Working Example (Current State) Here is a basic MWE where the labels are sloped but completely overlap: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ domain=0:3.5, restrict y to domain = 0:10, samples=100, axis lines=left ] % Curve 1 \addplot[blue, thick] {x^2} node[pos = 0.2, sloped] {Function $f(x)$}; % Curve 2 \addplot[red, thick] {1/x} node[pos = 0.8, sloped] {Function $g(x)$}; \end{axis} \end{tikzpicture} \end{document} Tentative Logic / Pseudo-code (Force-Based Relaxation) Ideally, the macro or Lua script would perform a spring-embedder / force-directed approach constrained to 1D path coordinates: # Pre-computation phase for each label L_i: Typeset L_i into a temporary TeX box to get its dimensions (W_i, H_i) # Force-directed loop while system_not_in_equilibrium and max_iterations_not_reached: Initialize forces F_i = 0 for all labels for each curve i with label L_i: 1. Get baseline position P_i = curve_i(t_i) 2. Compute tangent angle theta_i at t_i 3. Construct Label Bounding Box B_i (using W_i, H_i) at P_i rotated by theta_i for each pair of labels (L_i, L_j): if Intersect(B_i, B_j): # Compute repulsive force based on overlap magnitude force_magnitude = calculate_repulsive_force(B_i, B_j) # Project force along the 1D direction of the respective curves F_i = F_i - force_magnitude F_j = F_j + force_magnitude # Update positions using a small step size (damping) for each label L_i: t_i = t_i + alpha * F_i ConstraintToValidDomain(t_i) Questions & Directions Is my mental model of the pgfplots accumulation process accurate enough to build upon, or am I missing a fundamental constraint of the package architecture? Is there an existing package or experimental snippet that already handles force-based label placement or relaxation algorithms along TikZ paths? If doing this via LuaLaTeX, what is the cleanest way to intercept the path coordinates generated by pgfplots and pass the TeX box dimensions to a Lua-based physics loop? Any pointers, conceptual corrections, or architectural advice would be highly appreciated. Real-World Use Case (Thermodynamic Diagrams) To provide some concrete context on why this automation is so critical for my workflow, here is a screenshot of the type of complex diagram I am currently generating (with luatex, FFI and the CoolProp shared library). It is a pressure-enthalpy (p-h) diagram widely used in refrigeration and chemical engineering, plotted in the (p, log h) plane for a pure substance. As you can see, the visual density is extremely high because it overlays several distinct families of isolines crossing each other: Isotherms (constant temperature) Isentropes (constant entropy) Isochores (constant specific volume) Vapor quality lines / isotitres (constant dryness fraction) Manually hardcoding and fine-tuning the pos parameter for dozens of labels across these intersecting families of curves is completely unmanageable—especially since the curves shift dramatically depending on the thermodynamic properties of the fluid being modeled. Having a generalized, tangential, force-directed algorithm to let these labels dynamically find their equilibrium along their respective paths would be an absolute game-changer for rendering complex engineering charts natively in pgfplots.

  • Detect whether or not DocumentMetadata was set?
    by rallg on May 17, 2026 at 8:23 pm

    EDIT: As noted in comments, this question is very user-specific. MWE: \DocumentMetadata{} %% Any content at all. \documentclass{book} \IfPackageLoadedTF{tagpdf}{\typeout{USED DOCUMENTMETADATA}}{\typeout{NO DOCUMENTMETADATA}} \begin{document} Hello, World. \end{document} That works, both with pdflatex and lualatex. But it makes me nervous. Here is why: I use a custom document class (not on CTAN) that is privately available to a few others, who know little about *tex (they must read my instructions). Since I do only print to paper (no Ebook) with PDF/X-1a:2001, anything related to tagging is useless. Also, I am locked into PDF version 1.3. I use my own code for the PDF/X, with or without optional XMP. That is, I do not load package pdfx or anything similar. All good; I know what I am doing there. But if a user fails to follow my instructions, which specifically says NOT to use \DocumentMetadata, many problems will arise. What I currently do is detect whether or not package tagpdf was loaded, in my \documentclass definition. The MWE shows this as code in Preamble. But it seems to me that this method is unreliable. Perhaps some variations of \DocumentMetadata will not load tagpdf, or that package will be re-named, or its code brought into kernel, or whatever. Then my test will fail. Question: Is there a reliable, future-proof method for detecting whether or not \DocumentMetadata was set? That is, I wish to throw an error if it was set, no matter what its contents.

  • How to convert a custom macro for marking angles with multiple arcs into a TikZ style?
    by Med Elhadi Kh on May 17, 2026 at 8:59 am

    I have created a custom macro \MarkAngle that draws multiple arcs to mark an angle. It works well, but I want to convert it into a native TikZ style (e.g., using .style n args={4} or .code n args={4}) so I can use it cleanly within standard TikZ path options like this: \draw [red, thick, angle radius=1cm, mark angle={3}{A}{B}{C}]; Here is my Minimal Working Example (MWE), which includes my working \MarkAngle macro and my attempt at defining mark angle/.code n args={4}. However, using \pic inside a .code within a \draw path feels hacky and doesn't integrate perfectly. \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{decorations.markings, angles, quotes} % My working macro \newcommand{\MarkAngle}[5][]{% \begingroup \tikzset{angle radius=1cm, #1} \pgfkeysgetvalue{/tikz/angle radius}{\baseR} \foreach \i in {1,...,#2} { \pgfmathsetmacro{\currentR}{\baseR + (\i-1)*5} \ifnum\i=#2 \pic [draw, #1, angle radius=\currentR pt] {angle=#3--#4--#5}; \else \pic [draw, #1, fill=none, angle radius=\currentR pt] {angle=#3--#4--#5}; \fi } \endgroup } \begin{document} \begin{tikzpicture}[ mark segment/.style={ decoration={ markings, mark=at position 0.5 with { \foreach \i in {1,...,#1} { \pgfmathsetmacro{\xoffset}{(\i - (#1+1)/2) * 3} \draw (\xoffset pt, -4pt) -- (\xoffset pt, 4pt); }}}, postaction={decorate} }, % My attempt to convert it into a style mark angle/.code n args={4}{ \pgfmathsetmacro{\baseR}{scalar(\pgfkeysvalueof{/tikz/angle radius})} \foreach \i in {1,...,#1} { \pgfmathsetmacro{\currentR}{\baseR + (\i-1)*3} \ifnum\i=#1 \pic [draw, pic actions, angle radius=\currentR pt] {angle=#2--#3--#4}; \else \pic [draw, pic actions, fill=none, mark segment={}, angle radius=\currentR pt] {angle=#2--#3--#4}; \fi } } ] \coordinate (A) at (30:2); \coordinate (B) at (0,0); \coordinate (C) at (150:2); \draw (A) -- (B) -- (C); % Trying to use the style here \draw [red, thick, angle radius=1cm, mark angle={3}{A}{B}{C}]; \coordinate (D) at (0,2); \coordinate (E) at (0,0); \coordinate (F) at (2,0); \draw (D) -- (E) -- (F); \draw [blue, thick, angle radius=1cm, mark angle={2}{D}{E}{F}]; \end{tikzpicture} \end{document} My questions are: How can I properly define this as a TikZ style so that it respects path properties (like colors and line widths)? Is using .code the best approach here, or should this be defined entirely as a new custom pic type? Any advice on the most "TikZ-idiomatic" way to achieve this would be highly appreciated!

  • Relabeling ticks on my number line
    by cheeseboardqueen on May 17, 2026 at 1:54 am

    I am trying to draw my own number line with variable ticks. I was able to generate the tick marks exactly where I want them and define the variable, however, they aren't spacing out the way I'd hope. Any suggestions? \documentclass[11pt]{amsart} \usepackage{tikz,tikz-cd} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture} \draw[latex-latex] (-7.5,0) -- (7.5,0) ; %edit here for the axis \foreach \x in {-6.5, -6, -5.5, -4, -2.5, -2, -1.5, 0, 1.5, 2, 2.5, 4, 5.5, 6, 6.5} % edit here for the vertical lines \draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt); \foreach \x in {-z_b-T-h, -z_b-T, -z_b-T+h, -z_b, -z_b+T-h, -z_b+T, -z_b+T+h, 0, z_c-T-h, z_c-T, z_c-T+h, z_c, z_c+T-h, z_c+T, z_c+T+h} % edit here for the numbers \draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] {$\x$}; \end{tikzpicture} \end{figure} \end{document} EDIT: I am looking to label the -6.5 position with $-z_b-T-h$ and so on. I'd be even okay if my defined labels don't fit horizontally and I have to label them vertically.

  • Space before a vertical rule in an array got eaten in TeX Live 2023 but not in TeX Live 2024. What happened?
    by Mark McGregor on May 17, 2026 at 12:01 am

    Feeding \documentclass{article} \pagestyle{empty} \usepackage{array} \begin{document} $\begin{array}{l||l} X \; & \; Y \end{array}$ \end{document} to pdflatex to latex in TeX Live 2023 yields As you see, before the double bar there is slightly less space than after it; probably, the space \; is eaten away. In TeX Live 2024 and 2025, the space before the double bar seems to be present: Due to italics math, it's a bit difficult to say which TeX-Live version produces a correct™ result. So I tried out \documentclass{article} \pagestyle{empty} \usepackage{array} \begin{document} $\begin{array}{l||l} \mathrm{X} \; & \; \mathrm{X} \end{array}$ \end{document} pdflatex in TL 2023 yields and pdflatex in TL 2024 yields The output in TeX Live 2024 seems to me more equalized, so probably corresponding to the author's intention, hence probably correct™. Still, before I adapt various arrays in my old code to match the behavior in the newer TeX Live, I need to know this: Was the TeX-Live-2023 behavior intentional? If so, for which reason? Was the change of behavior intentional? If so, for which reason?

  • Reproducing the textbook Introduction to Solid State Physics
    by Sebastiano on May 16, 2026 at 8:19 pm

    While examining the embedded fonts used in the book Introduction to Solid State Physics by Charles Kittel (2005 edition), I started wondering whether its typography could realistically be reproduced in modern LaTeX. The PDF appears to use the following embedded fonts: MathPiOneBoldItalic MathPiOneItalic MathematicalPi-One MathematicalPi-Three NewCaledonia NewCaledonia-Bold NewCaledonia-BoldItalic NewCaledonia-Italic Universal-GreekwithMathPi Universal-NewswithCommPi From what I can see, the main text font seems to be New Caledonia, while the mathematics appear to rely on a set of older Pi/math companion fonts. Actually is there the possibility to adapt LaTeX the families above with similar fonts like the following image? My personal impression is that the original text was probably not produced using LaTeX. Edited by Explorer To provide more information of the fonts, we could learn from here to get exactly what text the font is:

  • How to get \usebox to respect xrightmargin of \lstlisting...?
    by OppfinnarJocke on May 16, 2026 at 7:54 pm

    I am trying to scale a lstlisting in a Beamer presentation, and for that I have to (?) put the listing into an lrbox. However, when I do that and later render it out as \usebox{\mybox} the xrightmargin of my listing is not respected. Is there any way to get this to work? MWE: \documentclass{beamer} \usepackage{listings} \usepackage{color} \lstset{ language=C, basicstyle=\footnotesize\ttfamily, numbers=left, numberstyle=\footnotesize, stepnumber=1, tabsize=2, numbersep=-2pt, showspaces=false, showstringspaces=false, showtabs=false, frame=single, framexleftmargin=-10pt, captionpos=b, breaklines=true, breakatwhitespace=false, } \begin{filecontents}{myfile.tex} \begin{lstlisting}[xrightmargin=3.5cm] void function (int r, int m, int *ptr, int *block, double value, double dest) { return block[r * m + *ptr] + value - dest; } \end{lstlisting}% \end{filecontents} \newsavebox{\mybox} \begin{document} \begin{lrbox}{\mybox}% \input{myfile.tex} \end{lrbox}% \begin{frame}[fragile]{usebox top, no usebox bottom} \usebox{\mybox}%% Ignores xrightmargin \vspace{0.5cm} \input{myfile.tex}%% Preserves xrightmargin \end{frame} \end{document} Result (frames are only for emphasis): What I want is to have \usebox preserve the xrightmargin so that I can then scale the narrower listing with \scalebox. Is this possible?

  • Revealing blanks does not work well in numerator of a \frac
    by scottkosty on May 16, 2026 at 7:26 pm

    I am using an implementation to first show an underline with a questionmark in the middle that takes up the same space as the revealed text, from this answer: An alt fill-in-the-blank with question in the middle and improved to handle nesting at Nested revealing of (correctly sized) blanks. But the underline is too long when I use it in a fraction. Presumably the code that calculates the length assumes the normal font size? Example below (see the last bullet point). % based on here: https://tex.stackexchange.com/a/757717 % Posted by jlab % Retrieved 2026-05-16, License - CC BY-SA 4.0 \documentclass{beamer} % needed to reproduce \beamerdefaultoverlayspecification{<alert@+|+->} \makeatletter \newlength{\gapwidth} \newcommand{\blankQ}[1]{% \begingroup% \edef\beamerpauses@backup{\arabic{beamerpauses}}% \ifmmode \if@display \settowidth{\gapwidth}{$\displaystyle #1$}% \else \settowidth{\gapwidth}{$#1$}% \fi \else \settowidth{\gapwidth}{#1}% \fi \setcounter{beamerpauses}{\beamerpauses@backup}% \alert<.(1)|handout:0>{% \alt<+->{% #1% }{% \vphantom{#1}\smash{\underline{\makebox[\gapwidth]{?}}}% }% }% \endgroup% } \makeatother \begin{document} \begin{frame} \begin{itemize} \item simple example showing usage of blankQ: $2+2=\blankQ{4.}$ \item $P(X + 1 < 4) = \blankQ{P(X < 3) = \blankQ{0.3.}}$ \item \blankQ{It works also \blankQ{for more \blankQ{nested levels\blankQ{~!~}}}} \item Now to show the problem: the underline is too long when in numerator: $V(X_i) = \frac{\blankQ{P_{H_{0}}(X_{i}=1)\left[1-P_{H_{0}}(X_i=1)\right]}}{n}$ \end{itemize} \end{frame} \end{document} Output from above example, showing the problem:

  • PDF/UA-2 structure destination failures (LaTeX source)
    by Julian on May 15, 2026 at 10:48 am

    Here is a MWE of LuaLaTeX source code: \nonstopmode \RequirePackage{pdfmanagement} \RequirePackage{tagpdf} \tagpdfsetup{activate/mc=true,activate/spaces=true} \documentclass[11pt,usegeometry]{article} \usepackage{hyperref} \hypersetup{ pdftitle={MyTitle}, pdfauthor={MyName}, pdfdisplaydoctitle=true} } \begin{document} \tableofcontents \section{First Section} A document with a single sentence linking to \hyperlink{My Ref}{My Ref}. \hypertarget{My Ref}{My Ref}. Details about my reference. \end{document} After I compile twice and then auto-tag the resulting PDF in Adobe Acrobat Pro, veraPDF includes the following PDF/UA-2 validation failures: I am looking for a way to resolve these failures, both for automated Table of Contents entries and also individual hyperlink/hypertarget internal links. Some background: I needed to meet a work deadline and I did not have enough time to recode my tabularray-based tables with tabular-based tables in my full document to enable full tagging using tagpdf, but I wanted to replace the interword glue with space glyphs to give screen readers some fluency as a stopgap while I create a fully accessible version of my PDF, which must be visually identical to the untagged version. Apart from this structure destination issue, I have found Adobe's auto-tag feature to be very useful. I simply set up a root Document tag, with Part tags inside them for my chapters, copy the relevant chunks into them, fix a few things here and there, and veraPDF is almost fully happy. Fixing "Each TOCI in the table of contents shall identify the target of the reference using the Ref entry" is fiddly but I know how to do it. The key stumbling block is this issue here: structure destinations. I feel tantalisingly close to being able to produce a nice PDF/UA-2 document, simply using Adobe Acrobat Pro to remediate. Any help would be greatly appreciated. Is it possible to fix this by editing tags in Adobe Acrobat Pro manually, with or without help from different LaTeX coding of the internal links? (Which presumably could be coded/automated?) Or is there an existing tool that would allow these to be fixed throughout my document? I have tried reading the ISO and PDF/UA-2 documentation but this is over my head. I have seen similar questions and answers here, and here, but I lack the technical knowledge to apply a solution. With a detailed description and/or screenshot of what to change (presumably inside the properties of Link - OBJR tags?), I would be good to go, and hugely grateful.

  • The linebreak syntax bug with luacode?
    by Explorer on May 15, 2026 at 7:18 am

    The highly related question is here and here and even early here: \documentclass{standalone}% compile with lualatex \usepackage{luacode} \begin{document} \begin{luacode} local f = function(x, y, opt) opt = opt or {} opt.sg = opt.sg or '+' if opt.sg == '+' then return x+y else return x-y end end local x = f(2, 2, {sg='+'} ) -- < this causes an error with luacode, but not luacode* tex.print("Result ="..x) \end{luacode} \end{document} The code above raise: (./mwe.aux)[\directlua]:13: ')' expected (to close '(' at line 11) near '='. \luacode@dbg@exec ...code@maybe@printdbg {#1} #1 } l.21 \end{luacode} ? I wonder is this really a bug which exists for past 14 years, and any suggestions or patch to correct this abnormal behaviour? Edited: Since nidarfp pointed out here: Two solutions: The ideal solution: that the author of luacode fixes the problem. Use the luadraw* environment (which uses luacode*), and your problem should disappear, but you won't be able to use TeX macros in the luadraw source code (which is the advantage of luacode) I wonder any further advice on luadraw' side?

  • Is there a way to draw this parabola in plain tikz without getting a dimension error?
    by Jasper on May 15, 2026 at 5:52 am

    Is there a way to draw this parabola in plain tikz without getting a dimension error? I don't want to drag out the big guns for what seems like it should be a simple diagram. \documentclass[tikz,border=1cm]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \pgfmathsetmacro\FOCUSX{2} \pgfmathsetmacro\FOCUSY{1} \pgfmathsetmacro\LINEPX{-1} \pgfmathsetmacro\LINEPY{0} \pgfmathsetmacro\LINEDX{-3} \pgfmathsetmacro\LINEDY{2} \pgfmathsetmacro\LINEDL{sqrt((\LINEDX)^2 + (\LINEDY)^2)} \pgfmathsetmacro\LINEDX{\LINEDX/\LINEDL} \pgfmathsetmacro\LINEDY{\LINEDY/\LINEDL} \pgfmathsetmacro\LINEPERPX{\LINEDY} \pgfmathsetmacro\LINEPERPY{-\LINEDX} % Focus \fill (\FOCUSX,\FOCUSY) node[right]{$F$} circle[radius=0.1]; % Directrix \draw[dashed] (\LINEPX,\LINEPY) -- +(7*\LINEDX,7*\LINEDY) -- +(-7*\LINEDX,-7*\LINEDY); \fill (\LINEPX,\LINEPY) node[below left]{$P$} circle[radius=0.1]; \draw[->] (\LINEPX,\LINEPY) -- ++(\LINEDX,\LINEDY) node[below left]{$D$}; % Directrix normal \draw[->] (\LINEPX,\LINEPY) -- ++(\LINEPERPX,\LINEPERPY) node[above left]{$N$}; \foreach \ALPHA in {-4,-3.5,...,4} { \pgfmathsetmacro\QUADA{1-(\LINEPERPX)^2-(\LINEPERPY)^2} \pgfmathsetmacro\QUADB{ \LINEPERPX*(\LINEPX+\ALPHA*\LINEDX-\FOCUSX) +\LINEPERPY*(\LINEPY+\ALPHA*\LINEDY-\FOCUSY) } \pgfmathsetmacro\QUADB{-2*\QUADB} \pgfmathsetmacro\QUADC{ (\LINEPX+\ALPHA*\LINEDX-\FOCUSX)^2 +(\LINEPY+\ALPHA*\LINEDY-\FOCUSY)^2 } \pgfmathsetmacro\QUADC{-\QUADC} \pgfmathsetmacro\BETA{ (-\QUADB+sqrt((\QUADB)^2-4*\QUADA*\QUADC)) /(2*\QUADA) } \fill[green] ($(\LINEPX,\LINEPY) + \ALPHA*(\LINEDX,\LINEDY) + \BETA*(\LINEPERPX,\LINEPERPY)$) circle[radius=0.1]; } \end{tikzpicture} \end{document}

  • Is there a way to customize the definition of a tikzduck part? I am trying to draw a unicorn, but the horn is the same color as the body
    by Jasper on May 14, 2026 at 8:40 pm

    Is there a way to customize the definition of a tikzduck part? I am trying to draw a unicorn, but the horn is the same color as the body. I want the horn to be a different color, and to also add some draw commands to it, so I can make a sort of swirl around it. Like this: \documentclass{article} \usepackage{tikz,tikzducks} \begin{document} \begin{tikzpicture} \duck[ body=brown!80!white, longhair=brown!50!black, horsetail, unicorn=brown!50!black ] \end{tikzpicture} \end{document}

  • theorem-like-aware lists for cleveref
    by random name on May 14, 2026 at 2:53 pm

    I use LaTeX for mathematics and am often in a situation where I want to write something like the following: I have a theorem with two conditions or sub-statements etc. which I later want to refer to in two different ways: Theorem 1.1. If X is ..., then X has the following properties (a) property a (b) property b proof. To prove (a) we ... ... "We see that Y satisfies Theorem 1.1.a so ...". For this, I would want the LaTeX code to look something like: \begin{theorem} If $X$ is ..., then $X$ has the following properties \begin{thmlist} \item\label{it:a} property a \item property b \end{thmlist} \end{theorem} \begin{proof} To prove \ref{it:a} we ... \end{proof} We see that $Y$ satisfies \cref{it:a} so ... The closest I have gotten to getting this to work is the following unsatisfactory way using thmtools and cleveref: \documentclass{amsart} \usepackage{enumitem} \usepackage{thmtools} \usepackage{cleveref} \newcounter{mythmlike} \numberwithin{mythmlike}{section} % setup lists \newlist{thmlist}{enumerate}{1} \setlist[thmlist]{label=\textnormal{\textbf{(\textit{\alph*})}},ref=\themythmlike.\alph*} % setup theorem-like environments with thmtools \declaretheoremstyle[sibling=mythmlike]{minsetning} \declaretheorem[style=minsetning,name=Theorem,postheadhook={\crefalias{thmlisti}{theorem}}]{theorem} \declaretheorem[style=minsetning,name=Corollary,postheadhook={\crefalias{thmlisti}{corollary}}]{corollary} \declaretheorem[style=minsetning,name=Lemma,postheadhook={\crefalias{thmlisti}{lemma}}]{lemma} \declaretheorem[style=minsetning,name=Proposition,postheadhook={\crefalias{thmlisti}{proposition}}]{proposition} \begin{document} \section{math} \begin{theorem} If $X$ is ..., then $X$ has the following properties \begin{thmlist} \item\label{it:a} property a \item property b \end{thmlist} \end{theorem} \begin{proof} To prove \ref{it:a} we ... \end{proof} We see that $Y$ satisfies \cref{it:a} so ... \end{document} Which produces The problems with this are two-fold: In the proof it writes "to prove 1.1.a we ..." instead of "to prove (a) we ...". It would be really great to have a command like \shortref{it:a} which would produce the latter. I have a lot of different theorem-like environments (even more than I gave in the example) and I would much prefer not having to add the postheadhook={\crefalias{thmlisti}{name}} to every single one. I tried adding postheadhook={\protect\crefalias{thmlisti}{\thmt@thmname}} when declaring the theorem-like minsetning style, but this does not work. I will add that it is important for me to have as much of the programming completely hidden away in my .sty/.cls file so that I can focus on just writing mathematics when I write -- This is also why I want to be able to use thmlist for all the theorem-like environments and not also something like a lemlist for lemmas etc. (also because I want the flexibility to easily change a lemma to a proposition etc. - which is the main benefit of using cleveref for me). Any help would be very much appreciated!

  • How to shrink with a certain amount of offset?
    by D G on May 14, 2026 at 1:09 pm

    I want a one cm offset between the blue path and the black one. \documentclass[tikz,margin=1cm]{standalone} \begin{document} \begin{tikzpicture} \draw[gray!50] (-8,0) grid (8,-8); \fill (0,0) node[above=12pt]{origin} circle (5pt); \draw[ultra thick] (-6,0) arc[x radius=12,y radius=8,start angle=90,end angle=0] -- (-6,-8) -- cycle; \draw[blue,ultra thick] (-5,-1) arc[x radius=10,y radius=6,start angle=90,end angle=0] -- (-5,-7) -- cycle; \end{tikzpicture} \end{document} Note: Both must be similar. Right now both are not similar.

  • How do I make the gate branch in the JFET transistor symbol centralised rather than to the bottom or top of the gate?
    by Vector on May 14, 2026 at 10:58 am

    I am trying to reproduce a specific transistor circuit image for an assignment. Using the stock circuitikz JFET symbol, I was able to reproduce the circuit fairly well. I am also quite satisfied with it. I am curious, however, if it is possible to make the gate closer to the center as it is in the image. I have looked through the documentation and the only plausible solution I can find is to create a new symbol however I am a bit stuck on how to go about that. The damper example in the documentation was not very clear. Here is the code, if it is needed. (I removed the voltmeter to keep the code copied compact.) \documentclass[border = 10pt]{standalone} \usepackage{amsmath} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[american, scale = 0.65] \ctikzset{ transistors/scale=1, capacitors/scale=0.7, resistors/scale=0.8 } % Transistor \draw (0,0) node[njfet, tr circle, anchor=S](Q){}; \draw(Q.G) to[short] ++(-2,0) to[short] ++(0, -2) node[ground] (G1) {}; \draw(Q.S) to[short] (Q.S |- G1) node[ground] {}; \coordinate (V_s) at ($(Q.D) + (1.5,0)$); \draw[-{Triangle[scale = 1.5]}](V_s) to[short] ++(-1.5,0) coordinate (Q.D); \draw (V_s)to [short](Q.S -| V_s); \draw[-{Triangle[scale = 1.5]}] (Q.S -| V_s) to[short] (Q.S); \draw(Q.D) to [short] ++ (0, 1.5) to[ammeter, v^<={\phantom{m}}] ++ (3.5,0) to[R, l_={$4.7\ \mathrm{k}\Omega$}, a^= {$R_D$}] ++(3.7,0) coordinate(C) to [battery, name = BDD, v_={\phantom{m}}, l^= {$V_\mathrm{DD}$}] (C |- G1) node[ground] {}; \ctikztunablearrow{1}{1}{135}{BDD} \end{circuitikz} \end{document} Here are the images;

  • Tikz: perpendicular line to intersect the x-axis
    by Tldi You on May 14, 2026 at 10:11 am

    I would like to draw a line starting from the point (200, 105.6), perpendicular to the failure envelope, and extending down to intersect the x-axis. I have implemented the following LaTeX/TikZ \documentclass[border=2pt]{standalone} \usepackage{pgfplots,siunitx} \pgfplotsset{compat=1.18} \usetikzlibrary{calc} \begin{document} \centering \begin{tikzpicture} \begin{axis}[ width=15cm, height=9.375cm, xmin=0, xmax=640, ymin=0, ymax=400, xtick={0,80,...,640}, ytick={0,80,...,400}, minor tick num=1, grid=both, grid style={black, thin}, minor grid style={black, thin}, xlabel={Contrainte normale ($\sigma_{nr}$), $kN/m^2$}, ylabel={Contrainte de cisaillement ($\tau_r$), $kN/m^2$}, axis line style={thick}, tick label style={font=\small}, label style={font=\small}, clip=false ] % Regression line: tau = 34 + sigma * tan(20) \addplot [domain=0:590, samples=2, thin, black] {34 + x*tan(20)}; % Data points on the line (open circles) \addplot [only marks, mark=o, mark size=3.5pt, fill=white, thin, black] coordinates { (100, 72.2) (200, 105.6) (300, 144.4) (400,177.7) }; % Solid dot and its label \node [circle, fill, inner sep=1.5pt] (dot) at (axis cs:320, 138) {}; \node [anchor=west, xshift=2pt] at (axis cs:320, 138) {\small (320, 138)}; % Perpendicular line from the 3rd circle (x=300) \coordinate (P) at (axis cs:200, {36 + 200*tan(20)}); \draw [very thick, black] (P) -- (axis cs:252.1, 0); % Right angle symbol \draw [very thick, black] ($(P) + ({-18*cos(20)}, {-18*sin(20)})$) -- ($(P) + ({-18*cos(20) + 18*sin(20)}, {-18*sin(20) - 18*cos(20)})$) -- ($(P) + ({18*sin(20)}, {-18*cos(20)})$); % Angle phi indicator \coordinate (phi_pt) at (axis cs:520, {34 + 520*tan(20)}); \draw [thin, black] (phi_pt) -- +(0.8cm, 0); \draw [thin, black] (phi_pt) +(0.5cm, 0) arc (0:20:0.5cm); % Box in top right \node [draw, thick, fill=white, align=center, inner sep=10pt] at (axis cs:520, 340) { $c = 34 \, kN/m^2$ \\ $\varphi = \ang{20}$ }; % Phi angle \coordinate (V) at (axis cs:520,223); \draw[thin] (V) -- ++(25pt,0); \draw[thin] ($(V)+(15pt,0)$) arc[start angle=0,end angle=20,radius=15pt]; \node[right] at ($(V)+(22pt,2pt)$) {$\varphi$}; \end{axis} \end{tikzpicture} \end{document} Do you have any suggestions or improvements? CURRENT RESULT:

  • Break point inadequate in nested boxes
    by Erwann on May 14, 2026 at 4:18 am

    In the code below, there are two \TitleBox environments inside a single \DocumentBox. I expected that when I add sufficient \lipsum text in the second \TitleBox, the page break would occur within that box at the overflow point. Instead, the entire second \TitleBox is moved to the next page, leaving extra whitespace on the first page. Is there a remedy for this behavior? \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[english]{babel} %\usepackage{csquotes} % disabled; use ``'' \usepackage[most]{tcolorbox} \usepackage[letterpaper]{geometry} \usepackage{lipsum} % ---------------------------------------------------------------- % Amendment commands % ---------------------------------------------------------------- \newcommand{\Delete}[1]{% {\sout{#1}}% } \newcommand{\Amend}[1]{% {\uline{#1}}% } % ---------------------------------------------------------------- % Global container % ---------------------------------------------------------------- \newtcolorbox{DocumentBox}{ enhanced, breakable, colback=white, boxrule=0.8pt, arc=1mm, left=4mm, right=4mm, top=4mm, bottom=4mm, } % ---------------------------------------------------------------- % Title box (FIXED: NOT breakable) % ---------------------------------------------------------------- \newtcolorbox{TitleBox}[1]{ enhanced, boxrule=0.6pt, arc=1mm, title={#1}, fonttitle=\sffamily, before skip=4mm, after skip=4mm, left=3mm, right=3mm, top=2mm, bottom=2mm, before upper=\parindent0pt, } % ---------------------------------------------------------------- \begin{document} \begin{DocumentBox} \begin{TitleBox}{\lipsum[1][1]} \lipsum[1][2] \end{TitleBox} \begin{TitleBox}{\lipsum[1][3]} \lipsum[2] \lipsum[3] \lipsum[4] \lipsum[5] \lipsum[6] \lipsum[7] \end{TitleBox} \end{DocumentBox} \end{document}

  • renewcommand Gamma into itGamma in unicode-math
    by Ryan Kong on May 14, 2026 at 2:26 am

    I want to have a command \Gamma that does what \itGamma does, under unicode math. My Preambles: %! TEX program = xelatex \documentclass[]{article} \usepackage{amsmath} \usepackage[]{unicode-math} \setmathfont[]{TeX Gyre Termes Math} I only want \Gamma to be italic, so I will not consider using \usepackage[math-style=ISO]{unicode-math}. Here's what I tried and their respective error messages (or problem): \renewcommand{\Gamma}{\itGamma} \renewcommand{\Gamma}{\mitGamma} \AtBeginDocument{\renewcommand{\Gamma}{\mitGamma}} % They all compiles, but the result shows a upright \Gamma \AtBeginDocument{\renewcommand{\Gamma}{\itGamma}} % TeX capacity exceeded, sorry [input stack size=10000]. \tl_if_exist:NTF #1->\if_meaning:w #1 \unimathsetup{Gamma=italic} % The key 'unicode-math/Gamma' is unknown and is being ignored. I have no idea what I can do now, help would be much appreciated.

  • Remember coordinate in nested tikzpicture with listings
    by Jason Cho on May 13, 2026 at 2:10 pm

    \documentclass{standalone} \usepackage{xcolor} \usepackage{tikz} \usepackage{listings} \begin{document} \begin{tikzpicture}[remember picture] \node[draw] {\begin{lstlisting}[language=c++, linewidth=140pt, basicstyle=\ttfamily\scriptsize] class Counter : public QObject { public: Counter() { value = 0; }!\tikz[remember picture]\node (l1){};! int getValue() { return value; }!\tikz[remember picture]\node (l2){};! }; \end{lstlisting}}; \draw[red, ->] (l1) -- (l2); \end{tikzpicture} \end{document} In this code snippet, I use listings to syntax highlight a piece of C++ code, where I mark two lines with name l1 and l2. Then I want to use the coordinates of l1 and l2. However, the output is off. How do I fix the location of the named coordinates? Requirements: I name these two points because there are a dozen of commands relying on these coordinates. Therefore I do not want to cram these commands between the escapechars of lstlisting. I want to measure the full size of the picture, including the main listing and adornments. For example, when I center the picture, the whole pic is centered, not only the main listing. I have checked: Remember coordinate in nested tikzpicture points to a weird place was solved by using a special command \subnode in tikz-qtree. access a coordinate in a nested \tikzpicture was solved by removing nesting.

  • Apply command on each line of an environment automatically (luatex)
    by Salim Bou on May 13, 2026 at 1:12 pm

    This code splits each line of an environment into two parts, places each part in a box of a specified width, and separates them with a small space. What I want is for this to happen automatically without writing the instruction at the beginning of each line, only specifying the split position and the end of the line. % lualatex \documentclass[12pt]{article} \usepackage[margin=1.8cm]{geometry} \def\<#1&#2>{\makebox[7.8cm][s]{#1}\hspace{1cm}\makebox[7.8cm][s]{#2}} \newenvironment{mypoem}{\begin{center}\baselineskip=36pt\bfseries} {\end{center}} \begin{document} \begin{mypoem} \<first part of poem & second part of poem>\\ \end{mypoem} \end{document}

  • I want to make a beamer presentation where I start with an animation, then animate that animation turning into the title page
    by Jasper on May 13, 2026 at 6:13 am

    I want to make a beamer presentation where I start with an animation, then animate that animation turning into the title page. I cannot figure out how to do this in beamer, and was barely able to get a prototype working in article. This is by no means an MWE, and it is by no means correct (I believe it is incorrect). But it is what I can muster right now. I want to minick this effect in beamer, where I start on a fullscreen animated slide, then animate the transition from that slide to the titlepage. I want the titlepage to be aligned as it normally would, with no vertical or horizontal separation. This is what I have so far, it needs to be viewed through adobe acrobat. \documentclass{article} \usepackage[paperwidth=160mm,paperheight=90mm,margin=0pt]{geometry} \usepackage{pgfplots,graphicx,tikz-3dplot,animate,tikzducks} \pgfplotsset{compat=1.18} \usetikzlibrary{calc} \newenvironment{jasperslide}{}{\newpage} \newsavebox{\titlebox} \sbox{\titlebox}{% \parbox{160mm}{% \centering {\Large\bfseries Overfull \textbackslash{}dbox}\par\vskip 1.5em {\normalsize Jasper Nice}\par\vskip 0.8em {\small Today}% }% } \begin{document} \begin{jasperslide} \begin{animateinline}[autoplay,loop]{10}% \pgfplotsforeachungrouped \FRAME in {1,...,60} {% \tdplotsetmaincoords{90}{-90}% \begin{tikzpicture}[x=\pagewidth,y=\pageheight] \coordinate (C) at (current page.center); \useasboundingbox (current page.south west) rectangle (current page.north east); \begin{scope}[tdplot_main_coords] \begin{scope}[canvas is yz plane at x=0,shift={($(current page.center)$)}] \duck \end{scope} \end{scope} \end{tikzpicture}% \pgfmathsetmacro{\III}{\FRAME != 60}% \ifnum\III=1\newframe\fi% }% \end{animateinline}% \end{jasperslide} \begin{jasperslide} \begin{animateinline}[autoplay]{10}% \pgfplotsforeachungrouped \FRAME in {1,...,60} {% \tdplotsetmaincoords{90-90*\FRAME/68}{-90+90*\FRAME/68}% \begin{tikzpicture}[x=\pagewidth,y=\pageheight] \coordinate (C) at (current page.center); \useasboundingbox (current page.south west) rectangle (current page.north east); \begin{scope}[tdplot_main_coords] \node[canvas is xy plane at z=0,transform shape] at (C) {\usebox{\titlebox}}; \begin{scope}[canvas is yz plane at x=0,shift={($(current page.center)$)}] \duck \end{scope} \end{scope} \end{tikzpicture}% \pgfmathsetmacro{\III}{\FRAME != 60}% \ifnum\III=1\newframe\else\newframe% \tdplotsetmaincoords{0}{0}% \begin{tikzpicture}[x=\pagewidth,y=\pageheight] \coordinate (C) at (current page.center); \useasboundingbox (current page.south west) rectangle (current page.north east); \begin{scope}[tdplot_main_coords] \node[canvas is xy plane at z=0,transform shape] at (C) {\usebox{\titlebox}}; \end{scope} \end{tikzpicture}% \fi% }% \end{animateinline}% \end{jasperslide} \end{document}