Hot
- Rounding errors printing fractions with \pgfmathprintnumberby pwesterbaan on January 25, 2026 at 12:53 am
I'm trying to use pgfmath to help with randomizing exam questions that I give my students. One of the hurdles I've come across is printing fractions correctly. I've defined the following command: \newcommand{\printFrac}[2]{ \pgfmathprintnumber[frac, frac whole=false, frac shift=1, precision=8]{\fpeval{#1/#2}} } While debugging, I've found that this fails with fractions like "10/41" and "16/9": \[10/41: \printFrac{10}{41}\qquad 16/9: \printFrac{16}{9}\] I read about and tried the pgfmath-xfp package, but the error still persists: \pgfmxfpdeclarefunction{myfrac}{2}{#1/#2} \newcommand{\printFrac}[2]{ \pgfmathparse{myfrac(#1,#2)} \pgfmathprintnumber[frac, frac whole=false, frac shift=1, precision=8]{\pgfmathresult} } Is there something obvious I'm missing? Should I be using another method to print out randomly generated fractions?
- correct way to make href and url underlined and blue colored in tex4ht?by Nasser on January 24, 2026 at 10:18 pm
This MWE compiles OK in lualatex and gives correct PDF where both href and url show the URL text with blue color and also underlines with blue line. But not able to make it compile with tex4ht \documentclass[12pt]{article} \usepackage{xcolor} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, urlcolor=blue, pdfborder={0 0 0}, % Removes the box border } \usepackage{ulem} \newcommand{\bluelink}[2]{\href{#1}{\uline{#2}}} \usepackage{url} \useunder{\uline}{\ulined}{}% \DeclareUrlCommand{\blueurl}{\def\UrlFont{\ttfamily\color{blue}\ulined}} \begin{document} blue underline url \blueurl{www.google.com} blue underline href \bluelink{www.google.com}{google} \end{document} lualatex index.tex gives Compiling with tex4ht gives >make4ht -ulm default -a debug index.tex "mathjax,htm" ... (/usr/local/texlive/2025/texmf-dist/tex/generic/tex4ht/html5.4ht)) (/usr/local/texlive/2025/texmf-dist/tex/latex/l3backend/l3backend-dvips.def) (./index.aux) (/usr/local/texlive/2025/texmf-dist/tex/latex/lm/ot1lmtt.fd)) Runaway argument? {\fi \ht:special {t4ht@]}\Url:HyperHook {\Url@FormatString }\endgroup \ETC. ! File ended while scanning use of \n:uline:. <inserted text> \par <*> ...html5.a.b.c.\input "\detokenize{index.tex}" ? How to make this to work in tex4ht? Hoping do not need to use CSS for this? I needed both href and url to be like they show in PDF and not just href and not just url, as I use both. TL 2025.
- circuitikz: position and adjust current and voltage arrowsby cis on January 24, 2026 at 7:17 pm
I'm trying to recreate this image on 5mm grid paper using the original dimensions. It's not a big problem; I'm just looking for some fine-tunings inside the circuitikz-package. I've tested a few keys, but I'm wondering: What is the correct method: to add a longer voltage arrow that's a bit further away from the source? to add a current arrow at the shown position in a package-like way (regular TikZ is clear)? PS: I would also like to reduce the (global setting!) size of the arrowheads and the control points ("poles", I haven't quite understood chapter 6.1 yet); but that might be too much for one thread. MWE: [I've only set a small excerpt here to address the problems. I can easily add the rest later by myself.] \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[font=\footnotesize\sffamily, european resistors, circuitikz/resistors/width=0.425,% default 0.8 circuitikz/bipoles/generic/height=0.165,% default 0.3 circuitikz/bipoles/thickness=1.0, % default 2 circuitikz/bipoles/vsource/width=0.35, circuitikz/bipoles/vsource/height=0.35, %circuitikz/bipole/is voltage=false, %circuitikz/voltage/distance from node=5.0875,% old: 0.8 %circuitikz/voltage shift sources adjust=4.525,% default: 0.5 %voltage shift=0.125,% optional ] \draw[gray!25, step=5mm] (-1.5,0.5) grid (4,-4); \draw[] (0,-2) to[vsource, v<=12V, mirror] (0,0) -- (1.5,0); \draw[] (0.5,0) to[R=15, *-*] (0.5,-1) to[R, a=25, -*] (0.5,-2); \end{circuitikz} \end{document}
- Package draftmark conflicts with siunitxby user172294 on January 24, 2026 at 3:55 pm
I would like to use both packages draftmark and siunitx in the same document. When I do this I get the error ! Undefined control sequence. \@BTswitch ->{\CT@arc@ \hrule \@height \@thisrulewidth }\futurenonspacelet \... As soon as I comment out either \usepackage{siunitx} or \midrule, it works. Here is what I tried \documentclass[11pt,a4paper]{article} \usepackage{siunitx} \usepackage{booktabs,tabularx} \usepackage[draft]{draftmark} \begin{document} \begin{tabularx}{\textwidth}{ll} head1 & head2 \\ \midrule 123 & 456\\ 123 & 456\\ \end{tabularx} \end{document} Obiviously, there is no problem when I comment out \usepackage[draft]{draftmark} Can anyone help? Thanks.
- Help trying to customise toc with tagging supportby David Purton on January 24, 2026 at 12:25 pm
I'm trying to customise the TOC using built in commands to allow for tagging support, but I'm running in to some behaviour I can't figure out. In the following MWE, the I set \contentsline@text@2@format to \emph and the the line is formatted as expected. But if I set it to \MakeUppercase the label structure breaks (in this case notice the missing space after the subsection number). Am I doing this wrong? I'm struggling to trace the code through to find out why this happens. %! TeX Program = lualatex \DocumentMetadata{ lang=en, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on } \documentclass{article} \ExplSyntaxOn \cs_set_nopar:cpn { contentsline@text@2@format } { \emph % Fails with \MakeUppercase } \ExplSyntaxOff \begin{document} \tableofcontents \subsection{A section heading} \end{document}
- chemnum: How to create an alias compound label so two IDs print the same number (multi layer one)by taiwan12 on January 24, 2026 at 11:29 am
A few day ago I asked the following question: chemnum: How to create an alias compound label so two IDs print the same number (without breaking numbering)? Previous question: I am using chemnum and referencing compounds via \cmpd{...}. What I want is a simple alias mechanism: \cmpd{A} should define/print compound 1 after \makecmpdalias{A}{B}, \cmpd{B} should also print 1 (B is an alias for A) importantly, the next new compound should continue numbering normally, so \cmpd{C} should print 2 (not 3) similarly D and E should share one number. Recived asnwer: % Source - https://tex.stackexchange.com/a/758487 % Posted by jlab % Retrieved 2026-01-24, License - CC BY-SA 4.0 \documentclass{article} \usepackage{chemnum} \ExplSyntaxOn \prop_new:N \l__cmpdalias_prop \cs_new:Nn \cmpdalias_make_alias:nn { \prop_put:Nnn \l__cmpdalias_prop { #1 } { #2 } } \NewDocumentCommand { \makecmpdalias } { m m } { \cmpdalias_make_alias:nn { #1 } { #2 } } \cs_new_protected:Npn \FindCmpAlias #1 { \seq_clear:N \l_tmpa_seq \clist_map_inline:nn { #1 } { \prop_get:NnNTF \l__cmpdalias_prop { ##1 } \l_tmpa_tl { \seq_put_right:Ne \l_tmpa_seq { \l_tmpa_tl } } { \seq_put_right:Nn \l_tmpa_seq { ##1 } } } \tl_set:Ne \ProcessedArgument { \seq_use:Nn \l_tmpa_seq { , } } } \RenewDocumentCommand \cmpd { s t +O{} >{\FindCmpAlias} m } { \chemnum_cmpd:nnnn {#1} {#2} {#3} {#4} } \ExplSyntaxOff \begin{document} \makecmpdalias{A}{B} \makecmpdalias{D}{E} \makecmpdalias{F}{H} A: \cmpd{A} B: \cmpd{B} A,B: \cmpd{A,B} C: \cmpd{C} D: \cmpd{D} E: \cmpd{E} F: \cmpd{F} G: \cmpd{G} H: \cmpd{H} I: \cmpd{I} \end{document} What I missed to mention in my original question is the following: Aliases must be transitive (“multi-layer”): if B aliases A and H aliases B, then H should also resolve to A. \makecmpdalias{A}{B} \makecmpdalias{D}{E} \makecmpdalias{B}{H} \makecmpdalias{H}{I} A: \cmpd{A} B: \cmpd{B} C: \cmpd{C} D: \cmpd{D} E: \cmpd{E} F: \cmpd{F} G: \cmpd{G} H: \cmpd{H} I: \cmpd{I} J: \cmpd{J}
- book class how to rename the chapterby RenatoP on January 24, 2026 at 10:56 am
I would like that the command \chapter shows another name. Like i.e every chapter show this: \chapter{xyzzy} shows "sezione x xyzzy" I can tell you other things because I know is not well asked.
- Titlegraphic and metropolisby Holden on January 24, 2026 at 8:26 am
I use beamer with metropolis theme for slides. I want to make a title page with an image on the right bottom of the slide. However, \titlegraphic somehow does not work. I tried using \maketitle instead of \titlepage, but it didn't change the situation. \documentclass[12pt, aspectratio=169, compress]{beamer} \usepackage{graphicx} \usepackage{mathptmx} \usepackage{amssymb} \usepackage{pifont} \usepackage{biblatex} \usepackage[normalem]{ulem} \usepackage{movement-arrows} \usepackage[linguistics]{forest} \usepackage{multicol} \usepackage{comment} \usepackage{leipzig} \usepackage{bbold} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usepackage{xcolor} \usepackage{gb4e} \addbibresource{ref.bib} \usetikzlibrary{decorations.pathmorphing} \usetheme[block=fill]{metropolis} \setbeamersize{text margin left=10pt, text margin right=10pt} \setbeamertemplate{bibliography item}[text] \setbeamertemplate{headline}{ \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.2ex]{section in head/foot} \insertsectionnavigationhorizontal{\paperwidth}{}{} \end{beamercolorbox} } \title{title} \author{author} \date{} \institute{} \titlegraphic{\vspace{5cm} \hfill \includegraphics[width=0.3\linewidth]{image.png}} \begin{document} \begin{frame}[plain] \titlepage \end{frame}
- A new kind of ligature, connected d/pby ivo Welch on January 24, 2026 at 3:58 am
I have been trying to coerce Claude to help me, but it is hilariously bad. I am trying to create a new character that looks like d <space> p, where the <space> becomes a connector. The font is charter, math, which I can pull off from newtxmath or mathdesign, which means the input is modestly slanted. \documentclass[12pt]{standalone} \usepackage{XCharter} \usepackage[charter,vvarbb]{newtxmath} \usepackage{amsmath} \begin{document} \fontsize{200}{172}\selectfont \ensuremath{d \kern22pt p} \end{document} I have blown this up here, but I shall need it in my normal font lateron. The result is supposed to look somewhat like: Obviously, one can do quite a bit better than me and my pen, especially, but not only at the lower left corner of my new connector. I will use this, in standard font size, a few hundred times in my document. Is it easy to create such a character? What program should I use? A low learning curve is a lot more important than versatility for further designs in the future. Once I have the character, how do I best use it in my document? Should I try to create its own one-character font, or just create a few PNG files at the right sizes that a \dp\ macro then inserts?
- Is there a programmatic way to handle iterative insertion of \adaptlayout[]?by Gary on January 24, 2026 at 3:04 am
This might be a bit of a far-fetched question but I was wondering about programming a method of handling one of the last steps of completing a document where I currently scan each page and insert an \adaptlayout[lines=...] to handle irregular looking paragraph breaks. For example, one instance has a three-line paragraph near the end of a page, that leaves two blank lines at the bottom and pushes the paragraph to the next page. So, I either leave it, lengthen the page by one line, or shorten the previous page by one line. Regardless of how one chooses to handle such instances, is there a place to write such logic that could compare the difference in the number of blank lines at the end of facing pages and make such an adjustment, such that if the document was later modifed due to an overlooked typo or font change, one wouldn't have to redo that step? Is it even possible to execute code after the document has reached this point of completion? It might be a ridiculous thought because, following each insertion of an \adaptlayout[lines=...], the document would require a new run since every page thereafter until a section starts on new page would change and need re-evaluated. Thank you.
- Can I add a symbol to indicate that a footnote has been split across pages?by Draconis on January 23, 2026 at 9:05 pm
My university's thesis formatting guidelines are extremely stringent about margins, which means when a footnote gets split across pages (because the \footnotemark is on the bottom line of the page, so including the entire footnote would push the mark onto the next page), there's not much I can do to fix it. I can't, for example, expand the text box slightly, or insert some additional whitespace at the bottom. Proofreaders have found this confusing. So with the better typographical solutions being off-limits, I would like to at least indicate to the reader that the footnote continues on the next page. Is it possible to indicate some sort of symbol, such as a rightward-pointing arrow, at the point where a footnote has been split across pages, to indicate that it's continued elsewhere? I know some periodicals do this when an article is split across pages. MWE adapted from here: \documentclass[oneside]{book} \usepackage{lipsum} \usepackage[splitrule]{footmisc} \begin{document} \lipsum[1-3] \lipsum[1] New paragraph, which is really long, so long in fact that it spans more than one line. New paragraph, which is really long, so long in fact that it spans more than one line. \footnote{Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour. Here's a really long footnote that will probably be longer than one line, which could help to show the problematic behaviour.} % \lipsum \end{document} Current result: What I would like: some kind of symbol (perhaps a ➤?) at the end of the first page, showing that the footnote continues elsewhere and isn't just broken off. \usepackage[splitrule]{footmisc} indicates on the next page that there's a continuation, but I would like a marker on the first page as well. This question, this question, and this question ask the same thing, but none of them includes a MWE; I'm hoping that providing one will help find an answer.
- Include parts of single file document still preserving counters like \includeonlyby Miguel V. S. Frasson on January 23, 2026 at 8:51 pm
I have a large book (750 pages) in a single file. One single file has advantages, like search/replace the entire TeX file without need of fancy multifile search features. But multiple files have the advantage of \includeonly feature: preserve counters (which preserves typesetting), faster compilation of fewer pages when fine-tuning. I wonder if there is a implementation of such \includeonly-like feature in single file documents, so I could (for instance) compile one chapter per time, preserving counters. Any thoughts? Edit: Another solution could be a set of macros that saves and restores the state of counters, like \includeonly does. If this is not implemented, maybe I could do it, but I prefer a ready-to-use solution, if any. M"W"E: if I omit or change argument of \includeonlyParts, I would get feature like \includeonly. \documentclass{report} \usepackage[T1]{fontenc} \providecommand{\savecounters}{} \providecommand{\restorecounters}{} \providecommand{\breakdoc}[1]{} \providecommand{\includeonlyParts}[1]{} \includeonlyParts{breakpoint-2} \begin{document} \breakdoc{breakpoint-1} \chapter{First} text \breakdoc{breakpoint-2} \chapter{Second} \breakdoc{breakpoint-3} \chapter{Third chapter} \end{document}
- How to position TikZ shapes directly centered under text labels in a table-like layout?by Oregon Math Tutor on January 23, 2026 at 7:13 pm
I'm creating a geometry reference sheet with a table-like layout using TikZ. I need: the shape label horizontally centered in the cell each figure centered beneath the label As the image shows, I can't achieve this alignment. This image shows my desired output: This image (partial screen shot) shows what the current code renders: Current approach: Using \node for labels positioned with anchor=east Drawing shapes inside \begin{scope}[shift={...}] blocks Each row has a label on the left, shape in the middle-left, and properties on the right Thanks very much for taking time to assist me! mwe: \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{amssymb} \usetikzlibrary{calc, shapes.geometric, arrows.meta, decorations.markings} % Use Helvetica (similar to Arial) for a clean look since custom fonts caused errors \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} % Define colors to match the original image \definecolor{colSquare}{RGB}{156, 188, 156} % Muted Green \definecolor{colRect}{RGB}{128, 128, 128} % Greyish \definecolor{colPara}{RGB}{255, 105, 120} % Pink/Red \definecolor{colRhom}{RGB}{190, 140, 190} % Purple \definecolor{colKite}{RGB}{180, 230, 200} % Mint Green \definecolor{colTrap}{RGB}{245, 170, 60} % Orange \definecolor{colText}{RGB}{128, 0, 128} % Purple text for headers \definecolor{colLine}{RGB}{70, 130, 180} % Blue grid lines \begin{document} \begin{tikzpicture}[ thick, % Style for shape outlines myshape/.style={draw=black, line width=1pt}, % Custom tick marks for sides tick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-2.5pt,-2.5pt) -- (2.5pt,2.5pt);}}}}, dtick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-1.5pt,-2.5pt) -- (2.5pt,2.5pt) (-4.5pt,-2.5pt) -- (-0.5pt,2.5pt);}}}}, % Custom arrows for parallel lines parrow/.style={postaction={decorate, decoration={markings, mark=at position 0.55 with {\arrow[scale=1.5,black]{>}}}}} ] % --- Grid Layout --- % Horizontal lines \draw[colLine] (-4, 1.5) -- (12, 1.5); \draw[colLine] (-4, 0) -- (12, 0); \draw[colLine] (-4, -4) -- (12, -4); \draw[colLine] (-4, -8) -- (12, -8); \draw[colLine] (-4, -12) -- (12, -12); \draw[colLine] (-4, -16) -- (12, -16); \draw[colLine] (-4, -20) -- (12, -20); \draw[colLine] (-4, -24) -- (12, -24); % Vertical separator \draw[colLine] (3.5, 1.5) -- (3.5, -24); % Headers \node[text=colText, scale=2] at (-0.25, 0.75) {Shape}; \node[text=colText, scale=2] at (7.75, 0.75) {Properties}; % --- Row 1: Square --- \begin{scope}[shift={(0,-2)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Square}; \coordinate (S1) at (2.5, -1.2); \coordinate (S2) at (4.9, -1.2); \coordinate (S3) at (4.9, 1.2); \coordinate (S4) at (2.5, 1.2); \fill[colSquare] (S1) -- (S2) -- (S3) -- (S4) -- cycle; % Ticks drawn manually to ensure rotation alignment looks just like the image \draw[myshape] (S1) -- (S2) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S2) -- (S3) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S3) -- (S4) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S4) -- (S1) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (S1) -- (S3); \draw (S2) -- (S4); % Right angle at center \draw (3.7,0) ++(0.2,0.2) -- ++(-0.2,0.2) -- ++(-0.2,-0.2); % Corner right angles \draw (S1) ++(0.3,0) -- ++(0,0.3) -- ++(-0.3,0); \draw (S2) ++(-0.3,0) -- ++(0,0.3) -- ++(0.3,0); \draw (S3) ++(-0.3,0) -- ++(0,-0.3) -- ++(0.3,0); \draw (S4) ++(0.3,0) -- ++(0,-0.3) -- ++(-0.3,0); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item All sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect at $90^\circ$. \end{itemize} \end{minipage} }; \end{scope} % --- Row 2: Rectangle --- \begin{scope}[shift={(0,-6)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Rectangle}; \coordinate (R1) at (2.5, -0.9); \coordinate (R2) at (5.0, -0.9); \coordinate (R3) at (5.0, 0.9); \coordinate (R4) at (2.5, 0.9); \fill[colRect] (R1) -- (R2) -- (R3) -- (R4) -- cycle; % Sides ticks \draw[myshape] (R1) -- (R2) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R2) -- (R3) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (R3) -- (R4) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R4) -- (R1) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (R1) -- (R3); \draw (R2) -- (R4); % Corners \draw (R1) ++(0.2,0) -- ++(0,0.2) -- ++(-0.2,0); \draw (R2) ++(-0.2,0) -- ++(0,0.2) -- ++(0.2,0); \draw (R3) ++(-0.2,0) -- ++(0,-0.2) -- ++(0.2,0); \draw (R4) ++(0.2,0) -- ++(0,-0.2) -- ++(-0.2,0); % Diagonal marks (triple tick) % Manually drawing triple ticks on diagonals \draw[line width=0.8pt] (3.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.4, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.1, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.3, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.4, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.1, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.3, -0.1) -- ++(0.1,-0.2); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item Opposite sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect each other. \end{itemize} \end{minipage} }; \end{scope} \end{tikzpicture} \end{document}
- Images confuse with 3D asymptoteby user386618 on January 23, 2026 at 6:23 pm
I'm trying to add a 2d image into a 3d graph using this Inserting graphics into asymptote or pgfplots but when i do this it creates 2 separate images one at the center and one at the coordinates (in 2 plane haven't work out yet) did anyone know how to do this. label(graphics(), triple) gets insane so i used regular points instead and setting settings.inlineimage=false; don't help at all if(!settings.multipleView) settings.batchView=false; settings.tex="pdflatex"; defaultfilename="draft-1"; if(settings.render < 0) settings.render=0; settings.outformat=""; settings.inlineimage=false; settings.embed=true; settings.toolbar=false; viewportmargin=(2,2); import graph3; size(6cm); defaultpen(1.5bp); currentprojection=perspective(8,6,3); currentlight=nolight; triple[][] V={{(0,0,0), (1,0,0), (1,1,0), (0,1,0)}, {(0,0,2), (1,0,2), (1,1,2), (0,1,2)}}; label(graphic("ladybug.png","width=1cm"), project((1.1,0,0))); draw(V[0][0]--V[1][0], gray); draw(V[0][0]--V[0][1], gray); draw(V[0][0]--V[0][3], gray); draw(V[0][1]--V[1][1]--V[1][2]--V[0][2]--cycle); draw(V[0][2]--V[1][2]--V[1][3]--V[0][3]--cycle); draw(V[1][0]--V[1][1]--V[1][2]--V[1][3]--cycle); label("$10cm$", V[0][1]--V[0][2]); label("$10cm$", V[0][2]--V[0][3]); label("$20cm$", V[0][3]--V[1][3]); dot(V[0][1], blue); dot(V[1][3], blue);
- Horizontal spacing smaller than \, (math mode) [duplicate]by Luis Mendo on January 23, 2026 at 5:27 pm
I like to use something like \,mathrm d t for the differential in an integral. That is, upright d for the differential symbl, with a bit of spacing before it, and then the variable t: However, the final t is too close to the d (I think they end up that close partly because the "d" is roman and the "t" is italic. Also, I'm using mathptmx in this example, but the question is in general). If I include \, between them, they become too separated: How can I easily get a fraction of the \, spacing in math mode? Ideally, for consistence, without manually specifying units like millimeters. For instance, something like \,[.4] (?) meaning "40% of the spacing provided by \,".
- Warning "Returning node center instead of a point on node border." when using TikZ in beamer onlyenvby schtandard on January 23, 2026 at 5:22 pm
Consider the following MWE. \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame} \begin{onlyenv}<2>% \tikz [remember picture, overlay] \node (A) {A};% \hskip 5em \tikz [remember picture, overlay] \node (B) {B};% \tikz [remember picture, overlay] \draw (A) -- (B);% \end{onlyenv}% \end{frame} \end{document} It produces the expected output (an empty page followed by one where A and B are connected by a line), but produces two unusual warnings. Package pgf Warning: Returning node center instead of a point on node border. D id you specify a point identical to the center of node ``B''? on input line 17. Package pgf Warning: Returning node center instead of a point on node border. D id you specify a point identical to the center of node ``A''? on input line 17. The warning is surprising because usually in TikZ, writing (A) is equivalent to writing (A.center). Indeed, the warnings only seem to appear in this rather particular case where the drawing is split over several tikzpictures (using remember picture), both points ((A) and (B)) have the same coordinates ((0,0) in this example) and there is an overlay where the picture is not drawn (here the first one). Why is there a warning here? Is this a bug? If so, in TikZ or in beamer? Is there an easy way to avoid it (without changing the drawings)?
- dotfill and justification [closed]by Phillip Helbig on January 23, 2026 at 3:59 pm
I have something like \parbox[b]{0.924\textwidth}{ SPACE\dotfill\quad\\bar\quad\SPACE } I want the space on the left to be a fixed amount of physical space so that the beginning of the dotfill lines up with that of another parbox which has \hangafter=1 and \hangindent=1em. However, I want the space at the right to be variable such that the expansion of \bar is flushright in the box. The problem is that \dotfill chooses one dot too few rather than one too many (which is good) if the expansion of \bar is not flushright. I can fool around with inserting space manually but that’s finicky.
- circuitikz: 'muxdemux' with exact same dimensions as an 'european resistor (inductor)'by cis on January 23, 2026 at 3:01 pm
Just out of interesst, I asked myself how to configure a muxdemux such that it has the exact same dimensions as an european resistor (european inductor), but with three muxdemux-pins on the underside. (Note: The exact target image is attached.) Here is my approach: \documentclass[border=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors, IPP/.style={muxdemux, muxdemux def={Lh=0.8, Rh=0.8, NL=1, NR=1, NB=3, NT=0, w=2}, %muxdemux label={B2=abc, BL1=1, BL2=2, BL3=3,}, %external pins width=0.4, circuitikz/muxdemuxes/fill=gray!25, }, ] \node [IPP, align=center](A) at (0,0) {}; \draw[] (-1,0.5) to[R, fill=gray!25] +(2,0); \end{circuitikz} \end{document}
- Raise integral signs with limitsby Knudsen on January 23, 2026 at 2:14 pm
Is there a way to raise an integral sign slightly and bring the limits together with it? For example, in \documentclass{report} \begin{document} \[ \int_0^1 \sqrt{a+b\sqrt{a+b\sqrt{a+b\sqrt{x}}}} dx \] \end{document} the integral can benefit from being enlarged and moved up a small bit, even if it going to take it out of alignment with part of the formula.
- Output not generated TeXLive 2025 [closed]by GowriSaro on January 23, 2026 at 2:14 pm
I got the below error in TeXLive 2025: ! Undefined control sequence. \@makecol ...vbox \@kludgeins \@makespecialcolbox \else \setbox \@outputbox ... But the same file works well in TeXLive 2024 The .tex file was huge, so couldn't able to post. Please advise
- TikZ Feynman W loop with Z radiationby Beth Long on January 23, 2026 at 12:55 pm
I want to make the following diagram: But this: \documentclass[a4paper,12pt]{article} \usepackage[compat=1.1.0]{tikz-feynman} \usepackage{xcolor} \definecolor{uctgreen}{rgb}{0,0.45,0} \newcommand\uct[0]{{\color{uctgreen}{u}\color{red}{c}\color{blue}{t}}} \tikzfeynmanset{ every diagram={very thick}, } \begin{document} \resizebox{5cm}{5cm}{ \begin{tikzpicture}[yscale=0.7, xscale=1.4] \begin{feynman} % ~~~ defining the vertices ~~~~~~ \vertex (i1) ; \vertex[below right=of i1] (v1); \vertex[ right=of v1] (v2); \vertex[above right=of v2] (o1); % ~~~ Z-related ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \vertex at ($(v1)!.5!(v2) - (0,15mm)$) (v3); % middle, below \vertex[below=1cm of v3] (v4); % <<< Z "length" % ~~~ lower part ~~~~~~~~~~~~~~ \vertex[below left = 2cm of v4] (i2); % one way to modify \vertex[below right= 2cm of v4] (o2); % ~~~ drawing this diagram ~~~~~~~~~~~~~~~~~~~~~ \diagram*{ {[edges={fermion}](i1) --[edge label=s] (v1) --[edge label=\uct] (v2) --[edge label=d] (o1)}, (v1) --[photon, half right, edge label'=W] (v2), (v3) --[photon, edge label'=Z] (v4), {[edges={fermion}](i2) --[edge label'=$\nu$] (v4) --[edge label'=$\nu$] (o2)}, }; \end{feynman} \end{tikzpicture} } \end{document} produces this: How can I add labels to both sides of the W and make the W-Z vertex match up?
- longtable breaks page headers (marks) when using titleps – headers stop updating after subsectionsby Mikael Gonzalez on January 23, 2026 at 12:13 pm
I am experiencing a persistent issue with page headers when using longtable. Section and subsection titles normally appear correctly in the header, but as soon as a longtable is introduced, the header stops updating. All subsequent pages keep showing the previous header, even after new \subsection commands. This does not happen with figures or normal tables, only with longtable. Reordering content confirms the issue: if figures come before the longtable, headers are correct; if they come after, headers are broken. I understand that longtable interferes with marks, but I have not found a robust solution that works in practice. Note that this behavior appears only when longtable spills onto mutliple pages. \documentclass{article} \usepackage{geometry} \usepackage{fancyhdr} \usepackage{longtable} \usepackage{booktabs} \pagestyle{fancy} \fancyhf{} \fancyhead[L]{\small\scshape\rightmark} \fancyfoot[C]{\thepage} \renewcommand{\sectionmark}[1]{% \markright{\thesection\quad #1} } \renewcommand{\subsectionmark}[1]{% \markright{\thesubsection\quad #1} } \makeatletter \patchcmd{\LT@array}{\@mkboth{}{}}{}{}{} \makeatother \begin{document} \section{Test section} \subsection{First subsection} Some text. \newpage \subsection{Subsection before longtable} Some text. \newpage \subsection{Longtable here, header never shows up} \begin{longtable}{ll} \toprule A & B\\ \midrule \endfirsthead \toprule A & B\\ \midrule \endhead 1 & 2\\ 3 & 4\\ 5 & 6\\ 1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ 3 & 4\\ 5 & 6\\1 & 2\\ \bottomrule \end{longtable} \newpage \subsection{Header must update} This header updates. \end{document} With resulting issue: I have tried using with no success: % Page style \newpagestyle{main}{ \setheadrule{.55pt} \sethead{\small\scshape\rightmark}{}{} \setfoot{}{\thepage}{} } % Subsection marks \renewcommand{\subsectionmark}[1]{% \markright{\thesubsection\quad #1} } \usepackage{etoolbox} \renewcommand{\subsectionmark}[1]{% \markright{\thesubsection\quad #1}% } \makeatletter \patchcmd{\LT@array}{\@mkboth{}{}}{}{}{} \makeatother Expected behavior: The page header should update to the current subsection title after a longtable, exactly as it does after figures or standard tables. Question: Is there a robust and recommended way to use longtable without breaking page headers? Or is this a fundamental limitation of longtable and marks?
- How to fill between decoratedpath to draw a rope in physics? I don't want those gray areas to be seenby Anastasios on January 23, 2026 at 9:36 am
\documentclass[12pt,a4paper,twoside]{report} \usepackage[english,greek]{babel} \usepackage[iso-8859-7]{inputenc} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsxtra} \usepackage{mathtools} \usepackage{fix-cm} \usepackage{graphicx} \usepackage{braket} \usepackage{tikz} \usepackage{framed} \usepackage{mdframed} \usepackage{pgffor} \usepackage{xcolor} \usetikzlibrary{plotmarks} \usepackage{pgfplots} \usetikzlibrary{arrows,shapes,positioning} \colorlet{shadecolor}{gray!20} \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix} \usetikzlibrary{decorations.pathmorphing,patterns} \usetikzlibrary{calc,patterns,decorations.markings} \usetikzlibrary{positioning} \usepackage{tikz,tikz-3dplot} \usetikzlibrary{fadings} \usetikzlibrary{shapes.geometric} \usepackage[left=1cm, right=1.2cm, top=2.5cm, bottom=1.5cm, includefoot, headheight=14.5pt]{geometry} \begin{document} \begin{center}{\begin{tikzpicture} \tikzstyle{platform}=[fill,pattern=north east lines,draw=none,minimum width=4cm,minimum height=0.3cm] \shade[ball color=gray!20] (0,0) circle (1.5); \draw[thick,double](0,0) circle (1.5); \draw[decorate,decoration={markings, mark=between positions 1mm and \pgfdecoratedpathlength-1.5mm step 1.5mm with {\draw[thick,black,fill=white] (-2.5mm,-0.5mm) to[out=0,in=160] (-1.5mm,-0.5mm) to[out=-20,in=160] (1.5mm,0.5mm) to[out=-20,in=180] (2.5mm,0.5mm); }}] (0,0.75) -- (4,0.75); \draw[thick,double](0,0) circle (0.75); \node[circle,draw,black,scale=0.3,fill=white] (b) at (3.8,0.75) {}; \node at (3.8,1){A}; \shade[ball color=white] (0,0) circle (0.71); \draw[thick,white,-stealth'](0,0)--(1.05,-1.05)node[pos=0.8,above]{${\ R}$}; \draw[thick,-stealth'](0,0)--(-0.63,-0.33)node[pos=0.3,below]{${ r}$}; \node [platform,anchor=south] at (0,-1.85) {}; \draw[thick,-](-2,-1.55)--(2,-1.55); \node[circle,draw,black,scale=0.2,fill=white] (b) at (0,0) {}; \end{tikzpicture} }\end{center} \end{document}
- Is it possible simplify this lualatex code?by xcn on January 23, 2026 at 8:39 am
The following code is used to retrieve and round a variable defined via \directlua. Is it possible to remove the luaround function and replace {\IfValueTF{#1} {luaround(#2, #1)} {#2}} with something like {\IfValueTF{#1} {("%." .. #1 .. "f"):format(#2)} {#2}}? \documentclass[12pt]{article} \usepackage{luacode} \begin{luacode*} function luaround(x, n) return string.format('%.' .. n .. 'f', x ) end \end{luacode*} \NewExpandableDocumentCommand{\usevar}{om}{% \directlua{tex.sprint(% {\IfValueTF{#1} {luaround(#2, #1)} {#2} } % IfValueTF )} } \begin{document} \directlua{ x=0.345 y=2 } \usevar[2]{x} \end{document}
- Making messy notes with LaTeXby Edward Doolittle on January 23, 2026 at 2:57 am
There is a lot of information on how to make beautiful documents with LaTeX. However, I am thinking about setting up a note taking workflow and I purposely want to make things look messy. I suppose what I want to signal is that rough notes look messy, and that as I develop ideas into papers, as the narrative and reasoning get stronger and better, I can improve the aesthetics, so that beautiful content looks beautiful and rough content looks rough. What sort of settings do you all recommend for messy LaTeX output? I'm thinking bad line breaks, bad page breaks, ragged margins, poor or perhaps just thoughtless placement of floats, different fonts/colours for different environments (and even random switches in font/colour, within certain parameters ... the notes should still be readable, of course). I would like to mimic a "messy aesthetic" for note taking, which is easy enough to do with pen and paper. Marginal notes rotated. I'm sure there are hundreds of possibilities. It might be an interesting project to think of a spectrum, most messy look for most messy thinking, through some mid-range mess for improved thinking, eventually to most beautiful for most well-thought out and correct thinking. I plan to use Emacs org-mode or org-roam (which is already well on its way in the mess category 🙂 ) with export to LaTeX and then to PDF. But I also use pure LaTeX regularly. Edit: for an idea of what I'm looking for, here are a couple of Pinterest boards. https://www.pinterest.com/ideas/messy-school-notes-aesthetic/895918930715/ https://in.pinterest.com/search/pins/?q=notes%20messy%20aesthetic&rs=typed Note that all the examples are with physical pen and paper; I would like to simulate such a thing with LaTeX -> PDF.
- Converting a LaTeX package to MathJax [closed]by karlh on January 23, 2026 at 1:11 am
I know that MathJax is a not-entirely-faithful subset of TeX, and that converting packages from LaTeX to MathJax is non-trivial and involves JavaScript. The MathJax documentation does exist, but it is difficult to parse for someone not immersed in it (which is common). It is also not obvious what one needs to do to implement a particular TeX macro so it works in MathJax. Can anyone recommend a "walk-through," example, or good description of how to translate a LaTeX package into a MathJax extension?
- hyperref + algorithm2e + zref-clever = 🐛: referencing an algorithm and a line in it produces the same type name for both 😢by Mark McGregor on January 22, 2026 at 7:11 pm
We try to reference a line in a shy algorithm and the algorithm itself with zref-clever. Running pdflatex twice on \documentclass{article} \pagestyle{empty} \usepackage{hyperref} \usepackage{algorithm2e} \usepackage{zref-clever} \zcRefTypeSetup{algocf}{ name-sg=Alg.\@, Name-sg=Alg.\@ } \zcRefTypeSetup{AlgoLine}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{algocfline}{ Name-sg=line, name-sg=line } \zcRefTypeSetup{line}{ Name-sg=line, name-sg=line } \begin{document} \begin{algorithm}\LinesNumbered \caption{My great algorithm}\label{algLabel} \KwOut{The oh so great output of my great algorithm} command1\; command2\nllabel{lineLabel}\; command3 \end{algorithm} \zcref[S]{algLabel} contains \zcref{lineLabel}. \end{document} yields As we see, the second type name is “Alg.”, whereas we'd expect “line”. If we comment out hyperref, we get “Alg. 1 contains line 2.” as expected. So far we failed to get different type names for the two references in the presence of hyperref, so you can blame it. At the same time, given that algorithm2e has been unmaintained for about 8½ years and zref-clever for slightly over 1 year, you can blame them, too. Anyway, what is the technical root cause of the failure? Any bugfix, patch, or workaround?
- Unexpected tabular vertical alignmentby itobito on January 22, 2026 at 4:52 pm
I'm having a difficult time understanding the vertical alignment of columns of tables created via tabular. My Code \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{ | p{2.5cm} | m{2.5cm}| b{2.5cm} | } \hline cell1 dummy text dummy text dummy text& cell2 & cell3 \\ \hline cell4 & cell5 dummy text dummy text dummy text & cell6 \\ \hline cell7 & cell8 & cell9 dummy text dummy text dummy text\\ \hline \end{tabular} \end{document} This example is pretty much taken directly from the Overleaf Tables documentation, with the difference being the varying column alignments. I'd expect the code above to produce Expected table with the text in the first column top-aligned, the text in the second column middle-aligned, and the text in the third column bottom-aligned. However, the code above actually produces Actual table I know it's possible (and easier) with the tabularray package, but I'd like to understand why. Why do my actual table's columns have seemingly incorrect vertical alignments?
- Plotting a rational function in tikzby mf67 on January 21, 2026 at 9:17 pm
I'm trying to plot a rational function, but I constantly get dimensions too large, even if the plot frame is within the page and the function is within limits. \documentclass{book} \usepackage{pgf,tikz,pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{tikzpicture}[declare function={r(\x)=(-\x*\x*\x*\x+600*\x*\x*\x-135000*\x*\x+10125000*\x)/(2109375*(30000-200*\x));}] \begin{axis}[ x=0.05cm,y=1cm, xmin=0, xmax=160, ymin=0, ymax=1, xlabel={\(x\)}, ylabel={\(y\)} ] \draw[domain=0:160,smooth,samples=100] plot ({\x},{r(\x)}); \end{axis} \end{tikzpicture} \end{document} What could be wrong? TIA. This is how the graph looks in Mathematica
- Include a pdf image 4"x4" on book front cover using \bookcovercomponentby josh on January 21, 2026 at 7:15 pm
I am designing a book cover using bookcover documentclass and would like to add a 4"x4" pdf graphics file in the center of the cover. The cover format is: Title at top, Edition, the graphics image, author name. I've tried using tikzpicture to insert the pdf (lines commented below) but receive lots of error messages was wondering if someone could help me? Here is my code so far: \documentclass[12pt, coverwidth=9.444in, coverheight=12.5in, bleedwidth=17mm, foldingmargin=false, markthick=0.0pt, marklength=7mm,% Markierungen: for printing: set to 0mm spinewidth=20mm, %pagecolor=Beige, trimmed=false% trimmed=false for printing ]{bookcover} \usepackage[cmintegrals,cmbraces]{newtxmath} \usepackage{ebgaramond-maths} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{bbding} \usepackage[x11names,dvipsnames,svgnames]{xcolor} \usepackage[ngerman]{babel} % \usepackage{tikz} % It is loaded by bookcover % \usepackage{calc} % It is loaded by bookcover \usepackage{microtype} \setlength{\marklength}{0pt} \geometry{% paperwidth=\coverwidth, paperheight=\coverheight, left=-\bleedwidth-\coverwidth-\spinewidth, top=-\bleedwidth, } \begin{document} \begin{bookcover} \bookcovercomponent{color}{bg whole}{ % Use "bg whole" instead of "whole page" top color=LightBlue, bottom color=LightBlue} % % Title % \bookcovercomponent{normal}{front}[55mm,10mm,10mm,30mm]{ {\fontsize{48}{48}\selectfont \bfseries This is the title of } } \bookcovercomponent{normal}{front}[55mm,10mm,10mm,50mm]{ {\fontsize{48}{48}\selectfont \bfseries the book on multiple } } \bookcovercomponent{normal}{front}[55mm,10mm,10mm,70mm]{ {\fontsize{48}{48}\selectfont \bfseries lines } } % % Edition % \bookcovercomponent{normal}{front}[100mm,10mm,10mm,90mm]{ {\fontsize{30}{30}\selectfont \bfseries First Edition } } % % place 4"x4" graphics image here % %\bookcovercomponent{normal}{front}{ % \begin{tikzpicture} % % Center of the panel is (\width/2, \height/2) % \node[anchor=center] at ({\width/2},{\height/2}) { % \includegraphics[width=0.8\width]{aBookFrontCoverGraphics.pdf} % }; % \end{tikzpicture} %} % % Author's name % \bookcovercomponent{normal}{front}[100mm,10mm,10mm,280mm]{ {\fontsize{24}{24}\selectfont \bfseries Author's Name } } % % spine % \bookcovercomponent{normal}{spine}[2mm,2mm,2mm,2mm]{% \vspace*{30mm}\centering\rotatebox{90}{\huge\textcolor{NavyBlue}{Authors Name} \qquad Title}} % % back cover % \bookcovercomponent{normal}{back}[15mm,10mm,15mm,10mm]{Some back cover text...} \end{bookcover} \end{document}