Hot
- Keep track of the number of chapters in each partby umarcor on July 26, 2026 at 2:48 pm
In the following Minimal Working Example (MWE), I'd like to keep track of the totvalue of chapcnt within each part (since chapcnt is set to 0 at the beginning of each part). Currently, \totvalue{chapcnt} returns the number of chapters in the last part (the maximum after it is last reset in the document). \documentclass[twoside]{report} \let\latexthesection\thesection \renewcommand*{\thesection}{\arabic{section}} \usepackage{titlesec} \titleclass{\part}{top} \titleformat{\part}{\Huge\bfseries\color{blue}}{\thepart}{10pt}{} \titleclass{\chapter}{top} \titleformat{\chapter}{\Huge\bfseries\color{green}}{\thechapter}{10pt}{} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{totcount, eso-pic, xifthen} \regtotcounter{partcnt} \newcounter{partcnt} \regtotcounter{chapcnt} \newcounter{chapcnt} \AddToShipoutPictureBG{% \begin{tikzpicture}[overlay] \ifthenelse{\isodd{\value{page}}}% {\def\corner{east}\def\sign{-}}% {\def\corner{west}\def\sign{+}} \pgfmathsetlengthmacro{\parttabheight}{\paperheight/\totvalue{partcnt}} \pgfmathsetlengthmacro{\parttaboffset}{(\thepartcnt-1)*\parttabheight} \fill[blue] ($(current page.north \corner)+(0,-\parttaboffset)$) rectangle ++(\sign.40,-\parttabheight); % FIXME Chapters should be counted within the part, thus keeping one chapter totvalue per part to adjust the chaptabheight in each part. \ifthenelse{\thechapcnt>0} { \pgfmathsetlengthmacro{\chaptabheight}{\parttabheight/\totvalue{chapcnt}} \pgfmathsetlengthmacro{\chaptaboffset}{(\thechapcnt-1)*\chaptabheight} \fill[green] ($(current page.north \corner)+(\sign.20,-\parttaboffset-\chaptaboffset)$)% rectangle ++(\sign.40,-\chaptabheight); }{} \end{tikzpicture} } \newcommand*{\unpart}[1]{ \part*{#1} \stepcounter{partcnt} \setcounter{chapter}{0} \setcounter{chapcnt}{0} \thepartcnt~\thechapcnt } \newcommand*{\unchapter}[1]{ \chapter*{#1} \stepcounter{chapcnt} \thepartcnt~\thechapcnt } \begin{document} \unpart{FirstPart} \unchapter{P1:FirstUNChapter} \section{A Numbered Section} \section{Another Numbered Section} \unchapter{P1:SecondUNChapter} \chapter{P1:ThirdNChapter} \stepcounter{chapcnt} \thepartcnt~\thechapcnt \unchapter{P1:LastUNChapter} \unpart{SecondPart} \unchapter{P2:FirstUNChapter} \unchapter{P2:SecondUNChapter} \unchapter{P2:ThirdUNChapter} \end{document} In the fourth page below the green rectangle is drawn outside of the blue rectangle because it's using 3 as the total number of chapters. The last part hast 3 chapters but the first one has 4. The chaptabheight of the chapters in the first part should be computed using 4, and the chaptabheight of the chapters in the second part should be computed using 3.
- Marginnote does not work [duplicate]by Rassine Orange on July 26, 2026 at 12:47 pm
When I try to put a tikzpicture inside a marginnote, I get this error: Equations.tex: error: 132: Argument of \pgfplots@addplotimpl@expression has an extra }. I guess there may be a conflict with another package/options as when I try a MWE with just the marginote, it works, see below. I cannot paste here my whole preambule as it would be too long. What could a possible source of this error? (For context I'm trying to get something similar as can be seen in this discussion. Sadly the code is nowhere to be found in the discussion...) \documentclass[a4paper,11pt]{article} \usepackage[top=2cm,bottom=2cm,right=4cm,left=2cm,marginparsep=0.5cm]{geometry} \usepackage{marginnote} %%%Tikz \usepackage{tikz} \usepackage{pgfplots} \begin{document} A marginote, all good \marginnote{ \begin{tikzpicture} %[x=1cm,y=1cm,auto,rotate=90,transform shape] \begin{axis}[ width=4.5cm, height=3cm, % hauteur xmin=-2, xmax=10, ymin=0, ymax=12, xtick= \empty, ytick= \empty, extra x ticks = {0,2}, extra x tick style={tick style={draw=none}}, extra y ticks = {2, 8,10}, extra tick style={tick style={draw=none}}, axis line style={thick, shorten >=-20pt, shorten <=0pt}, %extra x tick labels={0,0.5,...,10}, %grid style={very thin, dotted, color=gray}, grid=none, % grille verticale et horizontale axis x line=center, axis y line=center, ylabel=$x(t)$, ylabel style={anchor=south,yshift = 0.75cm}, xlabel=$t$, xlabel style={anchor=west,xshift = 0.75cm}, axis line style={>=stealth,->}, ] \addplot+[domain=0:10,color=cyan, thick, smooth,samples=400,mark=none] (\x,{4/(1+5^(-2*\x))}); \addplot+[only marks,mark = *, cyan, mark options={fill=white} ] coordinates { (2,5) (0,4)}; \draw [dashed, cyan] (axis cs:{2,0}) -- (axis cs:{2,5}) -- (axis cs:{0,5}); \draw [dashed, orange] (axis cs:{0,10}) -- (axis cs:{10,10}); \end{axis} \end{tikzpicture}} But does not work \end{document} Edit: The solution was here, the key was to use \shorthandoff. I'm not sure why and what this command does though, so the solution may not be robust.
- Use inner and outer margins implicitly in tikz when defining a custom section titleformat for a twoside reportby umarcor on July 26, 2026 at 12:29 pm
In the following Minimal Working Example (MWE), the section and subsection title formats are modified using titlesec's titleformat along with tikz. In order to handle odd and even pages, command sectitleformat receives arguments #6 and #7, which are {\innermargin}{\outermargin} for odd pages and {\outermargin}{\innermargin} for even pages. Is it possible to avoid defining and using \innermargin and \outermargin, and instead know/compute those margins using tikz's calc/positioning without explicitly passing those two arguments to sectitleformat? So, instead of using sectitleformat four times, I'd like to use it twice only (\sectitleformat[]... and \sectitleformat[numberless]...). \documentclass[twoside,openright,11pt]{report} \usepackage{geometry} \geometry{ showframe, a4paper, hmargin=18mm, bindingoffset=5mm, } \def\innermargin{\dimexpr\oddsidemargin+1in} \def\outermargin{\dimexpr\evensidemargin+1in\relax} \usepackage{MnSymbol} \usepackage{tikz} \usetikzlibrary{calc} \usepackage[explicit]{titlesec} \newcommand*\sectitleformat[7][]{ \titleformat{name=#2, page=#1}{\large\bfseries}{}{0pt}{ \begin{tikzpicture}[remember picture, overlay] \draw[draw=blue, thick] ($(current page.west|-0,0)+(#6,0)$) -- ++(#4,0) node [anchor=west] (S) {#3##1}; \draw[blue, thick] (S) -- ($(current page.east|-0,0)+(-#7,0)$); \end{tikzpicture} } } \newcommand*\sectitleformats[4]{ \sectitleformat[odd]{#1}{#2~$\filleddiamond$~}{#3}{#4}{\innermargin}{\outermargin} \sectitleformat[odd, numberless]{#1}{}{#3}{#4}{\innermargin}{\outermargin} \sectitleformat[even]{#1}{#2~$\filleddiamond$~}{#3}{#4}{\outermargin}{\innermargin} \sectitleformat[even, numberless]{#1}{}{#3}{#4}{\outermargin}{\innermargin} } \sectitleformats{\section}{\thesection}{.5cm}{fill} \sectitleformats{\subsection}{\thesubsection}{.75cm}{fill} \begin{document} \section{Numbered sec} \subsection{Numbered subsec} \section*{Numberless sec} \subsection*{Numberless subsec} \newpage \section{Another Numbered sec} \subsection{Another Numbered subsec} \section*{Another Numberless sec} \subsection*{Another Numberless subsec} \end{document}
- How do I consecutively number just regular paragraphs throughout a document?by Bruce Best on July 26, 2026 at 12:22 pm
I have searched this question, and have found so many, many different answers (a number of which I have tried unsuccessfully), that I feel as if it is the same as having no answer. What I am trying to do is fairly simple. I want every "normal" paragraph to be automatically and consecutively numbered through a document, eg, [1], [2]. By "normal" paragraph, what I mean is what would normally be a plain, unadorned paragraph from the body of a document that would be entered in most cases as plain text after a blank line. For example, my LaTeX source would look like this: \documentclass{article} \begin{document} \section{Section Heading} This is the first paragraph of my first section. It should have [1] at the beginning. This is the second paragraph of my first section. It should have [2] at the beginning. Following is a bullet list which should not be numbered: \begin{itemize} \item First list item \item Second list item \end{itemize} This is the third paragraph of my first section, should have [3] at the beginning. \subsection{Subsection Heading} This is the first paragraph of my first subsection. It should have [4] at the beginning. Here is a quote which should not be numbered: \begin{quote} This paragraph is a quotation from somewhere else. \end{quote} This is the next paragraph of my first subsection. It should have [5] at the beginning. \section{Another Section} This is the first paragraph of my second section. It should have [6] at the beginning. And so on. \end{document} Some of the code I've tried numbered EVERYTHING, including title pages, TOC, footnotes, captions etc. etc. However, I ONLY want the regular paragraphs numbered this way. What I want the output to look like is this: Section Heading [1] This is the first paragraph of my first section. It should have [1] at the beginning. [2] This is the second paragraph of my first section. It should have [2] at the beginning. Following is a bullet list which should not be numbered: First list item Second list item [3] This is the third paragraph of my first section. Subsection Heading [4] This is the first paragraph of my first subsection. It should have [4] at the beginning. Here is a quote which should not be numbered: This is the quotation. [5] This is the next paragraph of my first subsection. It should have [5] at the beginning. Another Section [6] This is the first paragraph of my second section. It should have [6] at the beginning. And so on. An example of what I want is Canadian court decisions, which usually look like this: https://www.canlii.org/en/on/onscdc/doc/2026/2026onsc3525/2026onsc3525.html If there is a simple answer to this that I have missed, would be much appreciated! Thanks
- Does `odt` creation with` tex4ht` resp. `make4ht` go with `lstinputlisting`?by user2609605 on July 26, 2026 at 10:44 am
The following is an MWE, or a MnWE test.tex: \documentclass{article} \usepackage{listings} \begin{document} This is \texttt{test.tex} \lstinputlisting{./test.tex} \end{document} Compiling this with make4ht -l -f xhtml test works without warning or error. In contrast, make4ht -l -f odt test yields $ make4ht -l -f odt test [STATUS] make4ht: Conversion started [STATUS] make4ht: Input file: test [ERROR] htlatex: Compilation errors in the htlatex run [ERROR] htlatex: Filename Line Message [ERROR] htlatex: ./test.tex ? Undefined control sequence. [STATUS] htlatex: <- [ERROR] htlatex: ? ? Undefined control sequence. [STATUS] htlatex: <- +1\relax }{}{\ifx \:temp \... l.41 \lstinputlisting{./test.tex} [WARNING] domfilter: XML DOM parsing of test.4oo failed: [WARNING] domfilter: ...ive/2025/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/text:p) [char=2732] [WARNING] domfilter: HTML DOM parsing OK, DOM filters will be executed --- xtpipes error 32 --- Missing 4xt script file name [WARNING] xtpipes: Xtpipes failed [WARNING] xtpipes: Trying HTML tidy [STATUS] make4ht: Conversion finished I tried a fix overwriting ooffice.4ht with the following patch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{listings} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \Configure{lstinline} {\HCode{<code class="lstinline">}\HtmlParOff\NoFonts} {\EndNoFonts\HtmlParOn\HCode{</code>}} \Css{code.lstinline{font-family:monospace,monospace;}} \Log:Note{to ensure proper alignments use fixed size fonts (see listings.dtx)} \HAssign\listingN=0%REIE \HAssign\listings:Depth = 0%REIE trying to define \listingN, but... I don't know whether this is the proper place or not. What I can tell is, that applying this patch, the result is [STATUS] make4ht: Conversion started [STATUS] make4ht: Input file: test [WARNING] domfilter: XML DOM parsing of test.4oo failed: [WARNING] domfilter: ...ive/2025/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/text:p) [char=2732] [WARNING] domfilter: HTML DOM parsing OK, DOM filters will be executed --- xtpipes error 32 --- Missing 4xt script file name [WARNING] xtpipes: Xtpipes failed [WARNING] xtpipes: Trying HTML tidy [STATUS] make4ht: Conversion finished which means that the error disappeared but the warning is still unresolved. My LibreOffice opens and shows a fairly good result. Nevertheless, if I unzip test.odt, and check xmllint settings.xml and accordingly with meta.xml, the xml tags are unbalanced. A last observation: If I use the according lstlisting environment instead of the \lstinputlisting macro as so: \documentclass{article} \usepackage{listings} \begin{document} test %\lstinputlisting{./test.tex} \begin{lstlisting} \documentclass{article} \usepackage{listings} \begin{document} test %\lstinputlisting{./test.tex} ... \end{document} \end{lstlisting} \end{document} all works fine, even without the patch.
- Real LaTeX source code preprocessor/flattener that respects TEXINPUTS, TEXMFHOME, and \subimportby Nasser on July 26, 2026 at 4:35 am
I need a reliable tool or compilation hook that can preprocess and flatten index.tex into a single, monolithic .tex file reflecting exactly what the compiler sees in memory before typesetting begins. The file index.tex uses \input and \subimport on documents which in turn could also pull in other latex files. Tool has to support \input and \subimport but \include is not needed as not used. Standard lightweight parsing scripts like flachtex or latexexpand or latex-flatten fail because they either do not support \subimport or do not hook into the system's active TeX Live binaries (like kpsewhich) to resolve paths to find the \input Instead, they force messy file system workarounds like manual folder flag passing or symbolic links, which is terrible software design and unmaintainable. Is there a robust, native preprocessor script or an engine hook (e.g., via LuaLaTeX or latexmk) that relies on the actual TeX Live environment variables to completely inline all inputs, sub-imports, and path-resolved dependencies into a single output file? Compiling the flattened index.tex should give the same PDF file as the original un-flattened index.tex. lualatex on texlive 2026.
- Fonts with good coverage of archaic Chinese charactersby richard on July 26, 2026 at 12:28 am
I'm trying to typeset an English document which contains the following text: The first of these Chinese characters is really problematic, and I've yet to identify a font which contains it. It is Unicode code point U+2B4DE (𫓞), which is an obscure, archaic character in the CJK Unified Ideographs Extension C block. It's normally replaced with 林 (U+6797) today, but I want to use the original character at least on the first use. Is anyone aware of a font that contains this sort of obscure characters? I typically use Noto Serif SC (or TC) when embedding fragments of Chinese in English text, and it's pretty good, but it doesn't seem to support this character. If not, is there any way of assembling the character manually from the 金 signific and 林 and 㐭 radicals which make it up, either in LaTeX or, possibly better, at a Unicode level using combining characters somehow? This question is not a duplicate of ‘Why doesn't my Chinese character display properly?’. I know why it doesn't display: my font doesn't support it. I'm also familiar with the solutions to that question: namely, to try a different font, in one of several different ways. What I'm looking for is either (a) a recommendation for a font that has sufficient coverage, or (b) a technique for composing the character manually from its individual radicals. Neither of those topics are addressed in that question.
- ConTeXt: is option `bodypartlabel` deprecated?by Akira on July 25, 2026 at 11:28 am
I am using ConTeXt ver: 2026.04.27 13:56 LMTX fmt: 2026.5.12 int: english/english on \setupinteraction[state=start,focus=standard] \definereferenceformat[zcref][label=reference:*] \setuplabeltext [en] [reference:section=Section~, reference:formula=Formula~] \setuphead [section] [textstyle=\bf, bodypartlabel=ABC, ] \starttext \startsection [title=Math, reference=sec:math] We want to refer to \zcref[sec:math]. \startformula 1 + 1 = 2 \numberhere[eq:one] \stopformula See \zcref[eq:one]. \stopsection \stoptext In particular, I use the option bodypartlabel=ABC to edit the label printed. However, there is no ABC on the PDF. Could you explain on this phenomenon? How can we check if the option bodypartlabel is deprecated?
- Is there a built-in mechanism in plain TikZ to cache intermediate calculations locally within a plot expression?by Jasper on July 25, 2026 at 5:35 am
Is there a built-in mechanism in plain TikZ to cache intermediate calculations locally within a plot expression? I mean I could just use a foreach loop and pgfmathsetmacro, but that's quite intensive. Is this built in to plot? If not, should/could it be? \documentclass{article} \usepackage{tikz} \begin{document} \tikz \draw[domain=0:1] plot ( \x, { (\x-2)^2 % there is an (\x-2) term here - (\x-2)^3 % and it is duplicated here } ) ; \end{document}
- Kaobook error message during compilation [duplicate]by 조문수 on July 25, 2026 at 3:39 am
TeXstudio 4.9.5 (git 4.9.5) When using QT version 6.11.0 and compiling with Qt 6.11.0 R, the following error message appears. What is the solution?
- How to combine Verbatim env. and a listing environment into ONE new environment?by Nasser on July 24, 2026 at 6:08 pm
When compiling to HTML I need to use \begin{Verbatim} TEXT \end{Verbatim} And when compiling to PDF, I need to use an environment defined using listing, called TEXTinline The thing is, I do not want to duplicate TEXT and do this \ifdefined\HCode \begin{Verbatim} TEXT \end{Verbatim} \else \begin{TEXTinline} TEXT \end{TEXTinline} \fi The above works, but it means I have to duplicate TEXT which can be very large in 2 places in the latex file. I'd like to just do \begin{myBOX} TEXT \end{myBOX} And inside the myBOX envi, it does the selection as earlier. The problem is that \if ....\else...\fi can not be inside \newenvironment{myBox} definition. Tried but could not make it work. So do not know what to do. Here is MWE with another attempt which also do not work \documentclass[12pt]{article}% \usepackage{listings} \usepackage{fancyvrb} \lstdefinestyle{TEXT}{% basicstyle=\ttfamily\small, breaklines=true, columns=fullflexible } \lstnewenvironment{TEXTinline}{% \lstset{style=TEXT}}{} % THIS DOES NOT WORK \ifdefined\HCode \newenvironment{myBox}{ \begin{Verbatim} }{ \end{Verbatim} } \else \newenvironment{myBox}{ \begin{TEXTinline} }{ \end{TEXTinline} } \fi \begin{document} \begin{myBox} I want to draw 3 cubes \end{myBox} \end{document} Using lualatex for PDF.
- tcolorbox vertical alignment in-line slightly offby anak on July 24, 2026 at 3:34 pm
I am encountering issues when trying to make an environment with the tcolorbox package that creates a vertically-aligned in-line box enclosing an itemize environment. The purpose was to mimic an \fbox around an itemize in a minipage (hence the prescribed width). Below is code for a MWE: \documentclass{standalone} \usepackage{tcolorbox} \usepackage{enumitem} \newenvironment{mybox}[1] { \begin{tcolorbox}[ on line, left=0em, right=0em, top=0em, bottom=0em, box align=center, width=#1, ] \begin{itemize}[ nosep, leftmargin=*, labelsep=0em, ] }{ \end{itemize} \end{tcolorbox} } \begin{document} This text is slightly above the centre of the box \begin{mybox}{3cm} \item True \item False \end{mybox} \end{document} However, there appears to be some misalignment with the outside text, as if there is additional space placed above the tcolorbox. Compare with the minipage method: \fbox{\begin{minipage}{3cm} \begin{itemize}[ nosep, leftmargin=*, labelsep=0em, ] \item True \item False \end{itemize} \end{minipage}}
- tkz-euclide: Ignore undrawn points for bounding boxby Nick A. on July 24, 2026 at 1:34 pm
I'm using tkz-euclide to draw the following diagram, which is not properly centered: \documentclass{article} \usepackage{tikz} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture} \tkzDefPoints{0/0/A, 5/0/B} \tkzCalcLength(A,B) \tkzGetLength{dAB} \tkzDefCircle[R](A, 0.4*\dAB) \tkzGetPoint{P1} \tkzInterLC(A,B)(A,P1) \tkzGetPoints{}{C} \tkzDefCircle[R](B, 0.4*\dAB) \tkzGetPoint{P2} \tkzInterLC(A,B)(B,P2) \tkzGetPoints{D}{} \tkzInterCC(A,C)(C,A) \tkzGetPoints{E}{} \tkzInterCC(D,B)(B,D) \tkzGetPoints{F}{} \tkzInterLL(A,E)(B,F) \tkzGetPoint{G} \tkzDrawSegment[thick](A,B) \tkzDrawArc[gray, delta=10](A,C)(E) \tkzDrawArc[gray, delta=10](B,F)(D) \tkzDrawArc[gray, delta=10](C,E)(A) \tkzDrawArc[gray, delta=10](D,B)(F) \tkzDrawSegments[gray, add=0 and .1](A,G B,G) \tkzDrawSegments[thick, blue](A,G B,G) \tkzLabelPoint[below left](A){$A$} \tkzLabelPoint[below right](B){$B$} \tkzLabelPoint[below left](C){$C$} \tkzLabelPoint[below right](D){$D$} \tkzLabelPoint[above left](E){$E$} \tkzLabelPoint[above right](F){$F$} \tkzLabelPoint[above](G){$G$} % \tkzDrawPoints(P2) % \draw[red] (current bounding box.south west) rectangle (current bounding box.north east); \end{tikzpicture} \end{document} Uncommenting the code at the bottom shows the issue is with the point P2: It's only used for calculation and not drawn, but the bounding box is drawn to include it anyway, pushing the diagram left. Is there a way to instruct tikz to ignore this point so the diagram is centered appropriately? Is there a better way to use tkz-euclide to avoid this issue?
- hfill not working with typewriter font [duplicate]by Bert Breitenfelder on July 24, 2026 at 8:46 am
\hfill does not seem to work correctly with the typewriter font. In the example below, if I comment out \renewcommand{\familydefault}{\ttdefault}, the date is aligned flush with the right margin, as expected. However, when I switch to the typewriter font, it no longer reaches the right margin. Am I missing something? \documentclass[12pt,a4paper]{article} \usepackage[margin=4cm]{geometry} \usepackage{lipsum} \renewcommand{\familydefault}{\ttdefault} \begin{document} \bigskip\bigskip \hfill New York, 23 July 2026 \bigskip \lipsum[5][4-6] \end{document} Compare the two figures:
- How to Place a Tcolorbox Inline Next to a Title?by DDS on July 23, 2026 at 11:08 pm
Consider the code: \documentclass[12pt]{book} \usepackage{scalefnt,color,yfonts} \usepackage[many]{tcolorbox} \begin{document} \thispagestyle{empty} {\color{red} \scalefont{2.00}{\textbf{\textsl{TITLE1}}}}\\[20pt] \scalebox{1.87}{\textbf{\textgoth{\Huge{Title2}}}} \tcbox[colback=yellow,width=0.75in,height=1.25cm]{Inline tcolorbox} \end{document} which produces QUESTION: How may I place the tcolorbox inline to the right of the second title? (I thought \tcbox would do that.) Thank you.
- what is the meaning of return codes of tlmgr?by user2609605 on July 23, 2026 at 8:28 pm
I wrote some install script for texlive using of course tlmgr under the hood. Nowhere I can find a documentation comprising return values also. I tried to analyze the script.. but was not really sure about the results. A link to documentation would be helpful since maybe even tlmgr may evolve. Reviewing the code, roughly speaking, the return value must be read in terms of bits $F_WARNING = 1 (Bit 0) $F_ERROR = 2 (Bit 1) $F_NOPOSTACTION = 4 (Bit 2) I think in most cases $F_ERROR bit set signifies an error, accordingly $F_WARNING set indicates a warning and $F_NOPOSTACTION... well I cannot figure out what a post action is. I am not quite sure about my analysis is really valid in any case and I dont know what a postaction is. Maybe someone reads this who is able to add a piece of documentation.
- ABNTeX2: how to make a List of Equations with names for them?by BsAxUbx5KoQDEpCAqSffwGy554PSah on July 23, 2026 at 7:31 pm
What I have: A master's dissertation written in LaTeX on Overleaf, using the document class ABNTeX2. It already have equations, declared as such: \documentclass[ 12pt, oneside, a4paper, english, spanish, esperanto, brazil, ]{abntex2} \usepackage{amsmath} \begin{document} \begin{equation} R^2 = 1 - \frac{\sum_{i=1}^{n} (\text{Real value}_i - \text{Predicted value}_i)^2}{\sum_{i=1}^{n} (\text{Real value}_i - \text{Average value})^2} \label{eq:r2} \end{equation} \end{document} What I need: I need that equations like that be automatically listed by a \listofequations command like a list of tables or a list of figures. The equations must have a name set up when they are declared, so something meaningful can be shown on the list instead of the equation LaTeX code.
- LuaLaTeX error ! LaTeX Error: Command `\eth' already defined [duplicate]by Andy Fletcher on July 23, 2026 at 5:04 pm
By compiling the following code via Lua LaTeX, I get the message: ! LaTeX Error: Command `\eth' already defined. My code is: \documentclass[a4paper,12pt]{report} \usepackage{unicode-math} \setmainfont{Carlito} \setmathfont{LeteSansMath} \usepackage{amssymb} \usepackage{latexsym} \usepackage{amsmath} \usepackage{amsbsy} \usepackage{amsfonts} \usepackage[mathscr]{eucal} \usepackage{verbatim} \usepackage{graphicx} \usepackage{fancyhdr} \usepackage{fancybox} \usepackage{array} \usepackage{bm} \usepackage{a4wide} \usepackage{enumitem} \usepackage{lipsum} \begin{document} \lipsum \end{document}
- ABNTeX2 - Custom labels not showing up on custom indexesby BsAxUbx5KoQDEpCAqSffwGy554PSah on July 23, 2026 at 1:25 pm
What I have: A master's dissertation written in LaTeX on Overleaf. It already have figures with custom definitions, and the caption show the correct name. However, they are all listed as "Figura N" on their respective lists, instead of using the custom name they show on the captions. What I need: That the lists of figures show the correct custom names they have: "Map", "Chart", "Flowchart", "Schema", instead of just "Figura" in every single instance... MWE: \documentclass[ % -- memoir class options -- 12pt, oneside, a4paper, english, spanish, esperanto, brazil, ]{abntex2} \usepackage{graphicx} % Required for inserting images \usepackage{newfloat} % provides \DeclareFloatingEnvironment \usepackage{subcaption} \DeclareFloatingEnvironment[ fileext=lsc, listname={List of schemas}, name=Schema, placement=H ]{schema} \DeclareFloatingEnvironment[ fileext=lma, listname={List of maps}, name=Map, placement=H ]{map} \DeclareFloatingEnvironment[ fileext=lch, listname={List of charts}, name=Chart, placement=H ]{chart} \DeclareFloatingEnvironment[ fileext=lfl, listname={List of flowcharts}, name=Flowchart, placement=H ]{flowchart} \begin{document} \listofmaps \listofcharts \listofflowcharts \listofschemas \clearpage \section{Article} Lorem ipsum. \subsection{Map} \begin{map}[h] \caption{Figs on a branch 5.} \centering \includegraphics[width=0.5\linewidth]{figs/fig5.png} \\Source: https://pixabay.com/illustrations/common-fig-fig-ficus-fruit-tree-6275997/. \label{fig:fig-5} \end{map} \subsection{Chart} \begin{chart}[h] \centering \caption{Two figs showing figs.} \begin{subchart}[t]{0.5\textwidth} \centering \includegraphics[height=3cm]{figs/fig1.png} %\caption{\parbox{\linewidth}{\centering Subajustado\\(\textit{underfitted}).}} \caption{\parbox{\linewidth}{\centering Figs on a branch 1.}} \label{fig:fig-1} Source: https://pixabay.com/illustrations/fruit-figs-tree-edible-leaves-7069156/. \end{subchart}% ~ \begin{subchart}[t]{0.5\textwidth} \centering \includegraphics[height=3cm]{figs/fig2.png} \caption{\parbox{\linewidth}{\centering Figs on a branch 2.}} \label{fig:fig-2} Source: https://pixabay.com/illustrations/fig-green-nature-fruit-tree-leaf-5430761/. \end{subchart}% \label{fig:fig-2} \end{chart} \subsection{Flowchart} \begin{flowchart}[h] \caption{Figs on a branch 4.} \centering \includegraphics[width=0.5\linewidth]{figs/fig4.png} \\Source: https://pixabay.com/illustrations/fig-fruit-nature-tree-summer-10169798/. \label{fig:fig-4} \end{flowchart} \subsection{Schema} \begin{schema}[h] \caption{Figs on a branch 3.} \centering \includegraphics[width=0.5\linewidth]{figs/fig3.jpg} \\Source: https://pixabay.com/illustrations/fig-vintage-fruit-branch-food-5801024/. \label{fig:fig-3} \end{schema} \end{document}
- Package breqn with TeX4ht or Make4ht with same breakingsby MadyYuvi on July 23, 2026 at 11:04 am
My code are: \documentclass[twocolumn,twoside]{article} \usepackage{breqn} \usepackage{showframe} \begin{document} \begin{dmath*} \tilde G = diag\left\{ {G,3G} \right\},{\tilde W_2} = diag\left\{ {{W_2},3{W_2}} \right\}, \tilde \Phi = diag\left\{ {\Phi ,3\Phi } \right\} \Xi (0,\mu ) = {\Pi _1} + {\Pi _2}(\mu ) + {\Pi _4}(0,\mu ) + ({\vartheta ^2} + \mu )Sym(\eta _2^T\Gamma _1^T{N_2}) + Sym(\eta _1^T\Gamma _1^T{N_1}) \Xi (\vartheta ,\mu ) = {\Pi _1} + {\Pi _2}(\mu ) + {\Pi _4}(\vartheta ,\mu ) + ({\vartheta ^2} + \mu )Sym(\eta _2^T\Gamma _1^T{N_2}) + Sym(\eta _1^T\Gamma _1^T{N_1}) \Pi ({\vartheta _t},{\dot \vartheta _t}) = {\Pi _1} + {\Pi _2}({\dot \vartheta _t}) + {\Pi _3}({\vartheta _t}, {\dot \vartheta _t}) + {\Pi _4}({\vartheta _t},{\dot \vartheta _t}), \Phi = {\vartheta ^2}G - \mu {W_1} {\Pi _1} = Sym\left\{ {\Sigma _1^T{R_{{\zeta_{ij}}}}{\Sigma _2}} \right\} + \sum\nolimits_{\zeta_{ij}^{'} = 1}^{N^2} {{\mathchar'26\mkern-10mu\lambda_{{\zeta_{ij}}\zeta_{ij}^{'}}}} \Sigma _1^T{R_{\zeta_{ij}^{'}}}{\Sigma _1} {\Pi _2}({\dot \vartheta _t}) = \Sigma _3^T{H_1}{\Sigma _3} - (1 - {\dot \vartheta _t})\Sigma _4^T{H_1}{\Sigma _4} + \Sigma _3^T{H_2}{\Sigma _3} - \Sigma _5^T{H_2}{\Sigma _5} + {\vartheta ^3}e_1^TA_i^TG{A_i}{e_1} + {\vartheta ^3}e_1^TA_i^TG{B_i}{K_j}{e_2} + {\vartheta ^3}e_2^TK_j^TB_i^TG{A_i}{e_1} + {\vartheta ^3}e_2^TK_j^TB_i^TG{B_i}{K_j}{e_2} {\Pi _3}({\vartheta _t},{\dot \vartheta _t}) = {\vartheta _t}e_1^TA_i^T{W_1}{A_i}{e_1} + {\vartheta _t}e_1^TA_i^T{W_1}{B_i}{K_j}{e_2} + {\vartheta _t}e_2^TK_j^TB_i^T{W_1}{A_i}{e_1} + \frac{2}{\vartheta }\Sigma _6^T{Z_1}{\Sigma _7} + \frac{{{{\dot \vartheta }_t}}}{\vartheta }\Sigma _8^T{Z_2}{\Sigma _8} + \frac{2}{\vartheta }\Sigma _8^T{Z_2}{\Sigma _9} + {\vartheta _t}e_2^TK_j^TB_i^T{W_1}{B_i}{K_j}{e_2}- {d_\vartheta }(t)e_6^T{W_2}{e_6} + \frac{{{{\dot \vartheta }_t}}}{\vartheta }\Sigma _6^T{Z_1}{\Sigma _6} - {\vartheta _t}(1 - {\dot \vartheta _t})e_5^T{W_1}{e_5} + {d_\vartheta }(t)(1 - {\dot \vartheta _t})e_5^T{W_2}{e_5} {\Pi _4}({\vartheta _t},{\dot \vartheta _t}) = ({\vartheta ^2} + {\dot \vartheta _t})Sym(\eta _2^T\Gamma _1^T{N_2}) + Sym(\eta _1^T\Gamma _1^T{N_1}) + {\vartheta _t}N_1^T{(\tilde \Phi )^{ - 1}}{N_1} + {\vartheta ^2}(\vartheta - {\vartheta _t})N_2^T{(\tilde G)^{ - 1}}{N_2} + {\dot \vartheta _t}(\vartheta - {\vartheta _t})N_2^T{({\tilde W_2})^{ - 1}}{N_2} {\Sigma _1} = {\left[ {e_1^T,e_2^T,e_3^T} \right]^T},{\Sigma _2} = {\left[ {e_4^T,e_5^T,e_6^T} \right]^T}, {\Sigma _3} = {\left[ {e_1^T,e_4^T} \right]^T},{\Sigma _4} = {\left[ {e_2^T,e_5^T} \right]^T} {\Sigma _5} = {\left[ {e_3^T,e_6^T} \right]^T}, {\Sigma _7} = {\left[ { - {\vartheta _t}e_4^T, - {\vartheta _t}e_2^T, - {\vartheta _t}e_7^T + e_1^T - (1 - {{\dot \vartheta }_t})e_2^T} \right]^T} {\Sigma _6} = {\left[ {e_1^T,e_2^T,e_7^T} \right]^T}, {\Sigma _9} = {\left[ { - {d_\vartheta }(t)e_5^T, - {d_\vartheta }(t)e_6^T, - {{\dot \vartheta }_t}e_8^T + e_2^T - e_3^T} \right]^T} {\Sigma _8} = {\left[ {e_2^T,e_3^T,e_8^T} \right]^T}, \end{dmath*} \begin{dmath*} {e_h} = \left[ {{0_{q \times (h - 1)q}},{I_q},{0_{q \times (8 - h)q}}} \right], h=1, 2,...,8. {\Gamma _1} = {[{\Lambda _1^T(0)}, {\Lambda _1^T(1)}]^T},{\Lambda _1}(0) = [I, -I, 0], {\Lambda _1}(1) = [I, I, -2I], {\eta _1} = [e_1^T, e_2^T, e_7^T]^T {{\bar R}_{{\zeta_{ij}}}} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{R_{{\zeta_{ij}}}}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, {{\bar H}_1} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{H_1}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, {{\bar H}_2} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{H_2}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, \bar G = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}G{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}} {\eta _2} = [e_2^T, e_3^T, e_8^T]^T, {\lambda _1} = \mathop {\max }\limits_{{\zeta_{ij}} \in \bar N \times \bar N} \left\{ {{\lambda _{\min }}({{\bar R}_{{\zeta_{ij}}}})} \right\}, {d_\vartheta }(t) = \vartheta - {\vartheta _t} \bar \lambda = \left\{ 3\mathop {\max }\limits_{{\zeta_{ij}} \in \bar N \times \bar N} \left\{ {{\lambda _{\max }}({{\bar R}_{{\zeta_{ij}}}})} \right\} + 2\vartheta {\lambda _{\max }}({{\bar H}_1}) + 2\vartheta {\lambda _{\max }}({{\bar H}_2}) + \frac{{{\vartheta ^4}}}{2}\lambda _{\max }(\bar G) + \vartheta ^2\lambda _{\max }({{\bar W}_1}) + \vartheta ^2\lambda _{\max }({{\bar W}_2}) + \left( {3 + 2\vartheta } \right)\left[ {\lambda _{\max }}({{\bar Z}_1}) + {\lambda _{\max }}({{\bar Z}_2}) \right] \right\} {{\bar W}_1} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{W_1}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, {{\bar W}_2} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{W_2}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, {{\bar Z}_1} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{Z_1}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}, {{\bar Z}_2} = {Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}{Z_2}{Q^{{{ - 1} \mathord{\left/ {\vphantom {{ - 1} 2}} \right. \kern-\nulldelimiterspace} 2}}}. \end{dmath*} \end{document} It produced the output as: I run the command make4ht.exe -f jats test.tex "mathml" for XML generation with MathML, is there any way to achieve the same breaking in XML file as exactly in PDF output?
- force ConTeXt XML export backend to preserve structural line breaks/rows (\NR) or columns (\NC) inside display math alignments?by Nasser on July 22, 2026 at 8:19 pm
I am using context --export=yes to generate structural XML from my TeX documents to process later via saxon and XSLT. While the math display equations render perfectly in the PDF output, the generated XML flattens multiple formulas into one single continuous string, completely discarding row-break data. This makes it not possible to write an XSLT template to generate HTML since there is no XML tag to tell XSLT where to start new formula when there are multiple formulas as in this example. Source Example: \setupbackend[export=yes] \starttext \startformula \sin x \alignhere = B \breakhere A \alignhere = C \stopformula \stoptext The pdf is The XML generated <formula> <formulacontent image="1-image-exported-1" n="1"> <math data-lmtx-blob="1" data-lmtx-meaning="sin 𝑥 equals 𝐵 times 𝐴 equals 𝐶" display="block" displaystyle="true" xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>sin</mi> <mi>𝑥</mi> <mo>=</mo> <mi>𝐵</mi> <mi>𝐴</mi> <mo>=</mo> <mi>𝐶</mi> </mrow> </math> </formulacontent> </formula> Notice that \breakhere is completely gone. converting this to HTML via saxon and xslt, the two formulas will show on one line, since there is no XML tag to tell where the breakhere is to guide the HTML generation. Is there a clean native configuration, an engine hook, or a specialized math function map in LMTX that tells the export processor to structure separate equation lines using custom XML hooks or native MathML container structures (like <mtr> and <mtd>)? I prefer not to use matrices because they alter math font character spacing properties. I worked on this with google AI for 2 hrs and we could not find solution.
- Carlito font in math mode and "not equal" signby Andy Fletcher on July 22, 2026 at 7:20 pm
I'm using Carlito font, but in math mode, the not equal sign (\neq) seems to have the vertical bar displaced to the right. I wonder, how this can be fixed? Below find my code: \documentclass[a4paper,12pt]{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[sfdefault,lf]{carlito} \usepackage[LGRgreek,italic]{mathastext} \usepackage[active]{srcltx} \usepackage{amsmath} \begin{document} The ``not equal'' sign seems to have the vertical bar displaced: $\neq$ \end{document}
- How to implement the `thmtools` patch with `kaotheorems` package in `kaobook`?by Explorer on July 22, 2026 at 5:41 pm
The full story comes from this issue. To show the question, we need the kaobook as I stated here. I try to apply mbert's patch, it works with simplified version: \documentclass{book} \let\openbox\relax \RequirePackage{amsmath} % Improved mathematics \RequirePackage{amsthm} % Mathematical environments \RequirePackage{thmtools} % Theorem styles \makeatletter \renewcommand\thmt@autorefsetup{% \@xa\def\csname\thmt@envname autorefname\@xa\endcsname\@xa{\thmt@thmname}% } \makeatother \makeatletter % Theorem styles \declaretheoremstyle[ spaceabove=.6\thm@preskip, spacebelow=.1\thm@postskip, bodyfont=\normalfont\itshape, headpunct={}, ]{kaoplain} \theoremstyle{kaoplain} \declaretheorem[ name=Theorem, refname={theorem,theorems}, Refname={Theorem,Theorems}, numberwithin=section, ]{theorem} \declaretheorem[ name=Proposition, refname={proposition,propositions}, Refname={Proposition,Propositions}, sibling=theorem,%<- ]{proposition} \makeatother \begin{document} Hello! \begin{proposition} This is a proposition. \end{proposition} \end{document} It works to get: But the direct example NOT work: \documentclass{kaobook} \usepackage{kaotheorems} \makeatletter \renewcommand\thmt@autorefsetup{% \@xa\def\csname\thmt@envname autorefname\@xa\endcsname\@xa{\thmt@thmname}% } \makeatother \begin{document} Hello! \begin{proposition} This is a proposition. \end{proposition} \end{document} The patch looks like works too late. How to quick fix in kaotheorems example without change the kaotheorems.sty?
- I need the symbol "for some"by BAAOF on July 22, 2026 at 3:46 pm
I’ve looked but haven’t found a package that provides it; I know it’s not exactly standard notation, but I use it regularly and would like to have it in LaTeX.
- Table of Contents headings not displaying Chinese numeralsby Climber of Mount. LaTeX on July 21, 2026 at 7:54 am
I came here from another question. After adopting the solution an answer, using zhnumber, titlesec, and ctex, I can create headings that employ Chinese (Traditional, but shouldn't matter here) numerals such as 壹、這是第壹章 instead of 1 這是第壹章 However, while this works for section-level headers in the body of the document, it is not reflected in the Table of Contents. Is there a way to fix this? For reference I use Overleaf, XeLaTeX, and the xeCJK package. MWE: \documentclass{article} \usepackage{xeCJK} \usepackage{titlesec} \usepackage{zhnumber} \titleformat{\section} {\Large\bfseries} {\zhnum[style={Financial,Traditional}]{section}、} {0pt} {} \titleformat{\subsection} {\large\bfseries} {\zhnum{subsection}、} {0pt} {} \begin{document} \tableofcontents \section{甲章} \subsection{甲節} \subsection{乙節} \section{乙章} \subsection{甲節} \subsection{乙節} \end{document}
- Does `newtx` (the `newtxmath` and `newtxtext` package) act on the numbers font in math?by Explorer on July 21, 2026 at 7:08 am
Let's consider the following three examples: Example1. with newtx: \documentclass{article} \usepackage{newtx} % \usepackage{newtxtext} % \usepackage{newtxmath} \begin{document} ABCDE abcde 12345 $ABCDE abcde 12345$ \end{document} Both the number in text or math was turned "Times": Example2. with newtxtext: \documentclass{article} % \usepackage{newtx} \usepackage{newtxtext} % \usepackage{newtxmath} \begin{document} ABCDE abcde 12345 $ABCDE abcde 12345$ \end{document} Only the text was turned "Times", and that was the expected behaviour. Example3. with newtxmath: \documentclass{article} % \usepackage{newtx} % \usepackage{newtxtext} \usepackage{newtxmath} \begin{document} ABCDE abcde 12345 $ABCDE abcde 12345$ \end{document} That was confusing for me, if and only if newtx was loaded, the numbers in math would be changed to "Times"-style, that was out of my expectation. Is the behaviour of newtxmath that didn't change the number in math that expected and how can it be changed?
- Making the pages numbers of a \usepackage{report} document easier to read?by Arbuja on July 21, 2026 at 12:42 am
Question: In the following code, how do we place a page number in the upper left corner for even numbered pages and upper right corner for odd numbered pages? (In the current code, the page number is on the bottom center.) I have the following file tree for my \usepackage{report} document: - File Tree - chapters - appendix.tex - chapter02.tex - chapter03.tex - chapter04.tex - introduction.tex - abstract.tex - main.tex - mendeley.bib - references.bib - titlepage.tex I have the following code in main.tex. (The rest of the files can be filled with lipsum.) \documentclass[11pt,twoside]{report} \usepackage[utf8]{inputenc} \usepackage{graphicx} \graphicspath{ {images/} } \usepackage{caption} \usepackage{subcaption} \usepackage{float} \usepackage[width=150mm,top=35mm,bottom=25mm,bindingoffset=6mm]{geometry} \usepackage{fancyhdr} \usepackage{setspace} \pagestyle{plain} \fancyhf{} \fancyhead[R]{\thepage} \renewcommand{\headrulewidth}{0pt} \setlength{\headheight}{14pt} \usepackage{biblatex} \addbibresource{references.bib} \title{Title} \author{Arbuja} \date{July 13th, 2026} \begin{document} \pagenumbering{roman} \input{titlepage} \input{abstract} \tableofcontents \listoffigures \doublespacing \chapter{Introduction} \pagenumbering{arabic} \input{chapters/introduction} \chapter{Asd} \input{chapters/chapter02} \chapter{Bsd} \input{chapters/chapter03} \chapter{Csd} \input{chapters/chapter04} \appendix \chapter{Dsd} \input{chapters/appendix} \singlespacing \printbibliography \end{document} Note: There is plenty of additional code in the original version. If the code you give doesn't work with the rest of the code, see this document. (The only changes I want is for even numbered pages, the page number should be on the upper left corner and for odd numbered pages, the page number should be on upper right corner.)
- What is the correct way to print a mixed number compatible with a tagged PDF?by Pablo González L on July 20, 2026 at 12:31 pm
I am working on a small package for school things (primary/secondary) where the well-known mixed numbers appear frequently ($3\frac{4}{5}$). The MWE I'm showing below does the job and can be validated with veraPDF. I'm using TL26 and LuaTeX: \DocumentMetadata { lang=es-CL, pdfversion=2.0, pdfstandard=ua-2, tagging=on, } \documentclass{article} \usepackage[spanish]{babel} \usepackage{unicode-math, hyperref} \hypersetup { colorlinks = true, pdfstartview = FitH, pdfdisplaydoctitle = true, pdftitle = {Test para números mixtos}, } \ExplSyntaxOn % Invisible Separator (use \Umathchardef from LuaTeX) \hook_gput_code:nnn {begindocument} {spintent} { \Umathchardef \__spintent_invisible_sep: = "0 "0 "2063 } % Vars \box_new:N \l__spintent_spmQ_target_box \box_new:N \l__spintent_spmQ_ref_box \dim_new:N \l__spintent_spmQ_raise_dim \dim_new:N \l__spintent_spmQ_target_dim \dim_new:N \l__spintent_spmQ_ref_dim \tl_new:N \l__spintent_spmQ_factor_tl \tl_new:N \l__spintent_spmQ_math_style_tl % Math style (use \mathstyle from LuaTeX) \cs_new_protected:Npn \__spintent_wrap_math:n #1 { $ \l__spintent_spmQ_math_style_tl #1 $ } \cs_new_protected:Npn \__spintent_spmQ_capture_math_style: { \tl_set:Ne \l__spintent_spmQ_math_style_tl { \int_case:nnF { \mathstyle } { { 0 } { \exp_not:N \displaystyle } { 1 } { \exp_not:N \displaystyle } { 2 } { \exp_not:N \textstyle } { 3 } { \exp_not:N \textstyle } { 4 } { \exp_not:N \scriptstyle } { 5 } { \exp_not:N \scriptstyle } { 6 } { \exp_not:N \scriptscriptstyle } { 7 } { \exp_not:N \scriptscriptstyle } } { \exp_not:N \textstyle } } } \cs_new_protected:Npn \__spintent_spmQ_scale_int:nnn #1 #2 #3 { \__spintent_spmQ_capture_math_style: \hbox_set:Nn \l__spintent_spmQ_target_box { \__spintent_wrap_math:n { #1 } } \hbox_set:Nn \l__spintent_spmQ_ref_box { \__spintent_wrap_math:n { \frac { #2 } { #3 } } } % Alturas \dim_set:Nn \l__spintent_spmQ_target_dim { \box_ht_plus_dp:N \l__spintent_spmQ_target_box } \dim_set:Nn \l__spintent_spmQ_ref_dim { \box_ht_plus_dp:N \l__spintent_spmQ_ref_box } % \dim_ratio:nn \dim_compare:nNnTF { \l__spintent_spmQ_target_dim } = { \c_zero_dim } { \tl_set:Nn \l__spintent_spmQ_factor_tl { 1 } } { \tl_set:Ne \l__spintent_spmQ_factor_tl { \dim_ratio:nn { \l__spintent_spmQ_ref_dim } { \l__spintent_spmQ_target_dim } } } % Sacle int box \box_scale:Nnn \l__spintent_spmQ_target_box { \l__spintent_spmQ_factor_tl } { \l__spintent_spmQ_factor_tl } % Align \dim_set:Nn \l__spintent_spmQ_raise_dim { \box_dp:N \l__spintent_spmQ_target_box - \box_dp:N \l__spintent_spmQ_ref_box } % Print \box_move_up:nn { \l__spintent_spmQ_raise_dim } { \box_use_drop:N \l__spintent_spmQ_target_box } \MathMLintent { enteros } { \__spintent_invisible_sep: } \frac { #2 } { #3 } } % #1 = int, #2 = Numerador, #3 = Denominador \NewDocumentCommand { \spmQ } { m m m } { \__spintent_spmQ_scale_int:nnn { #1 } { #2 } { #3 } } \ExplSyntaxOff \begin{document} Texto en línea $\spmQ{3}{4}{5}$ fin del párrafo. \[ \spmQ{3}{4}{5} \] \end{document} It produces the following output: and: <math xmlns="http://www.w3.org/1998/Math/MathML"> <mtext> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mn>3</mn> </math> </mtext> <mi intent="enteros" mathvariant="normal"></mi> <mfrac> <mn>4</mn> <mn>5</mn> </mfrac> </math> This can be done in a better way? Temporary code (will be removed later) This is an attempt at a generalized version of the answer given by David Carlisle using Lua. The idea is to not depend on the font name lmroman10-Regular.otf, but to capture it directly from Lua when executing the command, scale it, and print it. My best effort using Lua and \raisebox, which don't affect tagged PDFs...follows Max Chernoff style 😀 \DocumentMetadata { lang = es-CL, pdfversion = 2.0, pdfstandard = ua-2, tagging = on, } \documentclass{article} \usepackage[spanish]{babel} \usepackage{unicode-math, hyperref} \hypersetup { colorlinks = true, pdfstartview = FitH, pdfdisplaydoctitle = true, pdftitle = {Test para números mixtos}, } \begin{filecontents*}[overwrite]{\jobname.lua} -- Max Chernoff style (https://chat.stackexchange.com/transcript/message/68993656#68993656) local function register_tex_cmd(name, func, args) name = "__spintent_" .. name .. ":" .. ("n"):rep(#args) local scanners = {} for i = 1, #args do local scan_type = (args[i] == "string" and "scan_argument") or "scan_" .. args[i] scanners[i] = token[scan_type] end local scanning_func if #scanners == 1 then local s1 = scanners[1] scanning_func = function() func(s1()) end elseif #scanners == 2 then local s1, s2 = scanners[1], scanners[2] scanning_func = function() func(s1(), s2()) end else scanning_func = function() local values = {} for i = 1, #scanners do values[i] = scanners[i]() end func(table.unpack(values)) end end local index = luatexbase.new_luafunction(name) lua.get_functions_table()[index] = scanning_func token.set_lua(name, index, "global", "protected") end -- Code for \spmQ local spintent_factor = nil local glyph_id = node.id("glyph") local font_cache = {} local function is_digit(n) return n.char >= 48 and n.char <= 57 end local function get_scaled_font(id, factor) local key = tostring(id) .. ":" .. tostring(factor) if font_cache[key] then return font_cache[key] end local old_font = font.getfont(id) if not old_font then return id end local spec = {} for k, v in pairs(old_font.specification) do spec[k] = v end spec.size = math.floor(old_font.size * factor) local ok, data = pcall(fonts.definers.loadfont, spec) if not ok or not data then return id end local new_id = font.define(data) font_cache[key] = new_id -- texio.write_nl("new font = " .. tostring(new_id)) return new_id end local function scale_glyphs(head, factor) for n in node.traverse_glyph(head) do if is_digit(n) then -- texio.write_nl("glyph = " .. n.char .. " font = " .. n.font) local new_id = get_scaled_font(n.font, factor) n.font = new_id local f = font.getfont(new_id) if f and f.characters then local c = f.characters[n.char] if c then n.width = c.width n.height = c.height n.depth = c.depth end end end end return head end luatexbase.add_to_callback("post_mlist_to_hlist_filter", function(head) if not spintent_factor then return head end local factor = spintent_factor spintent_factor = nil -- texio.write_nl("MATH factor = " .. tostring(factor)) return scale_glyphs(head, factor) end, "spintent-math-scale" ) register_tex_cmd( "luafun_send_factor", function(value) local numerator, denominator = value:match("^(%d+)/(%d+)$") if numerator and denominator then spintent_factor = tonumber(numerator) / tonumber(denominator) else spintent_factor = tonumber(value) end -- texio.write_nl("LUA factor = " .. tostring(spintent_factor)) end,{"string"}) \end{filecontents*} \ExplSyntaxOn \cs_generate_variant:Nn \lua_load_module:n { V } \lua_load_module:V \c_sys_jobname_str \cs_generate_variant:Nn \__spintent_luafun_send_factor:n { V, e } % Invisible Separator (use \Umathchardef from LuaTeX) \hook_gput_code:nnn {begindocument} {spintent} { \Umathchardef \__spintent_invisible_sep: = "0 "0 "2063 } % Vars \box_new:N \l__spintent_spmQ_target_box \box_new:N \l__spintent_spmQ_ref_box \dim_new:N \l__spintent_spmQ_raise_dim \dim_new:N \l__spintent_spmQ_target_dim \dim_new:N \l__spintent_spmQ_ref_dim \tl_new:N \l__spintent_spmQ_factor_tl \tl_new:N \l__spintent_spmQ_math_style_tl % Math style (use \mathstyle from LuaTeX) \cs_new_protected:Npn \__spintent_spmQ_wrap_math:n #1 { $ \l__spintent_spmQ_math_style_tl #1 $ } \cs_new_protected:Npn \__spintent_spmQ_capture_math_style: { \tl_set:Ne \l__spintent_spmQ_math_style_tl { \int_case:nnF { \mathstyle } { { 0 } { \exp_not:N \displaystyle } { 1 } { \exp_not:N \displaystyle } { 2 } { \exp_not:N \textstyle } { 3 } { \exp_not:N \textstyle } { 4 } { \exp_not:N \scriptstyle } { 5 } { \exp_not:N \scriptstyle } { 6 } { \exp_not:N \scriptscriptstyle } { 7 } { \exp_not:N \scriptscriptstyle } } { \exp_not:N \textstyle } } } \cs_new_protected:Nn \__spintent_spmQ_measure:nnn { \__spintent_spmQ_capture_math_style: \hbox_set:Nn \l__spintent_spmQ_target_box { \__spintent_spmQ_wrap_math:n {#1} } \hbox_set:Nn \l__spintent_spmQ_ref_box { \__spintent_spmQ_wrap_math:n { \frac{#2}{#3} } } \dim_set:Nn \l__spintent_spmQ_target_dim { \box_ht_plus_dp:N \l__spintent_spmQ_target_box } \dim_set:Nn \l__spintent_spmQ_ref_dim { \box_ht_plus_dp:N \l__spintent_spmQ_ref_box } \dim_compare:nNnTF { \l__spintent_spmQ_target_dim } = { 0pt } { \tl_set:Nn \l__spintent_spmQ_factor_tl {1} } { \tl_set:Ne \l__spintent_spmQ_factor_tl { \dim_ratio:nn { \l__spintent_spmQ_ref_dim } { \l__spintent_spmQ_target_dim } } } % Pass to Lua 😀 \__spintent_luafun_send_factor:V \l__spintent_spmQ_factor_tl } % print \cs_new_protected:Nn \__spintent_spmQ_scale:nnn { \__spintent_spmQ_measure:nnn {#1}{#2}{#3} \luamml_annotate:en { nucleus = false, core={[0]='mn','#1'} } { \raisebox { -\box_dp:N \l__spintent_spmQ_ref_box } { \__spintent_spmQ_wrap_math:n { #1 } } } \MathMLintent {enteros} { \__spintent_invisible_sep: } \frac{#2}{#3} } \NewDocumentCommand \spmQ { m m m } { \__spintent_spmQ_scale:nnn {#1}{#2}{#3} } \ExplSyntaxOff \begin{document} Texto en línea: $-\spmQ{35}{4}{5}+\frac{2}{5}$ \[ \spmQ{35}{4}{5} \] \end{document} <math xmlns="http://www.w3.org/1998/Math/MathML"> <mn>35</mn> <mi intent="enteros" mathvariant="normal"></mi> <mfrac> <mn>4</mn> <mn>5</mn> </mfrac> </math>
- Node placement in tikz-cd when compiled in LaTeXMLby Branimir Ćaćić on July 20, 2026 at 9:39 am
I'm testing a manuscript for LaTeXML compatibility ahead of submission to the arXiv, and I've run into the following curious issue with tikz-cd when compiled in LaTeXML. In short, node names involving the \overline command are systematically misaligned—in particular, the horizontal misalignment of overlined nodes, especially when their names are longer, is extremely disruptive. Here's a minimal example illustrating this behaviour: \documentclass{article} \usepackage{tikz-cd} \begin{document} % both node names are centered \[ \begin{tikzcd} Q \\ R \arrow[from=1-1,to=2-1] \end{tikzcd} \] % the name of node 1-1 is now right- and bottom-aligned \[ \begin{tikzcd} \overline{Q} \\ R \arrow[from=1-1,to=2-1] \end{tikzcd} \] \end{document} Here are screencaps of the resulting diagrams side by side: I'm hoping there's a quick workaround for this behaviour. My manuscript involves a number of commutative diagrams where \overline is used repeatedly, some of which are quite large. Note that the above code compiles perfectly in LaTeXML without any errors or warnings. EDIT: For whatever it's worth, here's what you get from the following code: \[ \begin{tikzcd} \overline{Q} & Q \\ Q & \overline{Q} \arrow[from=1-1,to=2-1] \arrow[from=2-1,to=2-2] \arrow[from=1-1,to=1-2] \arrow[from=1-2,to=2-2] \end{tikzcd} \] EDIT 2: The same diagrams but with \tikzcdset{nodes=draw, every diagram/.append style={baseline=(\tikzcdmatrixname-1-1.base)}} as suggested:
- Jitter Metafont stroke endpoints to make glyphs messier [closed]by morgan on July 20, 2026 at 4:03 am
I would like to use .*TeX to make a variety of documents, including many with handwriting. I would like to avoid the glyphs exactly repeating since that looks less real. I previously found something to offset and rotate words, which definitely would help, but is there a way to have Metafont stroke endpoints be randomly offset? For each glyph, modify it so that each unique position is offset by a random amount, with two instances of the same value resulting in the same value. That would make each glyph a bit different, and in combination with other effects and on a handwriting style font, better approximate the look of handwriting as well as be another way to show rushed vs calmly written documents that also still look like they were written by the same person. As another possibility, instead replace all characters with random alternates, maybe this could be done as ligatures, so replacing all ‘e’s with ‘ea’ ‘eb’ ‘ec’ etc. Then for the Metafont, outside of .*TeX, I could make a script that copies and modifies the glyph files for those ligatures to randomly offset each position, with all identical values modified identically. I could have that script run before document generation to let each document be a different amount of messiness. Edit: The question was closed, but was not answered or explained what details are missing. I am still interested in answers and comments to figure out how to do this. I added some more details to my question, clarifying my original idea on how it would function as well as adding a second method that perhaps is easier to implement.