• Good way to write dynamical physics problems
    by Rassine Orange on June 10, 2026 at 3:58 pm

    I'm a physics teacher and I'd like to share here my way to write "dynamical" exercises. After posting a couple of questions more or less related, I've read comments implying that my way of doing could be improved. When I say "dynamical" I mean that the variables of my problem (\mass, \speed, ...) are coded in the questions. I don't wanna hard-code for the following reasons: If I write everything with, say, m=3kg, and then I wanna change to m=2kg, I don't wanna rewrite everything. I can reuse the questions very fast with different values, e.g. for exams or for the students to practise. Below a MWE of a "typical" problem. Please, do not focus on the Physics, but on the LaTeX ideas, mainly: Could I improve the way I store variables and compute other quantities? For the units, which command should I use: mathrm; text ; textup; ... ? Anything else? I want to make clear that, even if in this example I use basic maths (mainly the 4 operations), I typically need all the usual fonctions (powers, log, sqrt, exp, trigo), so any solution that you suggest should handle all these functions. \documentclass{article} \usepackage{xfp} % provides \fpeval \usepackage{amsmath} \begin{document} \def\mass{3} \def\speed{10} \def\distance{1} \edef\Ekin{\fpeval{0.5*\mass*\speed^2}} \edef\force{\fpeval{0.5*\mass*\speed^2/\distance}} A mass $m=\mass\, \mathrm{kg}$ starts moving from rest. After a distance $d=\distance\, \textup{m}$ its velocity is $\speed\, \text{m} \times \text{s}^{-1}$\,. Compute the force. \vspace{5cm} Solution First you compute the kinetic energy $$ E=\frac 12 mv^2 = \Ekin\, \mathrm{J} $$ blabla more details, more equations, blablabla Use the work theorem to find $$ F=\frac{mv^2}{2d} = \force\, \mathrm{N}\,. $$ \end{document} Community Edit: Current output

  • Bibliography not printing
    by Dots_and_Arrows on June 10, 2026 at 2:19 pm

    The Bibliography chapter name is visible but there are no bibliography entries. I have checked the bibtex file carefully and it is there in the folder containing BibTeX entries. What should I change in the code? \documentclass[a4paper,12pt,english,oneside]{book} \setcounter{tocdepth}{3} \setcounter{secnumdepth}{4} \usepackage[T1]{fontenc} \usepackage{imakeidx} \usepackage[utf8]{inputenc} \usepackage[a4paper,left=1in,right=1in,top=1in,bottom=1in,bindingoffset=0.5in]{geometry} \usepackage{graphicx} \usepackage{import} \usepackage{verbatim} \usepackage{amsmath} \usepackage{afterpage} \usepackage{dashrule} \usepackage{amsmath,amssymb,amsfonts,amsthm} \usepackage{algorithmic} \usepackage[ruled,vlined]{algorithm2e} \usepackage{multirow} \usepackage{comment} \usepackage{array} \usepackage{ragged2e} \usepackage{type1cm} \usepackage{enumitem} \usepackage{pifont} \usepackage{dirtytalk} \usepackage{epigraph} \usepackage{setspace} \usepackage{indentfirst} \usepackage[super]{nth} \usepackage{enumitem} \usepackage{caption} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikz-cd} \usepackage[all]{xy} \usetikzlibrary{cd} \usetikzlibrary{shapes,arrows,positioning} \setlength{\headheight}{15pt} \makeindex[columns=2, title=Index, intoc, options=-s mystyle.ist] \newcommand{\nomunit}[1]{% \renewcommand{\nomentryend}{\hspace*{\fill}#1}} %---------------------------------------------- % ******** PDF, URL AND HYPERLINK PACKAGES ********* % \usepackage{url} \usepackage[dvipsnames]{xcolor} \usepackage{indentfirst} \usepackage{hyperref} \hypersetup{colorlinks=false} % ************* DROPCAP PACKAGE ******************** % \usepackage{type1cm} \usepackage{lettrine} \setlength{\DefaultNindent}{0pt} \setlength{\DefaultFindent}{3pt} \setcounter{DefaultLines}{2} \renewcommand{\LettrineTextFont}{\rmfamily} \renewcommand{\LettrineFontHook}{\fontfamily{ptm}} %---------------------------------------------- %***************** GRAPHICS PACKAGES AND COMMANDS **************% \usepackage{float} \usepackage{subfigure} \usepackage{multicol} \newcolumntype{R}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} % ****************** Chapter Title header *************************** \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[L]{\nouppercase{\footnotesize\leftmark}} \fancyhead[C]{} \fancyhead[R]{} \renewcommand{\headrulewidth}{0.1pt} \cfoot{\thepage} \usepackage[explicit]{titlesec} \usepackage[style=numeric,backend=biber,sorting=nyt]{biblatex} \addbibresource{Bibliography.bib} %\titleformat*{\subsubsection}{\normalfont\normalsize\bfseries\color{Sepia}} % **************Theorem Environments ************************* \renewcommand{\baselinestretch}{1.2} \setlength{\oddsidemargin}{.2cm} \setlength{\evensidemargin}{.2cm} \topmargin -1.4cm \theoremstyle{plain} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{conjecture}[theorem]{Conjecture} \newtheorem{result}[theorem]{Result} \newtheorem{corollary}[theorem]{Corollary} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \newtheorem{observation}[theorem]{Observation} \newtheorem{observations}[theorem]{Observations} \newtheorem{definitions}[theorem]{Definitions} \newtheorem{example}[theorem]{Example} \newtheorem{examples}[theorem]{Examples} \newtheorem{remark}[theorem]{Remark} \newtheorem{remarks}[theorem]{Remarks} \newtheorem{notation}[theorem]{Notations} \newtheorem{note}[theorem]{Note} \newtheorem{notes}[theorem]{Notes} \newtheorem{ques}[theorem]{Question} \renewcommand{\thefootnote}{} %**************** BEGIN DOCUMENT *********************% % \begin{document} %***************** FRONT MATTER *****************% \pagestyle{empty} \import{FRONT MATTER/}{PAGE01-Title_Page} %\blankpage \import{FRONT MATTER/}{PAGE02-Certificate_from_Supervisors} \newpage \import{FRONT MATTER/}{PAGE03-Author declaration} \newpage \import{FRONT MATTER/}{PAGE04-Dedication} \clearpage %-------------------------------------------------- %************* NUMBERED FRONT PAGES ************% \frontmatter \pagestyle{plain} \pagenumbering{roman} \setcounter{page}{1} \singlespacing \phantomsection \addcontentsline{toc}{chapter}{Acknowledgements} \import{FRONT MATTER/}{PAGE05-Acknowledgement} \clearpage \phantomsection \addcontentsline{toc}{chapter}{Abstract} \import{FRONT MATTER/}{PAGE06-Abstract} \clearpage \onehalfspacing \phantomsection \addcontentsline{toc}{chapter}{List of Research Papers} \import{FRONT MATTER/}{List of publications} \clearpage \singlespacing \tableofcontents %---------------------------------------------------- %***************** CHAPTER_1 **********************% \mainmatter \pagenumbering{arabic} \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 1: Introduction} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter1} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** CHAPTER_2 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 2: Preliminaries} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter2} % Change Chapter Number here \clearpage %\csname @openrightfalse\endcsname %---------------------------------------------------- %***************** CHAPTER_3 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 3: Running title} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter3} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** CHAPTER_4 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 4: Running title} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter4} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** CHAPTER_5 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 5: On Singquandle Shadows} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter5} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** CHAPTER_6 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 6: Categorical interplay in Singquandles} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter6} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** CHAPTER_7 **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Chapter 7: Conclusions and Remarks} % Change Chapter Heading here \renewcommand{\headrulewidth}{1pt} \onehalfspacing \include{CHAPTERS/Chapter7} % Change Chapter Number here \clearpage %---------------------------------------------------- %***************** BIBLIOGRAPHY **********************% \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Bibliography} \renewcommand{\headrulewidth}{1pt} \printbibliography \clearpage \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \fancyhead[LE,RO]{Index} \renewcommand{\headrulewidth}{1pt} \printindex \end{document}

  • rowcolor not fill properly when \multicolumn comes
    by MadyYuvi on June 10, 2026 at 1:47 pm

    In my table, column heads are in shade and the text should be in white color, and the table body have alternative shades, I've try with: \documentclass{article} \usepackage{tabularx} \usepackage[table]{xcolor} \begin{document} \newcommand{\colhead}[1]{\color{white}#1} \newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}% \def\toprule{\rowcolor{black!70}} \def\midrule{\relax} \rowcolors{0}{black!10}{black!20}% \arrayrulecolor{white} \setlength{\arrayrulewidth}{1pt} \begin{table} \caption{Party identification, by social characteristics, 2024} \begin{tabularx}{\textwidth}{ P{50pt}| P{45pt}|X|X|X|X|X|X|} \toprule \colhead{Category (Percentage of Sample)} &\multicolumn{2}{X}{\colhead{Democrats}} &\multicolumn{3}{X}{\colhead{Independents}} &\multicolumn{2}{X}{\colhead{Republicans}}\\ \toprule \colhead{} & \colhead{Strong} & \colhead{Weak} & \colhead{Lean Dem} & \colhead{Pure} & \colhead{Lean Rep} & \colhead{Weak} & \colhead{Strong}\\ \hline \midrule Men\index{Men} (48) & 20 & 9 & 17 & 5 & 20 & 10 & 19\\ \hline Women\index{Women} (52) & 24 & 16 & 16 & 6 & 13 & 9 & 16\\ \hline Whites (72) & 21 & 10 & 12 & 6 & 14 & 12 & 26\\ \hline \end{tabularx} \end{table} \end{document} when \multicolumn comes, shades for column heads not coming properly: Please advise.

  • Escaped \pause works well in listings' lstlisting but not in tcolorbox' tcblisting
    by Denis Bitouzé on June 10, 2026 at 11:34 am

    As shown by the following MCE, escaped \pause works well in listings' lstlisting but not in tcolorbox' tcblisting: with the latter, what should appear only from the 4th slide: appears on the 2nd, disappears on the 3rd, reappears on the 4th. How to fix this issue? \documentclass[t]{beamer} \usepackage{listings} \usepackage{tcolorbox} \lstset{% basicstyle=\ttfamily, escapeinside=@\ , escapebegin=\pause{}\$\ , } \tcbuselibrary{listings} \begin{document} \begin{frame}[fragile]{lstlisting: OK (slide number : \insertslidenumber)} Foo \pause{} Bar \begin{lstlisting} @ bar \end{lstlisting} \pause{} Baz \end{frame} \begin{frame}[fragile]{tcblisting: not OK (slide number : \insertslidenumber)} Foo \pause{} Bar \begin{tcblisting}{listing only} @ bar \end{tcblisting} \pause{} Baz \end{frame} \end{document}

  • How to tweak the bounding box of `overarrows`?
    by Explorer on June 10, 2026 at 10:00 am

    This post comes from my previous solution, then I simplified them: \documentclass{article} \usepackage{showframe} \usepackage[tikz]{overarrows} \usetikzlibrary{decorations.markings} \NewOverArrowCommand[tikz]{\underarrowA}{% add tikz options={line cap=round,decoration={markings,mark=at position 0.5 with {\draw[-](-1pt,-1pt)--(1pt,1pt);\draw[-](-1pt,1pt)--(1pt,-1pt);}}}, add path options={postaction={decorate}}, arrows={->[scale=0.5]}, path = {(0,0) -- (1,0)}, center arrow, arrow under, min length=15, space after arrow=0.4ex, } \NewOverArrowCommand[tikz]{\underarrowC}{% path options={arrows={<[scale=0.5]->[scale=0.5]}},% path={% (0,0) -- (0.5,0) to[loop below,in=-45,out=225,min distance=4mm,every loop/.style={}] (0.5,0) -- (1,0) }, center arrow, arrow under, min length=15, space after arrow=0.4ex, } \setlength{\parindent}{0pt} \setlength{\fboxsep}{0pt} \usepackage{lipsum} \begin{document} $\underarrowA{v} \qquad \underarrowA{vvv} \qquad \underarrowA{ABCD} $ $\underarrowC{v} \qquad \underarrowC{vvv} \qquad \underarrowC{ABCD} $ \fbox{$A\underarrowA{v}B$} \fbox{$A\underarrowC{v}B$} \bigskip \end{document} We could see from the above that the bounding box of arrowC is larger than expected. I wonder whether there are good suggesion to refine this?

  • PGFPlots / TikZ: Filtering data from a file when the x-axis contains string values
    by joseldsm on June 10, 2026 at 9:57 am

    I am generating a plot in PGFPlots/TikZ where the x-axis contains string values and the y-axis contains numerical data. The data is imported from a CSV file, and everything works correctly so far. However, when I use skip coordinates between index, the filtering is applied to the y-values and not to the x-axis categories. In this case, I want to draw only the data with the string value B. Is there a way to correctly apply this filtering to both x-axis ? Thanks! Here is the MWE. Keep in mind that in my case the data are extract from csv file. \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \pgfplotstableread{ String Value A 0 A 6 A 4 B 9 B 5 B 1 B 3 B 7 C 4 C 7 C 9 C 3 }\data \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, ymin=0, xtick=data, xticklabels from table={\data}{String}, nodes near coords ] \addplot table[ x expr=\coordindex, y={Value}, skip coords between index={0}{3}, skip coords between index={8}{100} ]{\data}; \end{axis} \end{tikzpicture} \end{document}

  • Custom optional parameters for classes in LaTeX
    by Zerina on June 10, 2026 at 9:46 am

    I have customized a MyReport.cls file with a custom optional parameter "Reference", which functions as follows: It defaults to None. If the user passes a bib file path via \documentclass[Reference={ref.bib}]{MyReport}, then execute: \RequirePackage[hyperref=true,backend=biber,url=false,doi=false,sorting=none,style=gb7714-2015]{biblatex} \AtBeginDocument{\addbibresource{ref.bib}} \AtEndDocument{\printbibliography[heading=bibintoc]} How can I implement this feature? Here is the MyReport.cls \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesClass{MyReport}[2024/01/01 v1.0.0 My custom report class] \def\xjtuthesis{MyReport} \def\meta@version{1.0.0} \def\metaversion{\meta@version} \newcommand{\MyReport@bibfile}{} \DeclareOption{Reference}{ \renewcommand{\MyReport@bibfile}{#1} } \ProcessOptions\relax \LoadClass[twoside]{article} \RequirePackage[zihao=-4]{ctex} \RequirePackage[a4paper,left=2.54cm,right=2.54cm,top=3.18cm,bottom=3.18cm]{geometry} \RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref} \makeatletter \ifx\MyReport@bibfile\@empty % do nothing \else \RequirePackage[hyperref=true,backend=biber,url=false,doi=false,sorting=none,style=gb7714-2015]{biblatex} \AtBeginDocument{\addbibresource{\MyReport@bibfile}} \AtEndDocument{ \clearpage \printbibliography[heading=bibintoc] } \fi \makeatother and the below is the main.tex \documentclass[Reference={ref.bib}]{MyReport} \begin{document} \section{test} text\cite{Deb2014} \end{document} the ref.bib: @article{Deb2014, title = {An {{Evolutionary Many-Objective Optimization Algorithm Using Reference-Point-Based Nondominated Sorting Approach}}, {{Part I}}: {{Solving Problems With Box Constraints}}}, shorttitle = {An {{Evolutionary Many-Objective Optimization Algorithm Using Reference-Point-Based Nondominated Sorting Approach}}, {{Part I}}}, author = {Deb, Kalyanmoy and Jain, Himanshu}, date = {2014-08}, journaltitle = {IEEE Transactions on Evolutionary Computation}, shortjournal = {IEEE Trans. Evol. Computat.}, volume = {18}, number = {4}, pages = {577--601}, issn = {1089-778X, 1089-778X, 1941-0026}, doi = {10.1109/TEVC.2013.2281535}, url = {http://ieeexplore.ieee.org/document/6600851/}, urldate = {2025-11-08}, langid = {english} } No matter how I try, although the compilation does not report an error, it prompts: LaTeX: Unused global option(s): [Reference]. LaTeX: Empty bibliography. In fact, there is no "References" section, as if the operation to generate the references was not executed. How can I solve this problem? Note: \documentclass{MyReport} \addbibresource{ref.bib} \begin{document} \section{test} text\cite{Deb2014} \printbibliography[heading=bibintoc] \end{document} This main.tex can be compiled successfully, indicating that the basic functionalities of ref.bib and MyReport.cls are correct.

  • Error when using pyluatex in align* environment
    by Ada Gauss on June 10, 2026 at 9:09 am

    The following latex-code throws a ! Missing } inserted error. Please help me to find the reason. Minimal example: \documentclass{article} \usepackage{amsmath,amsfonts} \usepackage[executable=python.exe]{pyluatex} \newcommand\Zn{\mathbb{Z}_n} \begin{document} \begin{pythonq} from sympy import gcd a = 221 b = 39 r = a%b q = int((a-r)/b) mggt = gcd(a,b) \end{pythonq} \[ \begin{align*} \exists_{k\in\Zn} \quad \py{a} &= k\cdot t \\ \exists_{l\in\Zn} \quad \py{b} &= l\cdot t \\ \Rightarrow \quad \py{a}-\py{b} &= kt-lt = t\cdot \underbrace{(k-l)}_{\in\Zn} \end{align*} \] \end{document}

  • Make a special integral symbols in tikz
    by mathrm alpha on June 10, 2026 at 8:34 am

    Although you can draw \int extended parts "\qsymb" in Tikz, it doesn't fit when zoomed in with math-mode. \documentclass{article} \usepackage{tikz} \usepackage{graphicx} \usepackage{amsmath} \usepackage[margin=0.5in]{geometry} \newcommand{\qsymb}{% \mathbin{ \vcenter{\hbox{ \scalebox{0.075}{ \begin{tikzpicture}[line width=2.5pt, line cap=round, line join=round, yscale=0.6] \draw (0.2, 2.4) -- (2.7, 3.9) -- (4.7, 2.9) -- (2.2, 1.4) -- cycle; \draw (2.2, 1.4) -- (4.2, 0.4) -- (1.7, -0.6) -- (-0.3, 0.4) -- cycle; \end{tikzpicture}% }% }}% }% } \newcommand{\qint}{\int\!\!\!\!\!\!\!\!\qsymb} \newcommand{\qiint}{\iint\!\!\!\!\!\!\!\!\!\!\qsymb} \begin{document} $A \qint B \qiint C$\\ $$A \qint B \qiint C$$ \end{document}

  • flipped \sum symbols
    by mathrm alpha on June 10, 2026 at 7:57 am

    I found that using it this way doesn't result in the same subscript and superscript positions as \sum, and it's even crooked, which is really undesirable. % Source - https://tex.stackexchange.com/a/689279 % Posted by egreg % Retrieved 2026-06-10, License - CC BY-SA 4.0 % Code modified by: @mathrm alpha \documentclass{article} \usepackage{amsmath,graphicx} \makeatletter \NewDocumentCommand{\flippedsum}{e{_^}}{% \mathop{\mathpalette\flippedsum@{{#1}{#2}}}% } \NewDocumentCommand{\flippedsum@}{mm}{% \flippedsum@@#1#2% } \NewDocumentCommand{\flippedsum@@}{mmm}{% \begingroup \sbox\z@{$\m@th#1\sum$}% \reflectbox{\usebox\z@}% \IfValueT{#2}{% subscript _{#2}% }% \IfValueT{#3}{% superscript ^{\kern-\ifx#1\displaystyle0.5\else0.4\fi\wd\z@#3}% }% \endgroup } \makeatother \begin{document} \[ \flippedsum_a^b \] \begin{center} $\flippedsum_a^b$\\ $\scriptstyle\flippedsum_a^b$\\ $\scriptscriptstyle\flippedsum_a^b$ \end{center} \end{document} References: Superscript horizontal alignment on flipped integral symbol

  • Why loading autobreak package breaks code even when not using the command?
    by Nasser on June 10, 2026 at 7:05 am

    This old code used to compile OK. \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} Substituting $\sqrt{-x}$ in first equation gives% \begin{align} y-e^{\frac{\sqrt{-x}}{-x-x}} & =0\nonumber\\ y & =e^{\frac{\sqrt{-x}}{-2x}}\nonumber\\ \ln y & =\frac{\sqrt{-x}}{-2x}\nonumber\\ \left( \ln y\right) ^{2} & =\frac{-x}{4x^{2}}\nonumber\\ 4x\left( \ln y\right) ^{2}+1 & =0\nonumber\\ y_{s} & =\left\{ \begin{array} [c]{c}% e^{\frac{-i}{2\sqrt{x}}}\\ e^{\frac{i}{2\sqrt{x}}}% \end{array} \right. \tag{4}% \end{align} \end{document} Compiling gives no error: >lualatex 9.tex This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) restricted system commands enabled. (./9.tex LaTeX2e <2025-11-01> L3 programming layer <2026-03-20> (/usr/local/texlive/2026/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class ... Output written on 9.pdf (1 page, 73469 bytes). Transcript written on 9.log. > But when changing preamble to this \usepackage{amsmath} \usepackage{autobreak} %added this with no code change at all, Now lualatex gives error >lualatex 9.tex This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) restricted system commands enabled. (./9.tex LaTeX2e <2025-11-01> L3 programming layer <2026-03-20> (/usr/local/texlive/2026/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (/usr/local/texlive/2026/texmf-dist/tex/latex/base/size12.clo)) (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2026/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2026/texmf-dist/tex/latex/autobreak/autobreak.sty (/usr/local/texlive/2026/texmf-dist/tex/generic/catchfile/catchfile.sty (/usr/local/texlive/2026/texmf-dist/tex/generic/infwarerr/infwarerr.sty) (/usr/local/texlive/2026/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2026/texmf-dist/tex/generic/etexcmds/etexcmds.sty (/usr/local/texlive/2026/texmf-dist/tex/generic/iftex/iftex.sty)))) (/usr/local/texlive/2026/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./9.aux) ! Missing # inserted in alignment preamble. <to be read again> \cr l.22 \end{align} ? Notice there is no usage of the autobreak command in code. Only loading the package itself causes this error. Is this supposed to happen? Or is this a bug? TL 2026 on Linux ps. please do not complain about the code itself. It is auto-generated by external software.

  • How to change arrow style for a NPN component in CircuiTikZ
    by Forrest on June 10, 2026 at 1:35 am

    I want to change the arrow style of NPN when I use circuiTikz. I read the manual of CircuiTikz. All I found is that: I can only change the arrow position in 4.15.5.2 \ctikzset{transistors/arrow pos=end} It do change the position of arrow. Then, I tried to change the arrow style. I tried the following ways: \draw (7, 0) node[npn, scale=2.0, flow arrow/.style={->, >=Stealth}] (T) {}; \ctikzset{bipoles/npn/arrow/.style={>=Stealth}} None works! Could you kindly give me a solution? Thanks!

  • Vertical line between multicols disappearing inside tcolorbox environment
    by AO3 user without CSS knowledge on June 9, 2026 at 10:01 pm

    I'm trying to use the multicol package (with multicolrule) inside a tcolorbox environment, to have two columns separated by a vertical line. While using it gives me the two columns, the vertical line in between them doesn't show. It works fine when I'm outside of the theorem. I know I could do it using another package like tabular or something similar, but I'd really like to make it work with multicol. Is there a way to force that line to appear? \documentclass[12pt,a4paper]{article} \usepackage{multicol} \usepackage{multicolrule} \usepackage{tcolorbox} \begin{document} \begin{tcolorbox} Inside the tcolorbox environment: \begin{multicols}{2}\SetMCRule{width=1pt, color=blue} No vline in between, \\ the two columns here. \end{multicols} \end{tcolorbox} Outside of the tcolorbox: \begin{multicols}{2}\SetMCRule{width=1pt, color=blue} The vline is here,\\ when I use it outside. \end{multicols} \end{document}

  • PSTricks-metadata: slow compilation in LuaLaTeX
    by Sebastiano on June 9, 2026 at 9:36 pm

    I am trying to understand how this recent package pst-hyperboloid and how its commands are implemented. I compile my document using LuaLaTeX, but I encounter an error message during compilation. In addition, the compilation time is very long. I would like to understand how to reduce compilation time and prevent or properly debug these errors. Extended graphic state modifications dropped since LaTeX support is not loaded. Insert \DocumentMetadata{} as first line of your document to solve this issue. \documentclass{article} \usepackage{pst-hyperboloid,pst-solides3d} \begin{document} \begin{pspicture}(-6,-6)(6,6) \psset{viewpoint=60 25 20 rtp2xyz,lightsrc=viewpoint,Decran=60} \psHyperboloid[ R=2, h=4, ngrid=40 20, hollow, incolor=black!10, fillcolor=black!25, linecolor=black, linewidth=0.2\pslinewidth ] \gridIIID[Zmin=-5,Zmax=5](-4,4)(-4,4) \end{pspicture} \end{document}

  • `amsthm` theorem referencing with `cleveref` not working with LaTeX release 2026-06-01 (probably related to alias counter functionality)
    by pks40 on June 9, 2026 at 8:45 pm

    Today, I updated my TeX Live installation. This broke cleveref for referencing of theorem-like environments defined with amsthm. Concretely, consider the following MWE: \documentclass{article} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{thm}{Theorem} \begin{document} \begin{thm} \label{thm:test} Test. \end{thm} In \cref{thm:test}, we tested stuff. \end{document} I now get the warning cref reference format for label type `thm' undefined when compiling this, and instead of the desired ‘theorem 1’, the output contains ‘?? 1’. This is apparently caused by a change in the firstaid package, since downgrading the TeX Live firstaid package from revision 79234 to 76740 makes the MWE work again. I suppose this is caused by the alias counter functionality added in LaTeX release 2026-06-01. If I understand the corresponding commit in the LaTeX source correctly, concretely the changes in required/firstaid/latex2e-first-aid-for-external-files.dtx, the problem is as follows. In order to make use of the new alias counter functionality, a new version of the internal amsthm command \@ynthm is defined. However, \@ynthm is also reset to this new version after loading of cleveref, without including the necessary adaptations to make cleveref work. I don’t know enough about the internal workings of cleveref, amsthm or the LaTeX kernel to understand what’s really going on there. So I think my questions are as follows: How can I make \cref{} work correctly again for amsthm theorems? Is the only way (for now) downgrading to firstaid revision 76740? If I downgrade firstaid: does the fact that amsthm doesn’t use the alias counter stuff have any negative consequences? Should I report this as a bug in the LaTeX kernel?

  • Compression for subequations parent numbers with cleveref
    by Jonk on June 9, 2026 at 5:15 pm

    With TeX Live 2024 cleveref can compress cross-references including subequations parent numbers, like so: \documentclass{article} \usepackage{amsmath} \usepackage{cleveref} \begin{document} \begin{subequations}\label{eqn:one} \begin{align} a\label{eqn:onea}\\ b\label{eqn:oneb} \end{align} \end{subequations} \begin{align} c\label{eqn:two}\\ d\label{eqn:three} \end{align} \cref{eqn:one,eqn:two,eqn:three} \end{document} The \cref command gives as desired eqs. (1) to (3) However, with TeX Live 2025 and 2026, the compression does not occur and I get eqs. (1), (2) and (3) Is there a way to obtain the compressed output with TeX Live 2025 and 2026, without explicitly requiring a range (e.g., with \crefrange)? (This question is similar to this one, but the answer seems to indicate that I shouldn't get the compressed output with TeX Live 2024, which I do.)

  • File involving sharenumber thmtools' option doesn't compile anymore
    by Denis Bitouzé on June 9, 2026 at 3:05 pm

    Whereas it used to compile smoothly until some weeks ago (and with e.g. pdfTeX 3.141592653-2.6-1.40.27), the following MCE: \documentclass{article} \usepackage{thmtools} \newcounter{mycounter} \declaretheorem[ sharenumber=mycounter ]{theorem}[] \begin{document} \end{document} doesn't compile anymore with an up to date TeX Live 2026. Note that it still compiles if sharenumber=mycounter is commented. The compile fails with pdfTeX, Version 3.141592653-2.6-1.40.29 and: article.cls 2025/01/22 v1.4n Standard LaTeX document class size10.clo 2025/01/22 v1.4n Standard LaTeX file (size option) thmtools.sty 2023/05/04 v0.76 thm-patch.sty 2023/05/04 v0.76 parseargs.sty 2023/05/04 v0.76 thm-kv.sty 2023/05/04 v0.76 keyval.sty 2026-05-17 v1.15 key=value parser (DPC) kvsetkeys.sty 2022-10-05 v1.19 Key value parser (HO) thm-autoref.sty 2023/05/04 v0.76 aliasctr.sty 2023/05/04 v0.76 thm-listof.sty 2023/05/04 v0.76 thm-restate.sty 2023/05/04 v0.76 l3backend-luatex.def 2026-02-18 L3 backend support: PDF output (LuaTeX)

  • Good package to write series of exercises with solutions
    by Rassine Orange on June 9, 2026 at 1:54 pm

    I'm teaching maths and I'd like to use a good package to write questions and answers, with the option to printout the answer at the end of the document. I've seen there are various such packages (exesheets, xsim, ...) and I'd like to know if one is considered "better" than the others. More specifically, I'd like a package with: A way to have questions and subquestions A command to store solutions and print them at the end of the document. If possible the name of the command should be different as "solution" as I already defined a command with this name, I would like to avoid changing all my codes. Edit : I would like to be able to define solutions that automatically get updated. The exercise package is a good start, but what I want is a way to make Answer dynamical. Here is a MWE, and I would like to define \addtotemporarysolution and \dumpsolutions (or anything else) to get what I wrote in the Answers environments. So far I have not found any way to "temporary" store the solutions (all my \sum in the first question) and dump them in the next Answer environment. To be more precise, in my MWE, I would be able to: add more additions, change the order of the additions, remove an addition, change the values of some \xand some \y, etc. and the \Answer environment should automaticaly update and display the solution of all the questions after modification. Note: I know my code is far from perfect, and maybe I should not use \defand \edef but that's not what I want/need to discuss now. \documentclass{article} \usepackage{xfp} \usepackage{enumerate} \usepackage{enumitem} \usepackage[answerdelayed]{exercise} \newcommand\addtotemporarysolution{XXX}%Todefine \newcommand\dumpsolutions{XXX}%Todefine \begin{document} \begin{Exercise} In this problem we study additions. \begin{enumerate}[label = \alph*)] \def\x{1}\def\y{1} \edef\sum{\fpeval{\x+\y}} \item Compute $\x+\y$ %\addtotemporarysolution{\sum} %To uncomment \def\x{10}\def\y{20} \edef\sum{\fpeval{\x+\y}} \item Compute $\x+\y$ %\addtotemporarysolution{\sum}%To uncomment \end{enumerate} \end{Exercise} \begin{Answer} %\dumpsolutions would put all the solutions defined in the previous Exercise I want here to write something that get dynamically updated. If I add another addition, or if I change the order, the answers should automatically change, without me to write anything. In this case, this would appear: \begin{enumerate} \item $2$ \item $30$ \end{enumerate} \end{Answer} \begin{Exercise} Now we study multiplications. \begin{enumerate}[label = \alph*)] \def\x{10}\def\y{20} \edef\product{\fpeval{\x*\y}} \item Compute $\x\times \y$ %\addtotemporarysolution{\product} %To uncomment \def\x{4}\def\y{8} \edef\sum{\fpeval{\x* \y}} \item Compute $\x\times \y$ %\addtotemporarysolution{\sum}%To uncomment \end{enumerate} \end{Exercise} \begin{Answer} %\dumpsolutions would put all the solutions defined in the previous Exercise I want here to write something that get dynamically updated. If I add another addition, or if I change the order, the answers should automatically change, without me to write anything. In this case, this would appear: \begin{enumerate} \item $200$ \item $32$ \end{enumerate} \end{Answer} \vspace{3cm} \textbf{Here are the solutions} \vspace{0.5cm} \shipoutAnswer \end{document} Community Edit: Here's a screeshot from the compiled code, marking the "1+1" example mentioned in this comment:

  • How to type rotated Khitan text format in TeX?
    by mathrm alpha on June 9, 2026 at 1:23 pm

    Example of rotated Khitan text on a web page: Image Source: https://www.babelstone.co.uk/Fonts/KhitanSmall.html Font: https://fonts.google.com/noto/specimen/Noto+Serif+Khitan+Small+Script But it seems LaTeX can't output rotated Khitan text. There is no command rotated Khitan text format in LaTeX. \documentclass{article} \usepackage{xeCJK} \setCJKmainfont{NotoSerifKhitanSmallScript-Regular.ttf} \xeCJKDeclareCharClass{CJK}{"18B00 -> "18CD5} \begin{document} 𘬐𘬑𘬒 Doesn't type rotated Khitan text \end{document} References: How can xeCJK expand its support to include "new standard Unihan characters"? Unicode PDF: https://www.unicode.org/charts/PDF/U18B00.pdf

  • autobreak. How make all lines flush to left when first line is long?
    by Nasser on June 9, 2026 at 12:17 pm

    Consider this MWE \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{autobreak} \begin{document} \begin{align*} \begin{autobreak} A= (x + a + b +c+d+e+f+g) +y +z +(x + a + b +c+d+e+f+g) +e +d \end{autobreak} \end{align*} \end{document} Compile with lualatex gives I do not know how to make the output something like this (*), i.e. shift second and the rest of the lines more to the left. Using \MoveEqLeft from mathtools made it worst \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{autobreak} \usepackage{mathtools} %\MoveEqLeft \begin{document} \begin{align*} \MoveEqLeft \begin{autobreak} A= (x + a + b +c+d+e+f+g) +y +z +(x + a + b +c+d+e+f+g) +e +d \end{autobreak} \end{align*} \end{document} Without modifying the lines themselves inside the autobreak manually by rewriting them, is it possible to obtain the desired output shown above in (*) by adding something in preamble or some other option for autobreak? Lualatex, TL 2026

  • How to make the parenthesis around equation number be colorful and hyperlinked too when using \eqref?
    by M. Logic on June 9, 2026 at 11:07 am

    A minimal working sample is as follows. \documentclass{article} \usepackage{amsmath} \usepackage[colorlinks=true]{hyperref} %\makeatletter %\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} %\DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} %\makeatother \begin{document} \begin{equation}\label{eq} 1+2=3 \end{equation} TEXT \eqref{eq} TEXT \end{document} As you see, when using \eqref on the equation number, it produce only colorful equation number but black parenthesis, and also it produce a hyperlink only on equation number but including no parenthesis. Then how to make the parenthesis around equation number be colorful and hyperlinked too when using \eqref? I hope, the color could change when I reset linkcolor in hyperref. is it possible to redefine some setting to make the equation number be around with parenthesis when using \ref? In this case I think the parenthesis must be colorful and hyperlinked too.

  • unicode-math extended length in "🣖, 🣗, 🣘" style
    by mathrm alpha on June 9, 2026 at 10:32 am

    While there are posts that allow changing the unicode arrows length, there's no unicode-math length extend arrows 🣖, 🣗, 🣘 style provided. How to use the extended arrows in unicode-math However, these settings commands cannot be applied to some special arrow styles (such as the Unicode 17.0 Supplemental Arrows-C). However, when I set it up, it only applied subscript arrows under the letters. \documentclass{article} \usepackage{unicode-math,accents} \setmathfont{NewCMMath-Book.otf} \newcommand{\overxrightarrow}[1]{\underaccent{\symbol{"1F8D6}}{#1}} \newcommand{\overSlashrightarrow}[1]{\underaccent{\symbol{"1F8D7}}{#1}} \newcommand{\overlobeleftrightarrow}[1]{\underaccent{\symbol{"1F8D8}}{#1}} \begin{document} $\overxrightarrow{ABCDEF}$, $\overSlashrightarrow{ABCDEF}$, $\overlobeleftrightarrow{ABCDEF}$ \end{document} References: How to make new combining below letters in LaTeX

  • Force math symbols to be italic, but doesn't working in \bm
    by mathrm alpha on June 9, 2026 at 8:59 am

    \documentclass{article} \usepackage{xparse} \DeclareMathAlphabet{\mathu}{OT1}{cmr}{m}{ui} \newsavebox{\slantbox} \newcommand{\slant}[2]{\mbox{% \sbox{\slantbox}{#2}% \hskip\wd\slantbox \pdfsave \pdfsetmatrix{1 0 #1 1}% \llap{\usebox{\slantbox}}% \pdfrestore }} \newcommand{\im}[1]{\slant{0.23086}{\texttt{$\mathu{#1}$}}} \ExplSyntaxOn \cs_set_eq:NN \old_im \im \RenewDocumentCommand{\im}{m}{ \tl_set:Nn \l_tmpa_tl {#1} \tl_map_inline:Nn \l_tmpa_tl { \str_case:nnF {##1} { {\alpha} {\alpha} {\beta} {\beta} {\gamma} {\gamma} {\delta} {\delta} {\varepsilon} {\varepsilon} {\zeta} {\zeta} {\eta} {\eta} {\theta} {\theta} {\iota} {\iota} {\kappa} {\kappa} {\lambda} {\lambda} {\mu} {\mu} {\nu} {\nu} {\xi} {\xi} {\pi} {\pi} {\rho} {\rho} {\varsigma} {\varsigma} {\sigma} {\sigma} {\tau} {\tau} {\upsilon} {\upsilon} {\phi} {\phi} {\chi} {\chi} {\psi} {\psi} {\omega} {\omega} {\partial} {\partial} {\vartheta} {\vartheta} {\epsilon} {\epsilon} {\varrho} {\varrho} {\varphi} {\varphi} {\varpi} {\varpi} } {\old_im{##1}} } } \ExplSyntaxOff \begin{document} $\im{ABC\nabla\alpha\partial}$ \end{document} When I added \bm inside the only math box, a LaTeX No PDF error popped up. This did not change the Bold italic mathematical symbols. \begin{document} $\bm{\im{ABC\nabla\alpha\partial}}$ \end{document} Missing control sequence inserted. Undefined control sequence. Illegal parameter number in definition of \inaccessible. References: make math symbol italic

  • Is it useful to update TexLive
    by Rassine Orange on June 9, 2026 at 8:12 am

    I use LaTeX almost every day for my work and I'm wondering if I should update TeXLive. I currently have the 2024 version. I'm afraid that if I update either my code won't run or I will go into some issues that I cannot solve. What would you recommand ? And if you advise me to update it, how shall I proceed? I have read so many different things online that I get a bit lost. Best,

  • Incompatibility between memoize and luacolor
    by PHL on June 9, 2026 at 5:13 am

    The following MWE compile correctly, but if luacolor is uncommented the triangle is black instead of red. % !TEX TS-program = lualatex \documentclass{article} \usepackage{memoize} %\usepackage{luacolor} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill[red] (0,0)--(1,1)--(2,0)--cycle; \end{tikzpicture} \end{document} Is there a workaround? Or is this a bug in memoize and/or luacolor? (luacoloris needed for kerning reasons, that do not show in the above MWE.)

  • How can I get less than one frame per second in \animategraphics?
    by Jasper on June 9, 2026 at 3:50 am

    How can I get less than one frame per second in \animategraphics? \documentclass{article} \usepackage{animate} \usepackage{graphicx} \begin{document} \animategraphics{ % a framerate less than one, say 1/3. }{cow}{}{} \end{document}

  • pixel square draw spacing bad in LaTeX
    by mathrm alpha on June 8, 2026 at 11:32 pm

    The horizontal spacing is a bit bad when I'm drawing LaTeX pixel maps. \documentclass{article} \usepackage{setspace,parskip,newunicodechar,xcolor,fontspec} % parskip It's failing... \newunicodechar{█}{\fontspec{Arial}{█}} \newunicodechar{ }{\fontspec{Arial}{\color{white}{█}}} \begin{document} \vspace{-1mm} \color{blue}{█ ████ }\color{gray}{█ ████ }\\ \vspace{-1mm} \color{pink}{██ ████}\color{cyan}{█ ████ }\\ \vspace{-1mm} \color{yellow}{██████   ██}\color{blue}{██} \end{document}

  • ltx-talk overlay and tcolorbox?
    by Richard Wong on June 8, 2026 at 3:25 pm

    I'm trying to modify the theorem environment in ltx-talk so that it visually resembles the theorem environment in beamer. I was able to do so using talkthemetcolorbox. However, my attempt breaks the uncover overlay specification in a way that I don't quite understand. (MWE example below) \DocumentMetadata{tagging = on} \documentclass[aspect-ratio=4:3]{ltx-talk} \usepackage{talkthemetcolorbox} %Create a custom tcolorbox style for theorems \newtcolorbox{mythmbox}[1]{ title=#1, boxrule=0pt, enhanced, } \newtheorem{theorem}{Theorem} \RenewDocumentEnvironment{theorem}{D<>{all} +m}{ \begin{uncoverenv}<#1> \begin{mythmbox}{Theorem (#2)} }{ \end{mythmbox} \end{uncoverenv} } \begin{document} \begin{frame} Text \pause \begin{theorem}<3->{Pythagoras} The square of the hypotenuse is equal to the sum of the squares of the other two sides: \[ a^2 + b^2 = c^2 \] \end{theorem} Text \end{frame} \end{document} The code above changes the theorem environment visually as I desire, but it doesn't have the intended uncover behavior. (e.g. I see the theorem on all three slides). However, the code does have the right visual theorem environment and respects the overlay if I replace uncoverenv with onlyenv. (e.g. I see the theorem only on slide 3, but the spacing on slide 2 is not what I desire). It also has the right uncover behavior, but the wrong visual theorem environment if I replace D<>{all} +m with d<>{all} +m. (e.g. I see the theorem only on slide 3 , and the spacing on slide 2 is right, but there is no tcolorbox).

  • ⅌ apply in tikz text symbols?
    by mathrm alpha on June 8, 2026 at 11:58 am

    The original drawing instructions in ⅌: \documentclass{article} \usepackage{tikz} \usepackage[margin=0.5in]{geometry} \begin{document} \centering \begin{tikzpicture}[scale=2] % The stylized symbol is a calligraphic character, likely a script 'P' or 'V' with an ellipse. % We recreate it using thick paths and curves. % 1. The horizontal ellipse \draw[line width=6pt] (0.4, 0) ellipse (2.2 and 0.7); % 2. The main "U" shape (the stems) % Left stem starts from the flourish, goes down, curves at the bottom, and goes up to form the right stem. \draw[line width=14pt, line cap=round] (-0.6, 1.5) .. controls (-0.6, -3.2) and (0.6, -3.2) .. (0.6, 1.5); % 3. The flourish on the top left % A decorative hook and a small "bud" on top of the left stem. \draw[line width=14pt, line cap=round] (-0.6, 1.5) .. controls (-1.8, 2.8) and (-3.0, 1.5) .. (-2.2, 1.2); \fill (-0.5, 1.9) circle (0.25); % 4. The large loop on the right (completing the 'P' shape) % It starts from the top of the right stem, loops over to the right, and curves back down. \draw[line width=14pt, line cap=round] (0.6, 1.5) .. controls (0.6, 4.2) and (3.5, 3.2) .. (3.5, 0.5) .. controls (3.5, -0.8) and (2.5, -1.2) .. (1.8, -1.0); \end{tikzpicture} \end{document} However, after reading his/her command usage, This convert to can typed ⅌ text symbols method doesn't seem to work for multiple overlapping shapes in tikz (or maybe I just don't know how to use it). Is there better method to declare tikz picture with proper baseline and fontsize?

  • Example of how to set up a custom tagged structure
    by David Purton on June 8, 2026 at 3:29 am

    I'm trying to learn how to set up tagging for a document with a custom structure. For example, consider a document containing a quotation from the Bible. This has built in structure with things like chapters, verses, (potentially headings), different layouts, and maybe a reference at the end. At a minimum, I need to use the new block code to set up the blocks. But I'm guessing I also need to tag other elements like chapters and verses. But there's still minimal examples out there of how to do all this. If I want to to support tagging in my scripture package, I need to make good design decisions up front. And I don't really know what I'm doing. Here's a MWE example showing a basic structure for a quote from the Bible along with my best guesses relating to tagging. I'm interested in knowing if I'm on the right track or not, things that should be done differently or anything else to be aware of. MWE \DocumentMetadata{ lang=en, pdfstandard=ua-2, tagging=on } \documentclass{article} \pagestyle{empty} \DeclareInstance{blockenv}{scripture/main}{std} { , name = scripture/main , transparent-level = true , max-inner-levels = 0 , block-instance = scripture/main } \DeclareInstance{block}{scripture/main-1}{std} { , begin-vspace = 0pt , begin-extra-vspace = 0pt , left-margin = 0pt , right-margin = 0pt , para-indent = \parindent } \DeclareInstance{blockenv}{scripture/poetry}{std} { , name = scripture/poetry , transparent-level = true , max-inner-levels = 0 , block-instance = scripture/poetry , tagging-suppress-paras = true , final-code = \obeylines\ignorespaces } \DeclareInstance{block}{scripture/poetry-1}{std} { , begin-vspace = \medskipamount , begin-extra-vspace = 0pt , left-margin = 2em , right-margin = 0pt } \NewDocumentEnvironment{scripture}{o} {\SimpleBlockEnv{scripture/main}{}} { \IfNoValueF{#1}{% \par \reference{#1}}% \BlockEnvEnd } \NewDocumentEnvironment{poetry}{!O{}} {\SimpleBlockEnv{scripture/poetry}{#1}} {\BlockEnvEnd} \NewStructureName{scripture/reference} \AssignStructureRole{scripture/reference}{Span} \NewStructureName{scripture/chapter} \AssignStructureRole{scripture/chapter}{Span} \NewStructureName{scripture/verse} \AssignStructureRole{scripture/verse}{Span} \NewDocumentCommand\reference{m} {% \begingroup \leavevmode \UseTaggingSocket{inline/begin}{tag=\UseStructureName{scripture/reference}}% \hfill\textbf{(#1)}% \UseTaggingSocket{inline/end}% \endgroup } \NewDocumentCommand\ch{m} {% \begingroup \leavevmode \UseTaggingSocket{inline/begin}{tag=\UseStructureName{scripture/chapter}}% \textbf{#1}\kern0.5em% \UseTaggingSocket{inline/end}% \endgroup } \NewDocumentCommand\vs{m} {% \begingroup \leavevmode \UseTaggingSocket{inline/begin}{tag=\UseStructureName{scripture/verse}}% \textsuperscript{#1}% \UseTaggingSocket{inline/end}% \endgroup } \begin{document} \begin{scripture}[Book 1:1--5] \ch{1}A chapter start. \vs{2}A verse. A paragraph. \begin{poetry} \vs{3}A line Another line \vs{4}A line Another line \end{poetry} \vs{5}Another verse. \end{scripture} \end{document} Here's the output from show-pdf-tags: Document (http://iso.org/pdf2/ssn): └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): └─Div (http://iso.org/pdf2/ssn): ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ ├─Span (http://iso.org/pdf2/ssn): │ │ └─Marked content on page 1: 1 │ ├─Marked content on page 1: A chapter start. │ ├─Span (http://iso.org/pdf2/ssn): │ │ └─Span (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextPosition: "Sup" │ │ └─Marked content on page 1: 2 │ └─Marked content on page 1: A verse. ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ └─Marked content on page 1: A paragraph. ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─Div (http://iso.org/pdf2/ssn): │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Justify" │ │ ├─Span (http://iso.org/pdf2/ssn): │ │ │ └─Span (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextPosition: "Sup" │ │ │ └─Marked content on page 1: 3 │ │ └─Marked content on page 1: A line │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Justify" │ │ └─Marked content on page 1: Another line │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Justify" │ │ ├─Span (http://iso.org/pdf2/ssn): │ │ │ └─Span (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextPosition: "Sup" │ │ │ └─Marked content on page 1: 4 │ │ └─Marked content on page 1: A line │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ └─Marked content on page 1: Another line ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ ├─Span (http://iso.org/pdf2/ssn): │ │ └─Span (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextPosition: "Sup" │ │ └─Marked content on page 1: 5 │ └─Marked content on page 1: Another verse. └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): ┝━━Attributes: │ └/Layout: │ └TextAlign: "Justify" └─Span (http://iso.org/pdf2/ssn): └─Marked content on page 1: (Book 1:1–5) Out the PDF output: Just for fun, here's another go. For my use case I think it makes sense to have headings and paragraphs as the main structural elements rather than chapters and verses since modern Bibles can place chapter breaks within paragraphs and verses can split across paragraphs. The below example does validate with VeraPDF and seems to give sane output at ngpdf.com But from Ulrike's answer below it seems like there's not a correct answer to this question at the moment. %! TeX = lualatex \DocumentMetadata { , lang = en , pdfstandard = ua-2 , tagging = on , tagging-setup = { math/mathml/luamml/load = false } } \documentclass{article} \ExplSyntaxOn % Tagging set up \tagpdfsetup { , role / new-tag = chapter / Span , role / new-tag = heading / H3 , role / new-tag = poetry / Div , role / new-tag = reference / Part , role / new-tag = scripture / Div , role / new-tag = verse / Span , role / user-NS = scripture } \NewStructureName { sec / 6 } \AssignStructureRole { sec / 6 } { Sect } \NewStructureName { sec / 6 / title } \AssignStructureRole { sec / 6 / title } { heading } % Block environments \DeclareInstance { blockenv } { scripture / main } { std } { , block-instance = scripture / main , max-inner-levels = 0 , name = scripture / main , tag-name = scripture , transparent-level = true } \DeclareInstance { block } { scripture / main-1 } { std } { , begin-extra-vspace = 0pt , begin-vspace = 0pt , left-margin = 0pt , para-indent = \parindent , right-margin = 0pt } \DeclareInstance { blockenv } { scripture / poetry } { std } { , block-instance = scripture / poetry , final-code = \raggedright \obeylines \ignorespaces , max-inner-levels = 0 , name = scripture / poetry , tag-name = poetry , tagging-suppress-paras = true , transparent-level = true } \DeclareInstance { block } { scripture / poetry-1 } { std } { , begin-extra-vspace = 0pt , begin-vspace = \medskipamount , left-margin = 1em , right-margin = 0pt } \NewDocumentEnvironment { scripture } { m } { \SimpleBlockEnv { scripture / main } { } } { \par \UseTaggingSocket { sec / end } { 6 } \reference #1 \BlockEnvEnd } \NewDocumentEnvironment { poetry } { } { \SimpleBlockEnv { scripture / poetry } { } } { \BlockEnvEnd } % Headings \DeclareInstance { heading } { scripture / heading } { display } { , name = scripture / heading , level = 6 , before-vspace = \medskipamount , after-vspace = \smallskipamount , heading-decls = \normalfont \itshape , headformat-instance = scripture / heading } \DeclareInstanceCopy { headformat } { scripture / heading } { std } \DeclareDocumentCommand \heading { s = { shorttitle } o m } { \ParseLaTeXeHeading { scripture / heading } { \BooleanTrue } {#2} {#3} } % Functions \NewDocumentCommand \reference { m m m } { \group_begin: \AssignStructureRole { para / semantic } { reference } \raggedleft \mode_leave_vertical: \UseTaggingSocket { inline / begin } { , actualtext = #1 ~ chapter ~ #2 ~ verse ~ #3 , tag = Span } \textbf { ( #1 ~ #2 : #3 ) } \UseTaggingSocket { inline / end } \par \group_end: } \NewDocumentCommand \ch { m } { \par \group_begin: \noindent \UseTaggingSocket { inline / begin } { , actualtext = { Chapter   #1 ~ verse   1 :   } , tag = chapter } \textbf {#1} \kern 0.5em \UseTaggingSocket { inline / end } \group_end: } \NewDocumentCommand \vs { m } { \group_begin: \mode_leave_vertical: \UseTaggingSocket { inline / begin } { , actualtext = { Verse   #1 :   } , tag = verse } \textsuperscript {#1} \UseTaggingSocket { inline / end } \group_end: } \ExplSyntaxOff \begin{document} \title{Scripture test} \author{David Purton} \maketitle \begin{scripture}{{Book}{1}{1–5}} \heading{Non-canonical heading} \ch{1}A chapter start. \vs{2}A verse. A paragraph. \begin{poetry} \vs{3}A line Another line \vs{4}A line Another line \end{poetry} \vs{5}Another verse. \heading{Another non-canonical heading} \ch{2}A chapter start. \vs{2}Another verse. \end{scripture} \end{document} Tagging structure: Document (http://iso.org/pdf2/ssn): ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ ├─Title (http://iso.org/pdf2/ssn): │ │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Center" │ │ └─Marked content on page 1: Scripture test │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Center" │ │ └─Marked content on page 1: David Purton │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Center" │ └─Marked content on page 1: June 10, 2026 └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): └─scripture (https://www.latex-project.org/ns/local/scripture) / Div (http://iso.org/pdf2/ssn): ├─Sect (http://iso.org/pdf2/ssn): │ ├─heading (https://www.latex-project.org/ns/local/scripture) / H3 (http://iso.org/pdf2/ssn): │ │ ┝━━Title: Non-canonical heading │ │ └─Marked content on page 1: Non-canonical heading │ ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Justify" │ │ ├─chapter (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ │ ┝━━Actual text: Chapter 1 verse 1:  │ │ │ └─Marked content on page 1: 1 │ │ ├─Marked content on page 1: A chapter start. │ │ ├─verse (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ │ ┝━━Actual text: Verse 2:  │ │ │ └─Span (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextPosition: "Sup" │ │ │ └─Marked content on page 1: 2 │ │ └─Marked content on page 1: A verse. │ ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Justify" │ │ └─Marked content on page 1: A paragraph. │ ├─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ │ └─poetry (https://www.latex-project.org/ns/local/scripture) / Div (http://iso.org/pdf2/ssn): │ │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextAlign: "Start" │ │ │ ├─verse (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ │ │ ┝━━Actual text: Verse 3:  │ │ │ │ └─Span (http://iso.org/pdf2/ssn): │ │ │ │ ┝━━Attributes: │ │ │ │ │ └/Layout: │ │ │ │ │ └TextPosition: "Sup" │ │ │ │ └─Marked content on page 1: 3 │ │ │ └─Marked content on page 1: A line │ │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextAlign: "Start" │ │ │ └─Marked content on page 1: Another line │ │ ├─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ │ ┝━━Attributes: │ │ │ │ └/Layout: │ │ │ │ └TextAlign: "Start" │ │ │ ├─verse (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ │ │ ┝━━Actual text: Verse 4:  │ │ │ │ └─Span (http://iso.org/pdf2/ssn): │ │ │ │ ┝━━Attributes: │ │ │ │ │ └/Layout: │ │ │ │ │ └TextPosition: "Sup" │ │ │ │ └─Marked content on page 1: 4 │ │ │ └─Marked content on page 1: A line │ │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextAlign: "Start" │ │ └─Marked content on page 1: Another line │ └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ ├─verse (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ ┝━━Actual text: Verse 5:  │ │ └─Span (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextPosition: "Sup" │ │ └─Marked content on page 1: 5 │ └─Marked content on page 1: Another verse. ├─Sect (http://iso.org/pdf2/ssn): │ ├─heading (https://www.latex-project.org/ns/local/scripture) / H3 (http://iso.org/pdf2/ssn): │ │ ┝━━Title: Another non-canonical heading │ │ └─Marked content on page 1: Another non-canonical heading │ └─text-unit (https://www.latex-project.org/ns/dflt) / Part (http://iso.org/pdf2/ssn): │ └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): │ ┝━━Attributes: │ │ └/Layout: │ │ └TextAlign: "Justify" │ ├─chapter (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ ┝━━Actual text: Chapter 2 verse 1:  │ │ └─Marked content on page 1: 2 │ ├─Marked content on page 1: A chapter start. │ ├─verse (https://www.latex-project.org/ns/local/scripture) / Span (http://iso.org/pdf2/ssn): │ │ ┝━━Actual text: Verse 2:  │ │ └─Span (http://iso.org/pdf2/ssn): │ │ ┝━━Attributes: │ │ │ └/Layout: │ │ │ └TextPosition: "Sup" │ │ └─Marked content on page 1: 2 │ └─Marked content on page 1: Another verse. └─reference (https://www.latex-project.org/ns/local/scripture) / Part (http://iso.org/pdf2/ssn): └─text (https://www.latex-project.org/ns/dflt) / P (http://iso.org/pdf2/ssn): ┝━━Attributes: │ └/Layout: │ └TextAlign: "End" └─Span (http://iso.org/pdf2/ssn): ┝━━Actual text: Book chapter 1 verse 1–5 └─Marked content on page 1: (Book 1:1–5)