Hot
- Wrapping a circle on a torusby M. Al Jumaily on February 1, 2026 at 4:19 am
I have used the sample code from latexdraw that draws a torus. I am trying to draw a filled circle and a dashed circle where they should be wrap around the torus instead of being drawn uniformly at z=0. I am looking for a TikZ solution. The closest I have seen is this solution but it is too difficult for me to decipher. Any help would be appreciated! \documentclass[margin=4pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepackage{tikz-3dplot} \usepgfplotslibrary{colormaps} \pgfplotsset{ compat=newest, colormap={manifoldmap}{color=(lightgray) color=(white) color=(lightgray)} } \begin{document} \begin{tikzpicture} \def\R{2.75} % Major radius (distance from torus centre to tube centre) \def\offset{0.5} % Radial displacement from the torus centre circle \def\thetaB{2.5} % Angular position (in radians) for highlighted point \begin{axis}[ width=12cm, axis equal image, hide axis, z buffer=sort, view={125}{35}, clip=false ] % Parametric torus equations: % x = (R + cos(x)) cos(y) % y = (R + cos(x)) sin(y) % z = sin(x) \addplot3[ surf, shader = faceted interp, samples = 30, samples y = 40, domain = 0:2*pi, domain y = 0:2*pi, colormap name = manifoldmap, thin, opacity=0.75 ] ( {(\R + cos(deg(x))) * cos(deg(y))}, {(\R + cos(deg(x))) * sin(deg(y))}, {sin(deg(x))} ); \begin{scope}[canvas is xy plane at z=0, transform shape] \coordinate (p) at ({(\R + \offset) * cos(deg(\thetaB))}, {(\R + \offset) * sin(deg(\thetaB))}); \draw[fill=red, draw=none] (p) circle (4pt); \draw[blue, dashed, thick] (p) circle (16pt); \end{scope} \end{axis} \end{tikzpicture} \end{document}
- parskip after opening in scrlttr2by user1 on January 31, 2026 at 8:41 pm
Using the parskip=half option, scrlttr2 still sets a full parskip after the opening. I feel that this is not intended and also not appealing. Is there a way to only get a half skip? I did not find anything like \setplength{openingaftervskip}{0.5\baselineskip} \documentclass{scrlttr2} \KOMAoptions{addrfield=false, parskip=half} \begin{document} \setkomavar{subject}{subject} \begin{letter}{} \opening{Dear} text text text \end{letter} \end{document}
- How to draw a figure (horizontal and diagonal ines) with numbers / variables within (easy)by Justin Eaves on January 31, 2026 at 6:56 pm
I am looking to draw diagrams similar to this many times over the course of a document, and fill in all (6) of the negative spaces (top, bottom, top left, top right, bottom left, bottom right). The numbers in each diagram will vary. The center of the diagram need not be hollow as in the photo below, that was just sloppy line drawing. Just an "X" with a horizontal line through it, and a way to add numbers in each negative space. I'm sure this is easy, but I have zero experience with tikz. Anyone have an easy solution? Thanks in advance!
- Why does this pdf figure crash lualatex?by Ian Thompson on January 31, 2026 at 4:01 pm
I have an old workflow that uses LaTeX itself to process diagrams and plots. I've used this generate hundreds of figures over the years. This has suddenly started producing invalid pdf figure files: they won't open in Acrobat (though they do open in SumatraPDF); including them in a document causes luatex to output several warning messages (invalid compressed object) and a corrupt final file. Strangely, they do seem to work with pdftex. Compiling this document with lualatex is enough to trigger the problem on my machine. \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[width=\textwidth]{embed.pdf} \end{document} Here is embed.pdf The figure was initially generated by gnuplot, using the following: set term postscript eps mono set output "fig.eps" plot x**2 title "AAA" I then created a version with a Greek letter by compiling this document (embed.tex) using latex+dvips \documentclass{article} \usepackage{graphicx} \usepackage{psfrag} \pagestyle{empty} \begin{document} \psfrag{AAA}{\(\alpha\)} \includegraphics{fig.eps} \end{document} Finally, I did ps2eps --ignoreBB embed.ps epstopdf embed.eps to create the pdf figure. Converting embed.eps to pdf using cloudconvert.com does seem to work, so I think the problem is caused by either epstopdf or ghostscript. What's going on here? I think this old question is probably related, but there is no example pdf file so it's impossible to be sure. EDIT It seems increasingly likely that something is going wrong at the very last step (eps2pdf conversion). Here is the eps file that is being converted: embed.eps. What's not clear is whether the issue is limited to my own machine (running texlive 2025 under cygwin).
- \bm makes \dot and \hat of capital letters A-F reset the whole letter to \Gammaby Ishan Singh on January 31, 2026 at 2:56 pm
When using \bm, I can't use \dot and \hat on uppercases A-F (lowercases and the rest of the alphabet are fine), and it instead writes the Gamma character, along with an error message the the value input to \bm was to high. \documentclass{article} \usepackage{amsmath} \usepackage{bm} %this is just the layout of the "table" \newcommand{\layer}[2]{&&\dot #1&&\hat #1&&\widehat #1&&&\dot #2&&\hat #2&&\widehat #2\\&\bm{#1}&&\bm{\dot #1}&&\bm{\hat #1}&&\bm{\widehat #1}&&\bm{#2}&&\bm{\dot #2}&&\bm{\hat #2}&&\bm{\widehat #2}\\} \begin{document} \begin{equation} \begin{aligned} \layer{a}{A}\\ \layer{b}{B}\\ \layer{c}{C}\\ \layer{d}{D}\\ \layer{e}{E}\\ \layer{f}{F}\\ \layer{g}{G} \end{aligned} \end{equation} \end{document} And the console says \layer{a}{A} \\ A mathchar number must be between 0 and 32767. I changed this one to zero. and similar for the other letters B-F.
- Accent placement issues with STIX2 Math: \hat and \tilde too close on uppercase lettersby Dorian on January 31, 2026 at 2:47 pm
I am using the classicthesis style for the document layout and STIX2 Math as the math font, and I am encountering systematic issues with the placement of math accents, in particular \hat and \tilde. The problem is most visible on uppercase Latin and Greek letters, where the accents appear: too close vertically to the glyph, sometimes horizontally misaligned, while lowercase letters look mostly acceptable. This is especially problematic in physics notation (e.g. \hat{H}, \hat{A}, \tilde{U}, etc.), where accented uppercase symbols are common and should be visually well balanced. Is there a clean solution to fix these placement issues? Thank you in advance ! MD Code \documentclass[10pt]{article} \usepackage{classicthesis} \usepackage{amsmath} \usepackage[notext]{stix2} \begin{document} \begin{align*} \hat{a} & \hat{A} & \hat{b} & \hat{B} &\hat{c} & \hat{C} & \hat{d} & \hat{D} & \hat{e} & \hat{E} & \hat{f} & \hat{F} & \hat{g} & \hat{G} & \hat{h} & \hat{H} & \hat{\imath} & \hat{I} &\hat{\jmath} & \hat{J} &\hat{k} & \hat{K} & \hat{l} & \hat{L} &\hat{m} & \hat{M} \\ \hat{n} & \hat{N} & \hat{o} & \hat{O} &\hat{p} & \hat{P} & \hat{q} & \hat{Q} & \hat{r} & \hat{R} & \hat{s} & \hat{S} & \hat{t} & \hat{T} & \hat{u} & \hat{U} &\hat{v} & \hat{V} &\hat{w} & \hat{W} & \hat{x} & \hat{X} &\hat{y} & \hat{Y} & \hat{z} & \hat{Z} \\ \hat{\alpha} & \hat{A} & \hat{\beta} & \hat{B} & \hat{\gamma} & \hat{\Gamma} & \hat{\delta} & \hat{\Delta} & \hat{\epsilon} & \hat{E} & \hat{\zeta} & \hat{Z} & \hat{\eta} & \hat{H} & \hat{\theta} & \hat{\Theta} & \hat{\iota} & \hat{I} & \hat{\kappa} & \hat{K} & \hat{\lambda} & \hat{\Lambda} & \hat{\mu} & \hat{M} & \hat{\nu} & \hat{N} \\ \hat{\xi} & \hat{\Xi} & \hat{\pi} & \hat{\Pi} & \hat{\rho} & \hat{P} & \hat{\sigma} & \hat{\Sigma} & \hat{\tau} & \hat{T} & \hat{\upsilon} & \hat{\Upsilon} & \hat{\phi} & \hat{\Phi} & \hat{\chi} & \hat{X} & \hat{\psi} & \hat{\Psi} & \hat{\omega} & \hat{\Omega} & \hat{1} & \hat{\mathbf{1}} \end{align*} \begin{align*} \tilde{a} & \tilde{A} & \tilde{b} & \tilde{B} &\tilde{c} & \tilde{C} & \tilde{d} & \tilde{D} & \tilde{e} & \tilde{E} & \tilde{f} & \tilde{F} & \tilde{g} & \tilde{G} & \tilde{h} & \tilde{H} & \tilde{\imath} & \tilde{I} &\tilde{\jmath} & \tilde{J} &\tilde{k} & \tilde{K} & \tilde{l} & \tilde{L} &\tilde{m} & \tilde{M} \\ \tilde{n} & \tilde{N} & \tilde{o} & \tilde{O} &\tilde{p} & \tilde{P} & \tilde{q} & \tilde{Q} & \tilde{r} & \tilde{R} & \tilde{s} & \tilde{S} & \tilde{t} & \tilde{T} & \tilde{u} & \tilde{U} &\tilde{v} & \tilde{V} &\tilde{w} & \tilde{W} & \tilde{x} & \tilde{X} &\tilde{y} & \tilde{Y} & \tilde{z} & \tilde{Z} \\ \tilde{\alpha} & \tilde{A} & \tilde{\beta} & \tilde{B} & \tilde{\gamma} & \tilde{\Gamma} & \tilde{\delta} & \tilde{\Delta} & \tilde{\epsilon} & \tilde{E} & \tilde{\zeta} & \tilde{Z} & \tilde{\eta} & \tilde{H} & \tilde{\theta} & \tilde{\Theta} & \tilde{\iota} & \tilde{I} & \tilde{\kappa} & \tilde{K} & \tilde{\lambda} & \tilde{\Lambda} & \tilde{\mu} & \tilde{M} & \tilde{\nu} & \tilde{N} \\ \tilde{\xi} & \tilde{\Xi} & \tilde{\pi} & \tilde{\Pi} & \tilde{\rho} & \tilde{P} & \tilde{\sigma} & \tilde{\Sigma} & \tilde{\tau} & \tilde{T} & \tilde{\upsilon} & \tilde{\Upsilon} & \tilde{\phi} & \tilde{\Phi} & \tilde{\chi} & \tilde{X} & \tilde{\psi} & \tilde{\Psi} & \tilde{\omega} & \tilde{\Omega} \end{align*} \end{document}
- Putting two flowcharts on the same page side by side in Latexby Destr on January 31, 2026 at 12:27 pm
So i have the following code in latex and i'm trying to put these two flowcharts side by side, for some reason i cant do that and instead one is on top of the other , i can't understand what i do wrong. Below is the code and here is the resulting image https://i.sstatic.net/kHcPDRb8.png \documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{arrows.meta, positioning, calc} \usepackage{xcolor} \usepackage{graphicx} \usetikzlibrary{shapes.geometric, arrows.meta, positioning,calc} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{figure}[ht] \centering % ================= LEFT DIAGRAM ================= \begin{minipage}[t]{0.30\textwidth} \centering \begin{tikzpicture}[ scale=0.75, transform shape, node distance=1cm, every node/.style={font=\scriptsize}, block/.style={rectangle, draw, rounded corners, minimum width=2.6cm, minimum height=0.7cm, align=center}, adder/.style={circle, draw, minimum size=0.45cm, inner sep=0pt}, arrow/.style={->, thick} ] \tikzset{ inputoutput/.style={block, fill=cyan!40}, linear/.style={block, fill=green!40}, mixup/.style={block, fill=BrickRed!40}, penc/.style={block, fill=purple!40}, cmamba/.style={block, fill=red!40}, rms/.style={block, fill=yellow!40} } \node[inputoutput] (input) {Input}; \node[mixup, above=of input] (mixup) {Channel Mixup}; \node[linear, above=of mixup] (lin1) {Linear}; \node[penc, above=of lin1] (penc) {Positional Encoding}; \node[adder, above=of penc] (add) {$+$}; \node[cmamba, above=of add] (cmamba) {CMamba}; \node[rms, above=of cmamba] (rms) {RMS Norm}; \node[linear, above=of rms] (lin2) {Linear}; \node[inputoutput, above=of lin2] (output) {Output}; \draw[arrow] (input) -- (mixup); \draw[arrow] (mixup) -- (lin1); \draw[arrow] (lin1) -- (penc); \draw[arrow] (penc) -- (add); \draw[arrow] (add) -- (cmamba); \draw[arrow] (cmamba) -- (rms); \draw[arrow] (rms) -- (lin2); \draw[arrow] (lin2) -- (output); \draw[arrow] (input.east) -- ++(1.2,0) |- (add.east); \end{tikzpicture} \caption*{(a) Overall Architecture} \end{minipage} \hfill % ================= RIGHT DIAGRAM ================= \begin{minipage}[t]{0.30\textwidth} \centering \begin{tikzpicture}[ scale=0.7, transform shape, node distance=0.45cm, every node/.style={font=\scriptsize}, block/.style={rectangle, draw, rounded corners, minimum width=3.2cm, minimum height=0.7cm, align=center}, mult/.style={circle, draw, minimum size=0.45cm, inner sep=0pt}, arrow/.style={->, thick} ] \node[block, fill=green!40] (linL) {Linear}; \node[block, fill=RoyalBlue!40, above=of linL] (conv) {Conv1D}; \node[block, fill=magenta!40, above=of conv] (siluL) {SiLU}; \node[block, fill=red!40, above=of siluL] (ssm) {SSM}; \node[block, fill=green!40, right=0.8cm of linL] (linR) {Linear}; \node[block, fill=magenta!40, above=of linR] (siluR) {SiLU}; \node[mult] (mult) at ($(ssm.north)!0.5!(siluR.north) + (0,2cm)$) {$\times$}; \draw[arrow] (linL) -- (conv); \draw[arrow] (conv) -- (siluL); \draw[arrow] (siluL) -- (ssm); \draw[arrow] (linR) -- (siluR); \draw[arrow] (ssm.north) |- (mult.west); \draw[arrow] (siluR.north) |- (mult.east); \node[block, fill=yellow!40, above=0.4cm of mult] (rms2) {RMS Norm}; \draw[arrow] (mult) -- (rms2); \end{tikzpicture} \caption*{(b) CMamba Block (Expanded)} \end{minipage} \caption{Overview of the model architecture and the internal structure of the CMamba block.} \label{fig:cmamba_combined} \end{figure} \end{document}
- The choice between pdflatex and xelatex, and the use of newcomputermodernby Ho Man-Ho on January 31, 2026 at 9:07 am
It is kind of a short and soft question. Let me provide some background for my question: I am compiling a latex project, which involves a main tex file and more than 100 other tex files with no figures (except for a few simple diagrams) or pictures. The resulting pdf file has more than 600 pages. Initially, I was using pdflatex and newtxtext for font, and to save time for compilation, I put a % for the tex files whenever I am not typing or editing them. However, recently I am more inclined to use NewComputerModern, in particular I like the slightly thicker font. As we know, to use NewComputerModern, we must either use xelatex or lulatex. I chose the former because it seems to be slightly faster than using lulatex, but it is slower than pdflatex. So I ended up spending more time for compliation, especially when I am editing the tex files for the pages of the end of the pdf file. The packages I am using are: amsfonts, amsmath, amscd, amssymb, euscript, amsthm, fancyhdr, pgf, tikz, pgfplots, caption, subcaption, enumitem, thmtools, color, centernot, mathtools, afterpage, amsbsy, systeme, sectsty, multirow, float, tikz-cd, etoolbox, microtype, mathrsfs, fontspec, fncychap, xy, appendix My question is: is there any get around for this problem? I want to minimize the time for compilation while keep looking at NewComputerModern rather than newtxtext. I considered using pdflatex and newtxtext during editing, and xelatex and NewComputerModern right before finish editing. But I think we should be able to do better than this.
- Is the use of boxes (un)limited? Using boxes instead of an outfileby MBE on January 31, 2026 at 8:38 am
In this file, I use boxes instead of an outfile. \FOXNum=1 %startbox defines the number of the first box, \lastFOXNum=10 defines the last box. The values are optional.(1-10,20-50,1000-4000). \newcount\sections \def\section#1{\vskip\baselineskip\advance\sections by 1{\bf \the\sections \hskip10pt #1}\vskip\baselineskip} \newcount\subsections \def\subsection#1{\vskip\baselineskip\advance\subsections by 1{\bf \the\sections.\the\subsections \hskip10pt #1}\vskip\baselineskip} \font\tinyfont=cmr5 \newcount\start \newcount\maxFOXnum \newcount\lastFOXNum \newcount\FOXNum \FOXNum=1 %startbox \maxFOXnum=\FOXNum \lastFOXNum=10 \newcount\internalNum \def\FOXName#1{\advance\internalNum by 1 \setbox\the\FOXNum\hbox to \hsize{ \the\sections.\the\subsections \hskip10pt F\the\internalNum. #1 \hfill \the\pageno}\advance\FOXNum by 1} \def\FOXnotes#1{ \start=\maxFOXnum \advance\lastFOXNum by 1 \vskip4\baselineskip\hrule \vskip\baselineskip #1 \vskip\baselineskip \loop \ifnum\start<\the\lastFOXNum \box\the\start %\vskip0.5\baselineskip \advance\start by 1 \repeat \start=\FOXNum} \section{FOX}``Good morning\FOXName{I just came by.}'', said the FOX. ''I never thought to be here with you.\FOXName{Glad if you could stay with me.}'' \subsection{Rabbit} ``Nice to have you'' said the RABBIT, ``We all hope the best.''\FOXName{No use to be worried, I just had my breakfast.} \FOXnotes{FOXnotes} \bye
- How may I replace the name(s) of definition(s)?by MBE on January 31, 2026 at 8:12 am
In this example, notes are defined. Here as "FOXName{xy}". By replacing FOX with another word,I can define as many note-routines as I like, f.e "RABBITName{xy}" How may I do this inside a definition? P.S. (I am using boxes instead of an outfile, this will be subject for another question). \newcount\sections \def\section#1{\vskip\baselineskip\advance\sections by 1{\bf \the\sections \hskip10pt #1}\vskip\baselineskip} \newcount\subsections \def\subsection#1{\vskip\baselineskip\advance\subsections by 1{\bf \the\sections.\the\subsections \hskip10pt #1}\vskip\baselineskip} \font\tinyfont=cmr5 \newcount\start \newcount\maxFOXnum \newcount\lastFOXNum \newcount\FOXNum \FOXNum=1 %startbox \maxFOXnum=\FOXNum \lastFOXNum=10 \newcount\internalNum \def\FOXName#1{\advance\internalNum by 1 \setbox\the\FOXNum\hbox to \hsize{ \the\sections.\the\subsections \hskip10pt F\the\internalNum. #1 \hfill \the\pageno}\advance\FOXNum by 1} \def\FOXnotes#1{ \start=\maxFOXnum \advance\lastFOXNum by 1 \vskip4\baselineskip\hrule \vskip\baselineskip #1 \vskip\baselineskip \loop \ifnum\start<\the\lastFOXNum \box\the\start %\vskip0.5\baselineskip \advance\start by 1 \repeat \start=\FOXNum} \section{FOX}``Good morning\FOXName{I just came by.}'', said the FOX. ''I never thought to be here with you.\FOXName{Glad if you could stay with me.}'' \subsection{Rabbit} ``Nice to have you'' said the RABBIT, ``We all hope the best.''\FOXName{No use to be worried, I just had my breakfast.} \FOXnotes{FOXnotes} \bye
- Best practice for structuring a long thesis with \inputby palloc on January 31, 2026 at 8:11 am
I am about to start writing my thesis, which will be a fairly long document. I would like to organize the project in a clean and maintainable way using. This is what I came up with, is it good, or is there a better way? main.tex \documentclass{report} \usepackage{geometry} \usepackage{lipsum} \usepackage[backend=biber,style=ieee]{biblatex} \addbibresource{bib.bib} \usepackage[colorlinks]{hyperref} \begin{document} \input{titlepage/titlepage} \tableofcontents \input{1.a/a} \input{2.b/b} \printbibliography[heading=bibintoc] \listoffigures \addcontentsline{toc}{chapter}{List of Figures} \listoftables \addcontentsline{toc}{chapter}{List of Tables} \appendix \input{appendix/appendixA} \input{appendix/appendixB} \end{document} titlepage.tex \lipsum[1-2] a.tex \chapter{First} \input{1.a/a1} \input{1.a/a2} a1.tex \section{section} \cite{knuth1984texbook} \begin{figure} \caption{fig} \end{figure} \begin{table}[] \caption{tab} \end{table} \lipsum[1-2] a2.tex \section{section} \lipsum[1-2] b.tex \chapter{Second} \input{2.b/b1} \input{2.b/b2} b1.tex \section{section} \lipsum[1-2] b2.tex \section{section} \lipsum[1-2] appendixA.tex \chapter*{Appendix A} \addcontentsline{toc}{chapter}{Appendix A} \lipsum[1-2] appendixB.tex \chapter*{Appendix B} \addcontentsline{toc}{chapter}{Appendix B} \lipsum[1-2] bib.bib @book{knuth1984texbook, title={The texbook}, author={Knuth, Donald Ervin and Bibby, Duane}, volume={15}, year={1984}, publisher={Addison-Wesley Reading} }
- How to get rid of the double quotation mark produced by `\string\eta`?by YCH817 on January 31, 2026 at 7:20 am
Trying to implementing this : \RegistVarType{obj}BG{pink}Font{\sf} will produce a command named \obj, \obj c will display a "c" in \sf font with pink background color; also, \RegistVarType{ntf}BG{LightBlue}Font{} will produce a command named \ntf, \ntf \eta will display a "\eta" with LightBlue background color. \RegistVarFreqType{obj}Disp{c}ppppp.... will produce a series of command, \objcp will produce c', \objcpp will produce c'', \objcpn1 will produce c'_1, \objcpppn2 will produce c'''_2 , ... ; However I am stuck at dealing with \RegistVarFreqType{ntf}Disp{\eta}pppp..... : my idea is to use \string command to get rid of the backslash and obtain eta , but the \string\eta will produce something like “eta thing . How to get rid of the double quotation mark ? Here is my implementation : \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{mathtools} \usepackage[ dvipsnames, svgnames, table ]{xcolor} \begin{document} \let\xpndaft=\expandafter \let\ncm=\newcommand \let\rcm=\renewcommand % ----- \let\ph=\phantom \let\hph=\hphantom \let\vph=\vphantom \let\mrel=\mathrel \let\mbin=\mathbin \let\mop=\mathop \let\mllap=\mathllap % \let\mrlap=\mathrlap % \let\mclap=\mathclap % \def\vts#1{\lvert#1\rvert} \def\prs#1{\left(#1\right)} \def\bcs#1{\left\{#1\right\}} \def\bks#1{\left[#1\right]} \def\plr#1{\vph{(fg)}\smash{#1}} % pillar \def\etc{\plr{\rm etc}} % stands for "..." \def\occ{\plr{\tt\_}} % \makeatletter \def\RegistVarType#1BG#2Font#3{ \colorlet{color#1}{#2} \xpndaft\newif\csname ifColorVarType#1\endcsname % check whether the highlighting is enable \xpndaft\def\csname #1\endcsname##1{% \setlength{\fboxsep}{0pt}% \setlength{\fboxrule}{0pt}% \let\RegistVarTypeCache=\relax \csname ifColorVarType#1\endcsname{% \gdef\RegistVarTypeCache{\colorbox{color#1}}% }\else{% \gdef\RegistVarTypeCache{\fbox}% }\fi% \RegistVarTypeCache{\ensuremath{\plr{#3 ##1}}}% } \csname ColorVarType#1true\endcsname % enable the highlighting in default } \makeatletter \def\RegistVarFreqType#1Disp#2{% \xpndaft\def\csname #1#2\endcsname{% \csname #1\endcsname{{#2}^{}}% } \xpndaft\def\csname #1#2n\endcsname##1{% \csname #1\endcsname{{#2}_{##1}^{}}% } \@ifnextchar p {\RegistVarFreqType@Loop{#1}{#2}{p}{'}} {\relax} } \def\RegistVarFreqType@Loop#1#2#3#4p{% \xpndaft\def\csname #1#2#3\endcsname{% \csname #1\endcsname{{#2}{#4}}% } \xpndaft\def\csname #1#2#3n\endcsname##1{% \csname #1\endcsname{{#2}_{##1}{#4}}% } \@ifnextchar p {\RegistVarFreqType@Loop{#1}{#2}{#3p}{#4'}} {\relax} } \makeatother \RegistVarType{obj}BG{pink}Font{\sf} % create command \obj \RegistVarType{ntf}BG{LightBlue}Font{} % create command \ntf \RegistVarFreqType{obj}Disp{c}ppppp \RegistVarFreqType{ntf}Disp{η}ppppp $\objc$ , $\objcpp$ , $\objcppp$ , $\objcppppp$ , $\objcppn1$ , $\objcpn2$ \end{document}
- How to check if pdfmanagement tools are loaded are not in *a stable way*?by Niranjan on January 31, 2026 at 5:24 am
Of course, one can check \IfPackageLoadedTF{pdfmanagement-testphase}{true}{false}, but since the name has testphase, I assume that some day it will go. If I use this test in a package, some day it will produce the exact opposite result as the package pdfmanagement-testphase will not be loaded despite having used \DocumentMetadata. So I was thinking if something more stable can be used as a test? I understand that most of the stuff is experimental and can be expected to change, but if there is something in the current code that is planned to be sustained during the development, I would like to build my test around it. Is there a way to check if \DocumentMetadata was used?
- math environment affect variable scopeby xcn on January 31, 2026 at 1:53 am
The macro below is to define and calculate a series of variables. However, I found that the variable scope appears to be affected by the math environment. Is this caused by \fp_set_variable or by the macro definitions? \documentclass[12pt]{article} \usepackage{amsmath,siunitx} \sisetup{inter-unit-product =\cdot} \ExplSyntaxOn \seq_new:N \g__xcn_var_list_seq \seq_new:N \g__xcn_redefined_var_seq \NewDocumentCommand{\defvar}{m} { \xcn_var_def:n {#1} } \cs_new_protected:Npn \xcn_var_def:n { \__xcn_var_assign:Nn \__xcn_var_new:n } \cs_new_protected:Npn \__xcn_var_assign:Nn #1#2 { \keyval_parse:nnn { \msg_error:nnn { xcn/var } { missing-value } } { \cs_set:Npn \__xcn_tmp:nn ##1 ##2 { #1 {##1} \fp_set_variable:nn {##1} {##2} } \__xcn_tmp:nn } {#2} } \msg_new:nnnn { xcn/var } { missing-value } { Missing~value~for~variable~'#1' } { Every~variable~needs~to~be~assigned~a~value } \cs_new_protected:Npn \__xcn_var_new:n #1 { \seq_if_in:NnTF \g__xcn_var_list_seq {#1} { \seq_if_in:NnF \g__xcn_redefined_var_seq {#1} { \seq_gput_right:Nn \g__xcn_redefined_var_seq {#1} } } { \fp_new_variable:n {#1} \seq_gput_right:Nn \g__xcn_var_list_seq {#1} } } \NewExpandableDocumentCommand{\usevar}{O{15}m} { \fp_eval:n { round( #2 , #1 ) } } \ExplSyntaxOff \begin{document} \defvar{ q = 20 , L = 4.2 , M = q * L^2 / 8 } $M = ql^2 / 8 = \usevar{q} \times \usevar{L} ^2 / 8 = \usevar{M} \unit{\, kN\cdot m} \defvar{M = 100}\qquad M=\usevar{M} $ $ M=\usevar{M} $ % not updated \defvar{M = 90} $ M=\usevar{M} $ % updated \end{document}
- \usepackage{lua-visual-debug} yields errorby user2609605 on January 30, 2026 at 8:11 pm
I used lua-visual-debug before but now I have a good application. In the newest version it seems broken: \documentclass{article}%[a4paper,draft] \usepackage{lua-visual-debug} \begin{document} test \end{document} causes the following error: (/usr/local/texlive/2025/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debu g.sty (/usr/local/texlive/2025/texmf-dist/tex/generic/iftex/ifluatex.sty)...st/ tex/luatex/lua-visual-debug/lua-visual-debug-keys.lua:7: module 'luakeyval' not found: no field package.preload['luakeyval'] [kpse lua searcher] file not found: 'luakeyval' stack traceback: [C]: in function 'require' ...st/tex/luatex/lua-visual-debug/lua-visual-debug-keys.lua:7: in main chunk [C]: in function 'require' [\directlua]:1: in main chunk. l.29 } I am not sure whether I should ask for a fix or how to get access to the bug tracker... This happens with live texlive 2025. I think it worked some time before and it does work on a restored frozen version from 2024.
- Slanted document header (with tikz)by LeO on January 30, 2026 at 7:58 pm
I want to have the following document header but all I get is the following result I tried different approaches with tikz but all failed. My current MWE \documentclass[12pt]{article} \usepackage[margin=2.5cm]{geometry} % for margins on a A4paper \usepackage[tracking=true,factor=1100,stretch=10,shrink=10,babel,final]{microtype} % have some better layout for \usepackage{xcolor} \definecolor{PrimaryColor}{HTML}{012A4A} % alternate navy \definecolor{ComplColor}{HTML}{FFCC99} \usepackage{tabularx} \usepackage{array} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} % Header settings \newcommand{\HeaderHeight}{3.6cm} % approx 3-4cm band height \usepackage{datetime} \pagestyle{empty} \begin{document} % ===== Header band (inserted) ===== \begin{tikzpicture}[remember picture,overlay] % Blue section on the left \fill[PrimaryColor] (current page.north west) rectangle ($(current page.north west)+(0.40\paperwidth,-\HeaderHeight)$); % White slanted gap as trapezium node \node[ trapezium, fill=white, minimum width=0.02\paperwidth, minimum height=\HeaderHeight, trapezium left angle=90, trapezium right angle=90, % Adjust this for slant angle anchor=north west, inner sep=0pt, outer sep=0pt ] at ($(current page.north west)+(0.42\paperwidth,0)$) {ab}; % Complementary color on the right \fill[ComplColor] ($(current page.north west)+(0.42\paperwidth,-5mm)$) -- ($(current page.north west)+(0.42\paperwidth,-\HeaderHeight)$) -- ($(current page.north east)+(0,-\HeaderHeight)$) -- ($(current page.north east)+(0,-5mm)$) -- cycle; % The Centered Name \node[ text=white, align=center ] at ($(current page.north west)+(0.2*\paperwidth,-0.5*\HeaderHeight)$) {\Huge \parbox{0.40\paperwidth}{\centering my \\ long-name}}; \end{tikzpicture} \end{document} I tried as well with different node (cycle) approach but didn't work out. I also didn't find a solution with the tiny blue line at the end. Likewise, I would have expected that the math would get rid of it... The final result should be that the left box starts in the left corner and the right 5mm below and everything shift down. As an additional issue, I've recognized how to properly align the box on the left side because it should be somehow perceived as centered. In the final solution, I would like to place as well text into the right box. In the final result, it would be nice to have at least the right box with some sort of shadow. But this would be just the toppings of the ice 😉
- Mysterious bad boxes with tabularxby user2609605 on January 30, 2026 at 7:08 pm
The following is a MWE to be run with lualatex: \documentclass{article}%[a4paper,draft] \usepackage[margin=1cm]{geometry} \usepackage{lua-visual-debug} %\usepackage{array} \usepackage{tabularx} \usepackage{ragged2e} \begin{document} \noindent {\tiny \begin{tabularx}{\linewidth}{@{}>{\RaggedRight}X>{\centering\arraybackslash}p{40mm}}% ``\textcopyright{} THE PLUMBER COMPANY --- All rights reserved --- This document is the property of THE PLUMBER COMPANY\@. Its disclosure to \newline%\\ third parties and/or its reproduction are subject to the user right stipulated under the contract referred to in this document \newline%\\ If no user rights are stipulated under the contract referred to in this document it may not be communicated to third parties and/or \newline%\\ reproduced without the prior written authorization of THE PLUMBER COMPANY and its contents may not be disclosed.'' & \textcopyright{} THE PLUMBER COMPANY \newline%\\ All rights reserved \end{tabularx} } \RaggedRight THE PLUMBER COMPANY --- All rights reserved --- This document \end{document} Although i read the documentation of lua-visual-debug I am not so sure about the result. The result is as follows: combined with Underfull \hbox (badness 10000) in paragraph at lines 15--27 The warning refers to the tabularx. The problem in the table seems to be the small script because little squares occur after the line break in the first row. In the second row, 1st line I have another penalty at the beginning and even two at the end of the line. No idea how to eliminate this. What makes me prudent is that the ragged line after the tabular does show a penalty also, but no warning comes up. I cannot explain really. I would be happy to learn.
- Using radians in polaraxis environment (PGFplots)by humanoferth on January 30, 2026 at 6:28 pm
I've been trying to graph some polar functions using PGFplots and I've been refrencing this section of the manual: https://tikz.dev/pgfplots/libs-polar where in 5.10.2 it says that I should be using datacs=polarrad to convert to polar coordinates, but the graphs have come out wrong, so I've been using degrees to get accurate graphs, though I would rather be using radians. Any ideas of what I'm doing wrong / what I can do to fix it? I've put a couple of bare-bones examples of what I mean below. \documentclass{report} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{polar} \begin{document} \[\begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:360] {cos(x)}; \end{polaraxis} \end{tikzpicture} \begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:2*pi,data cs=polarrad] {cos(x)}; \end{polaraxis} \end{tikzpicture}\] \[\begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:360] {cos(x)*sin(x)}; \end{polaraxis} \end{tikzpicture} \begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:2*pi,data cs=polarrad] {cos(x)*sin(x)}; \end{polaraxis} \end{tikzpicture}\] \end{document} Also a bit of a side note, but is there an easy way to switch the axes from degrees to radians besides manually changing each one individually via the xticklabel command? Thanks!
- \NewTblrTableCommand, how to define it that will valid only locallyby Zarko on January 30, 2026 at 5:32 pm
In my document (textbook) I have lot of tables which can be divided into two groups regarding their layout. For layout of some rows in tables I define a command for their formatting for which I like to use in both groups, but in each group one parameter should be different as in the other group. This I try to solve on a way, that for one group I define command valid for one group, for the other group repat definition with slightly different parameters, but preserve the same name of command. To my pity, after first definition at another definition gives error: command is already defines regardless that each definition is done in closed group as you can se in the next (a bit silly, simplified) MWE: \documentclass[margin=3mm, preview]{standalone} \usepackage{xcolor} \usepackage{tabularray}% version 2025A or newer \begin{document} \begingroup \NewTblrTableCommand\subtitle[1]{% \SetCell[c=7]{l, bg=#1!10, font=\small\bfseries}% } \begin{tblr}{colspec = {*{7}{c}}, hlines, vlines} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \subtitle{cyan} subtitle & & & & & & \\ \end{tblr} \endgroup some test between tables \begingroup \NewTblrTableCommand\subtitle[1]{% \SetCell[c=4]{l, bg=#1!10, font=\small\bfseries}% } \begin{tblr}{colspec = {*{4}{c}}, hlines, vlines} 1 & 2 & 3 & 4 \\ \subtitle{teal} subtitle & & & \\ \end{tblr} \endgroup \end{document} Questions: is possible locally redefine first definition with something like \renewcommand? how to limit command definitions by use of the \NewTblrTableCommand that it will be valid just in one group? does my approach to definition of commands and their use wrong? So far I see a way only with defining new parameter in command definitions which would tackle differences between their use in different tables. However, I'm interested for more convenient solution (in each of table are many occurrences of use this commands and I preferer to have short commands as much is possible). If I force compilation of above MWE, I get the following useless result:
- Tikz size changeby Nick B on January 30, 2026 at 3:07 pm
With the help of AI I created the following: \documentclass{article} \usepackage[margin=1cm]{geometry} \usepackage{tikz} \usetikzlibrary{positioning} % Define colors extracted from the image \definecolor{headerblue}{RGB}{56, 84, 135} \definecolor{headerlight}{RGB}{218, 223, 232} \newcommand*{\Ex}[2]{ \begin{tikzpicture}[baseline=(label.base)] \node[boxstyle, fill=headerblue, text=white] (example) {Example #1\strut}; \node[boxstyle, fill=headerlight, text=black, right=0pt of example] (desc) {#2}; \draw[headerblue, thick] (example.north west) -- (desc.north east) -- (desc.south east) -- (example.south west) -- cycle; \end{tikzpicture} } \begin{document} \thispagestyle{empty} \begin{tikzpicture} % Define common style for the nodes \tikzset{ boxstyle/.style={ font=\sffamily\bfseries\Large, inner ysep=8pt, inner xsep=12pt, outer sep=0pt } } \node[boxstyle, fill=headerblue, text=white] (example) {Example 2\strut}; \node[boxstyle, fill=headerlight, text=black, right=0pt of example] (desc) {Two Distinct Linear Factors in the Denominator\strut}; \draw[headerblue, thick] (example.north west) -- (desc.north east) -- (desc.south east) -- (example.south west) -- cycle; \end{tikzpicture} \Ex{1}{I need some help} \end{document} I am trying use a newcommand so that I can type in the example number and the text without recopying the code. Here is what I have, which produces what I want but you can see that the color does not fill the box and also they are different heights. Any help is appreciated:
- How to tweak this inline chemical equation in a uniform framework?by Explorer on January 30, 2026 at 2:52 pm
What I want to typeset is something as below inline: Here below is my (ugly) attempt: \documentclass{article} \usepackage{lipsum} \usepackage{chemfig} \usepackage[version=4]{mhchem} \usepackage{extarrows} % https://tex.stackexchange.com/a/267541/322482 \makeatletter \DeclareRobustCommand{\textsupsub}[2]{{% \m@th\ensuremath{% ^{\mbox{\fontsize\sf@size\z@#1}}% _{\mbox{\fontsize\sf@size\z@#2}}% }% }} \makeatother \begin{document} \lipsum[2][1-6] HCHO + SO\textsupsub{2--}{3} + H\textsuperscript{+} $\xlongequal{\phantom{xxx}}$ \chemfig[atom sep=2em]{HO-[:30]-[:-30]S(=[:-120]O)(=[:60]O)-[:-30]O\rlap{${}^-$}} \lipsum[3][1-5] \ce{HCHO + SO_3^2- + H^+} $\xlongequal{\phantom{xxx}}$ \chemfig[atom sep=2em]{HO-[:30]-[:-30]S(=[:-120]O)(=[:60]O)-[:-30]O\rlap{${}^-$}} \lipsum[2] \end{document} which combined with: text mode's formula abruptly \xlongequal with abrupt \phantom chemfig which is not properly coordinated in length I wonder is that mechem or chemfig that could typeset this chemical equation in a uniform package framework, instead of composed of multiple isolated parts.
- Macro with mandatory argument in xint (xintexpr)by cis on January 30, 2026 at 12:30 pm
This is my first time using of xint.sty; therefore, I have a few questions: (1) Is \NewDocumentCommand{\sn}{m}{ subsn(expr, var1=value1; var2=#1) } the correct way to define a macro with a mandatory argument for xint? Or does xint provide its own method? (2) The defined command \sn{*} works. However, I can't say \def\x{0.61} \sn{\x}. What do I need to do? \documentclass[margin=10mm, varwidth]{standalone} \usepackage{xintexpr} \begin{document} \section{Test with \texttt{xint}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Is this the correct way to create a xint-macro? %%%%%%%% \NewDocumentCommand{\sn}{m}{% Normal Distr. (with max error of 1.2e-7) \xintieval[5]{subsn(% 'simultaneous substitutions' 0.5 * (2-h*exp( -0.5*x^2 -1.26551223 +1.00002368*h +0.37409196*h^2 +0.09678418*h^3 -0.18628806*h^4 +0.27886807*h^5 -1.13520398*h^6 +1.48851587*h^7 -0.82215223*h^8 +0.17087277*h^9) ), h=1/(1+0.25*sqrt(2)*x); x=#1 )}} \subsection{Direct input \textbackslash sn\{0.61\} - works} sn(0.61) = \sn{0.61} \def\x{0.61} \subsection{Direct input \textbackslash sn\{\textbackslash x\} - works not} sn(\x) = % \sn{\x} \end{document}
- Too much space after primeby bubba on January 30, 2026 at 10:38 am
When I write M'(t) or H''(t) to denote derivatives, I get an unpleasantly large space between the "prime" symbol and the parenthesis. I'm wondering if I perhaps have a corrupted font. Or do people think the output is good and as expected, and my tastes are weird? Second question: what's the best way to fix this? \documentclass{article} \begin{document} $$ \mathbf{M}'(t) = \mathbf{H}''(t) $$ \end{document}
- Make certain item "titles" of enumerate bold textby Roberto Rastapopoulos on January 30, 2026 at 10:06 am
For my homework I would like to make the hand in exercises in bold text, and the practice exercises in normal text. Currently, I have: \documentclass[12pt]{exam} \usepackage{enumitem} \begin{document} \begin{enumerate}[label=Exercise \arabic*.] \item \item \end{enumerate} \end{document} Which results in . But I would like to be able to say something like this: \begin{enumerate}[label=Exercise \arabic*.] \item* \item \end{enumerate} to give . Is there a way to edit the enumerate environment to achieve this in this simple manner?
- Calculate values of standard normal distribution table as macroby cis on January 30, 2026 at 9:18 am
I calc values of the Standard normal table (with 5-digit accuracy). So I wrote a calculation with numerica.sty (using approximate values of the error function). This works so far; if I put in a concrete value like ... [..., x=0.61]. But I would like to have this as a macro, say \sn{<#1>}, for example \sn{0.61} → 0.72907. I tried to put the whole thing into a newcommand, but this seems to be not that easy. I'd like to implement this inside pdflatex, using a package (not Lua, Mathematica, etc.). I've implemented it here using the numerica package because it worked without problems (including the use of the help-variable h, see MWE). However, I'm not sure if numerica is the best choice. The xintexpr package seems promising, but I'm currently unclear on its syntax. In any case: if anyone knows of a better implementation using a different package (e.g., xint.sty), it would be nice too. \documentclass[margin=10mm, varwidth]{standalone} \usepackage{numerica} \begin{document} \section{Test with \texttt{numerica}} \xdef\x{0.61} sn(\x) = \eval*{% 0.5 (2-h \exp( -0.5 x^2 -1.26551223 +1.00002368 h +0.37409196 h^2 +0.09678418 h^3 -0.18628806 h^4 +0.27886807 h^5 -1.13520398 h^6 +1.48851587* h^7 -0.82215223 h^8 +0.17087277 h^9)) }[h=1/(1+0.25*\sqrt{2}*x), x=0.61% cannot use \x here 🙁 ][5] \section{Test with \texttt{xint}} ... ? .... \end{document}
- Diagbox in a table: how to align elements to the right or belowby cis on January 30, 2026 at 6:11 am
Is it possible to configure \diagbox[*]{*}{*} so that the elements to the right or below are aligned? \documentclass[margin=5pt, varwidth]{standalone} \usepackage{diagbox} \begin{document} \begin{tabular}{c | c | *{3}{c}} \hline a & \diagbox{$b$}{$c$} & 0.1 & 0.2 & 0.3 \\ \hline 2 & 0 & 0.1 & 0.2 & 0.3 \\ 2 & 1 & 2.1 & 2.2 & 2.3 \\ 2 & 2 & 4.1 & 4.2 & 4.3 \\ \end{tabular} \end{document}
- Fail to construct spiral gradually with beamer framesby D G on January 30, 2026 at 2:40 am
Objective: The spiral construction is shown gradually. Each iteration is on a separate frame. \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{frame}{step by step spiral construction} \begin{tikzpicture} \draw (0,0) foreach \a in {1,...,120} { \only<\a->{ -- ++({10*\a}:{pow(0.99,\a)}) } }; \end{tikzpicture} \end{frame} \end{document} Error: No file test.nav. ! Package tikz Error: Giving up on this path. Did you forget a semicolon?. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.16 \end{frame} ?
- How to Make Trajan Text Bold Using Pdflatex?by Jethro on January 29, 2026 at 8:34 pm
MWE: \documentclass[12pt]{book} \usepackage{trajan} \begin{document} \thispagestyle{empty} \LARGE \noindent\trjnfamily{HOW TO MAKE TRAJAN TEXT BOLD?}\\[20pt] \noindent\textbf{\trjnfamily{BUT THIS DOESN'T WORK}} \end{document} The output: Using pdflatex, I would like to make text bold using the trajan font; however, \textbf and \bfseries seem not to work. Is there a way to do this?
- Best ways to calculate sums in LaTeXby cis on January 28, 2026 at 2:13 pm
In many computer algebra systems, one can sum a sequence of numbers using the syntax sum(a(k), k, kStart, kEnd) for a sequence a(k) (of real and integer values) with the variable k. What's the best and fastest way to do this with LaTeX? For example, when you want to calculate thousands of values for a table. I've developed a MWE using foreach and fpeval. \documentclass[margin=5pt, varwidth]{standalone} \usepackage{amsmath} \usepackage{tikz} \newcommand\Sum[4]{% \def\mysum{0}% \foreach #2 in {#3,...,#4}{% \def\psum{\fpeval{(#1)}}% \xdef\mysum{\fpeval{\mysum+\psum}}% }\mysum} \begin{document} Test 1: $\displaystyle\sum\limits_{k=1}^{100} k = \Sum{\k}{\k}{1}{100}$ \newcommand\binomial[2]{\fpeval{fact(#1)/(fact(#2)*fact(#1-#2))}} Test 2: $\displaystyle\sum\limits_{k=0}^{5} \dbinom{5}{k} = \Sum{ \binomial{5}{\k} }{\k}{0}{5} =2^5 = \fpeval{2^5}$ \end{document}
- Showcase of beautiful 'electrical circuit diagrams' done in TeX & friendsby cis on January 27, 2026 at 7:03 am
When I saw this thread How to customize CircuiTikz ac - dc symbols or this one Showcase of beautiful typography done in TeX & friends, I had the idea to add a showcase for electrical circuit diagrams. The package would typically be circuitikz. Feel free to post your large, small, or elegant circuit diagrams here in the community wiki. (I will also add some examples occasionally.) Attach your codes (if possible); this would be a great opportunity to learn from your coding and your style. \documentclass[margin=5pt, multi=circuitikz]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors] \draw[] (0,0) to[R=$R_1$, a_=$1\Omega$, name=R1, invert] (3,0); \end{circuitikz} \end{document}