• How to get reproducible PDF
    by user2609605 on December 23, 2025 at 9:43 pm

    For quite some span of time, I was sure to have solved that problem. I got the build time from the original PDF file, e.g. via pdfinfo. Then i made the next build with SOURCE_DATE_EPOCH using exactly that time. Also FORCE_SOURCE_DATE must be set. This worked with lualatex and PDF 1.7. Now, adding pdfa/A, tagging, PDF/UA and moving on to PDF2.0, it does not work any more. Some experiments show, the critical feature is tagging. It is a great feature and i dont want to do without it. I search for a way to keep reproducibility even if tagging is present. Well, in fact, reproducibility is no longer trustable, sometimes it works. I observe that sometimes the lengths of the files differ minimally. Visually, they are the same, also XMP data seems the same. But my old simple concept of bytewise equivalence is gone. I tried with uncompress as suggested by DavidCarlisle, << /Type /Namespace /NS (data:,AC8956-1B7-A6A9-1928-C381ECC1E1C) >> << /Type /Namespace /NS (data:,5F48FB81-AC9C-B85B-A0B9-890FA89F45CC) >> is the first difference. The next is in a sequence of xref 0 17537 0000000002 65535 f 0007003671 00000 n 0000000003 00000 f But i cannot interprete these... and remarkable that even the trailer IDs coincide. In my dark thougths I even read the PDF spec and found that the trailer ID may depend on the location of the PDF also... So maybe there is another problem I do face only if there are more developers compiling in different environments. Maybe latex compilers dont use location to create the trailer ID, do they? Any advice on a sound foundation for reproducibiliby also in the future? Future is >PDF1.7, and PDF/A, PDF/UA, including tagging.

  • Is there a reference on how to make tables better, or a more standard way of pre-contemplating them?
    by Jasper on December 23, 2025 at 6:39 pm

    Is there a reference on how to make tables better, or a more standard way of pre-contemplating them? I was trying to tabulate the elementary linear transformations, and noticed that my table was rather unaesthetic. My hope is that someone could guide me on how I could better pre-contemplate these tables, so that they don't come out looking like this: \documentclass[letterpaper]{book} \usepackage{nicematrix} \usepackage{booktabs} \usepackage{tikz} \usepackage{microtype} \usepackage{mathtools} \usepackage{unicode-math} \newcommand{\temp}{% \begin{tikzpicture} \draw (-1,-1) rectangle (1,1); \node at (0,0) {Blah.}; \end{tikzpicture}% } \begin{document} \begin{table} \centering \begin{tabular}{lll} \toprule Linear transformation & Example Matrix & Geometric effect \\ \midrule Scale & \({\begin{bNiceArray}{cc} t & 0 \\ 0 & 1 \end{bNiceArray}}\) & \temp \\ \midrule Shear & \({\begin{bNiceArray}{cc} 1 & t \\ 0 & 1 \end{bNiceArray}}\) & \temp \\ \midrule Swap & \({\begin{bNiceArray}{cc} 0 & 1 \\ 1 & 0 \end{bNiceArray}}\) & \temp \\ \bottomrule \end{tabular} \caption{The elementary matrices are blah blah blah.} \label{table:chap-elem-mat} \end{table} \end{document}

  • tex4ebook: How to properly create an e-book cover
    by Jack on December 23, 2025 at 6:10 pm

    I am trying to create a cover image for my ebook, but it actually creates it twice: as a cover, and then again as a first page in the document followed even with text on the same page. Following the proposal here: Need to avoid duplication of cover image in Kindle book (tex4ebook) I tried to update my cfg file accordingly, but it still doesn't work for me. So probably I still make a mistake somewhere. How should the cover image be properly defined? Here is an MWE: \documentclass{book} \usepackage{graphicx} \usepackage{tex4ebook} \begin{document} \thispagestyle{empty} \coverimage{cover.png} \newpage \textbf{This text should be shown on a new page after the cover image. However, while a cover is created, the same image from the cover is then shown a second time on page 1 with this text right below.} \tableofcontents \chapter{Chapter 1} Some text. \chapter{Chapter 2} More Text. \end{document} And here the config-file: \Preamble{xhtml} \special{t4ht+@File: cover.png} \CoverMetadata{cover.png} \begin{document} \EndPreamble

  • Conflict between \hl command from soul package and \linenumbers command from lineno package
    by Orcs River on December 23, 2025 at 5:54 pm

    Activating line numbers on a latex document, causes text highlighted using the \hl command to disappear. Here is a minimal example: \documentclass{article} \usepackage{lipsum} \usepackage{soul} \usepackage{xcolor} \usepackage[left]{lineno} \linenumbers \begin{document} Conflict between \verb|\hl| and \verb|\linenumbers| commands \section{First section} \hl{This text will be hidden when line numbers are activated}. \lipsum[1] \end{document} Here are screenshots before and after activating line numbers. Thanks

  • Commutative diagrams using square boxes
    by ncant on December 23, 2025 at 3:38 pm

    I would like to reproduce the following commutative diagram, consisting of square boxes with mathematical expressions located near the corners, rather than mathematical expressions connected by an arrow. Since this type of diagram only develops vertically, as if it's a single column, I think it is possible to create a command that uses TikZ to draw a square and accepts four arguments, one for each edge of the square. However, I am having difficulty stacking these squares. Can you help me? Thank you EDIT: These are the instructions I'm using for making the square box. These are normally located inside a command that takes four argument, one for each corner. \begin{tikzpicture} \draw[thick] (0,0) rectangle (2,2); \node[left] at (0,2) {$f(t)$}; \node[left] at (0,0) {$e^{at}f(t)$}; \node[right] at (2,2) {$F(s)$}; \node[right] at (2,0) {$F(s-a)$}; \end{tikzpicture} These result in the following figure:

  • angle condition judge error in tikz?
    by Explorer on December 23, 2025 at 2:01 pm

    I have the following code to plot the "outer" semicircle: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{calc} % https://tex.stackexchange.com/a/666441/322482 \newcommand*\drawSemicircle[3][]{% \coordinate (mid) at ($(#2)!0.5!(#3)$); \draw[#1] (#2) let \p{A} = ($(#2)-(mid)$), \p{B} = ($(#3)-(mid)$), \n{cross} = {\x{A}*\y{B} - \y{A}*\x{B}}, \n{angA} = {atan2(\y{A},\x{A})}, \n{angB} = {atan2(\y{B},\x{B})}, \n{R} = {veclen(\x{A},\y{A})}, \n{start} = {(\n{cross}>0 ? \n{angA} : \n{angB})}, \n{endraw} = {(\n{cross}>0 ? \n{angB} : \n{angA})}, \n{end} = {(\n{endraw} < \n{start} ? \n{endraw} + 360 : \n{endraw})} in arc[start angle=\n{start},end angle=\n{end},radius=\n{R}]; } \begin{document} \begin{tikzpicture} \foreach \x in {1,...,60}{ \node[circle,draw=magenta,thick] (in-\x) at ({\x*6}:5cm) {}; \node[circle,draw=teal,thick] (out-\x) at ({\x*6}:5.5cm) {}; } \foreach \pstart[evaluate=\pstart as \pend using {int(mod(\pstart+9,60)+1)}] in {1,...,60}{ \drawSemicircle[semithick]{in-\pstart}{out-\pend} % \node[fill=white,circle,label={[label distance=-2em,text=magenta]\pstart*6:\pstart}] at (in-\pstart) {};%<-not elegant here % \node[fill=white,circle,label={[label distance=+1em,text=teal]\pstart*6:\pstart}] at (out-\pend) {}; } \end{tikzpicture} \end{document} Which gives: However, when I substitute: \node[circle,draw=teal,thick] (out-\x) at ({\x*6}:5.5cm) {}; with \node[circle,draw=teal,thick] (out-\x) at ({\x*6}:6cm) {}; Things broken, I guess that it's something like angle float error.... But I don't know how to fix this:

  • How to write a cube root correctly inside a theorem environment
    by keith77777 on December 23, 2025 at 12:15 pm

    \documentclass[% openright, % doublepage cleaning ends up right side 11pt, % font size ]{book}% \usepackage[fleqn]{amsmath}% \usepackage{amssymb}% \usepackage{amsthm}% \usepackage{mwe} \usepackage[paperheight=240mm,paperwidth=175mm,bindingoffset=12.5mm,showcrop]{geometry} \usepackage[a4,cam,center]{crop} % \newtheoremstyle{equationtype} % 1 name {5pt plus 0pt minus 0pt} % 2 {5pt plus 0pt minus 0pt} % 3 {\normalfont} % 4 main body text (lots of it) and is {-4.8pt} % 5 indent amount of header text {\bfseries} % 6 theorem head font {\\[4pt]} % punctuation after theorem head { } % 8 space after theorem head { \fontsize{11.25}{12}\selectfont{ \thmname{#1}} \thmnumber{#2} {\normalfont\fontsize{11.35}{12}\selectfont{\thmnote{#3}}} } % 9 \theoremstyle{equationtype} \newtheorem*{example}{Theorem\hspace{3pt}\ldots} \begin{document} \section*{Square and cube roots inside theorem} Would like the one-line presentation not to be altered. \vspace{6pt} express in index form\hspace{1pt}: \hspace{1pt}$4\hspace{1.0pt}\big\{\sqrt{\hspace{1.6pt}x^{\hspace{1.6pt}4\hspace{1.0pt}}}\big\}$ \vspace{6pt} \begin{example} [in index form\hspace{1pt}: \hspace{1pt}$4\hspace{1.0pt}\big\{\sqrt{\hspace{1.6pt}x^{\hspace{1.6pt}4\hspace{1.0pt}}}\big\}$] \hspace{4pt}correct, presumably because no square brackets are involved \end{example} \vspace{12pt} express in index form\hspace{1pt}: \hspace{1pt}$4\hspace{1.0pt}\big\{\sqrt[\leftroot{0}\uproot{3}\scriptstyle 3]{\hspace{1.6pt}x^{\hspace{1.6pt}4\hspace{1.0pt}}}\big\}$ \hspace{4pt}(as hoped for) \vspace{6pt} \begin{example} [in index form\hspace{1pt}: \hspace{1pt}$4\hspace{1.0pt}\big\{\sqrt[\leftroot{0}\uproot{3}\scriptstyle 3]{\hspace{1.6pt}x^{\hspace{1.6pt}4\hspace{1.0pt}}}\big\}$] \end{example} \end{document}

  • How to write a sequence with the difference displayed?
    by Jose H on December 23, 2025 at 11:10 am

    I want to write a sequence sort of like this I've been tweaking this for quite some time and still didn't get an answer. How can this be achieved?

  • Undefined control sequence \if@hebrew@fullyear
    by Evan Aad on December 23, 2025 at 10:52 am

    A few years ago I asked a question in this forum about how to format today's year per the Hebrew calendar with polyglossia. I received an answer that I was happy with at the time, and therefore accepted it. However, now when I try to run the code provided in that answer (by storing the code in a file named Main.tex, and running the command xelatex Main.tex), the compilation fails, and I get the following error message: ! Undefined control sequence. \HebrewYearName ... =#1\relax \if@hebrew@fullyear \else \advance \@tempcnta ... l.74 \ThisHebrewYear Why does the compilation fail, when it used to compile successfully? How can I fix it? P.S. I use MikTex on Windows 11 Pro. I don't know what version of MikTex is in use. (BTW, how can I find out what version of MikTex I'm using?)

  • Tikz to plot a part of a cone
    by Latexfan on December 23, 2025 at 10:30 am

    I try to use tikz to plot the following image ... \documentclass[border=0.2cm]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{colormaps} \pgfplotsset{compat = newest} \begin{document} \begin{tikzpicture} \begin{axis}[ axis equal image, grid = both, minor tick num = 2, xlabel = {$x$}, ylabel = {$y$}, zlabel = {$z$}, major grid style = {draw = lightgray}, minor grid style = {draw = lightgray!25}, xmin = 0, xmax = 1, ymin = 0, ymax = 1, zmin = 0, zmax = 2, scale = 3, view = {60}{30}, samples = 30, samples y = 30, z buffer = sort, ] % Kjeglesektor \addplot3[ surf, shader = interp, opacity = 0.75, colormap/viridis, ] ({x},{y},{sqrt(3)*sqrt(x^2+y^2)}); \end{axis} \end{tikzpicture} \end{document} But I do not get similar image ... can you please help me?

  • The font "XITS Math" cannot be found
    by Evan Aad on December 23, 2025 at 8:58 am

    I'm trying to compile a LaTeX document that I wrote several years ago, and that used to compile successfully with lualatex. The document and its preamble are very long, but I managed to cut them down to the bare minimum that shows the problem I face while compiling the original document. \documentclass{scrbook} \usepackage{fontspec} \usepackage{unicode-math} \setmathfont{XITS Math} \begin{document} Hello world \end{document} The above code is stored in a file named Main.tex. When I run the command lualatex Main.tex, the compilation fails, and the following error message appears near the end of Main.log. ! Package fontspec Error: (fontspec) The font "XITS Math" cannot be found I tried compiling Main.tex using pdflatex instead, but this too failed. Why does the compilation fail? How can I fix the problem? P.S. I use MikTex on Windows 11 Pro. I don't know how to check which MikTex version I use.

  • Running Lua function on biblatex output
    by L33 on December 23, 2025 at 2:23 am

    I want to automatically transliterate titles and author names I'm citing if they're written in another script. For example, given an author named مَحْمُود, I would like to be able to cite them inline as "(مَحْمُود maḥmūd 2020)". Supposing this author wrote a paper titled أَبْجَد هَوَّز, I would like to be able to cite it inline as "أَبْجَد هَوَّز ʾabjad hawwaz (مَحْمُود maḥmūd 2020)". Ideally the compiled bibliography should show these transliterations as well. I've written a Lua module transliteration.lua that exports a function transliterate() such that, for example, transliterate('مَحْمُود') returns the string 'maḥmūd'. However, I can't figure out where or if it's even possible to call my transliteration.transliterate() function within my paper in order for it to correctly apply to biblatex citations. This seems to interact in a complex way with the need to compile multiple times in order to format references correctly. Is there a combination of control sequences and compilation steps that will net exactly the citation formats I've described above? Is there a low-level way to override how names and titles and such are generated such that I can continue to use the default \cite(s), \parencite(s), \autocite(s), \citeauthor, etc. commands without redefining my own? This differs from prior transliteration questions like Auto transliteration in that I don't wish to directly write text in the other script. A question that seemed related was biblatex: Use field value in tex document before compilation but I couldn't figure out how to apply it to my situation. Below is a non-functioning example that demonstrates a rudimentary (and incorrect) understanding of \latelua, \expandafter, \DeclareCiteCommand, etc. (For demonstration, this is generic string substitution without reference to a specific script except in the comment about babel.) I am compiling this with the VSCode Latex Workshop extension's latexmk (lualatex) recipe, which as of writing runs latexmk -synctex=1 -interaction=nonstopmode -file-line-error -lualatex -outdir=%OUTDIR% %DOC%. -- transliteration.lua local exports = {} exports.transliterate = function(text) text = text:gsub("bb", "cc") text = text:gsub("aa", "bb") return text .. ' (this parenthetical indicates that the translit function ran)' end return exports \documentclass{article} \usepackage{biblatex} \directlua{tr = require("transliteration.lua")} \begin{filecontents}[overwrite]{test.bib} @misc{test, author = "aa", title = "bb", year = 2020} \end{filecontents} \addbibresource{test.bib} \DeclareCiteCommand{\translitciteauthor}{}{\directlua{tex.print(tr.transliterate("\\printnames{author}"))}}{}{} \begin{document} 1 % runs function but does not transliterate % additionally, if including babel and using an RTL script, this throws a "missing number, treated as zero" \directlua{tex.print(tr.transliterate("\\citeauthor{test}"))} 2 % runs function but does not transliterate \directlua{tex.print(tr.transliterate("\\expandafter{\\citeauthor{test}}"))} 3 % does nothing \latelua{pdf.print(tr.transliterate("\\citeauthor{test}"))} 4 % runs function but does not transliterate \translitciteauthor{test} \end{document}

  • Nested revealing of (correctly sized) blanks
    by scottkosty on December 23, 2025 at 1:53 am

    I am using an implementation to first show an underline with a questionmark in the middle that takes up the same space as the revealed text, from this answer: An alt fill-in-the-blank with question in the middle However, it does not work as expected when I nest them. It almost works, but it has an extra overlay. Here's an example: \documentclass{beamer} % needed to reproduce \beamerdefaultoverlayspecification{<alert@+|+->} \begin{document} % This implementation is thanks to Sam: % https://tex.stackexchange.com/questions/682149/an-alt-fill-in-the-blank-with-question-in-the-middle \newlength{\gapwidth} \newcommand{\blankQ}[1]{% \ifmmode \if@display \settowidth{\gapwidth}{$\displaystyle #1$}% \else \settowidth{\gapwidth}{$#1$}% \fi \else \settowidth{\gapwidth}{#1}% \fi \alert<.(1)|handout:0>{% \alt<+->{% #1% }{% \vphantom{#1}\smash{\underline{\makebox[\gapwidth]{?}}}% }% }% } \begin{frame} \begin{itemize} \item hello \item $P(X + 1 < 4) = \blankQ{P(X < 3) = \blankQ{0.3.}}$ \end{itemize} \end{frame} \end{document} It almost works except that there's an extra overlay. I use this type of setup a lot, so I would need any fix to be a drop-in for the macro definition. i.e., I don't want to change the \beamerdefaultoverlayspecification command or specify overlays in the itemize environment, etc.

  • Graph of a projection function
    by Octavius on December 22, 2025 at 9:49 pm

    I have the following code, but I can’t manage to replicate the figure shown in the attached image. Could you help me with the code and provide the figure? Thank you very much. \documentclass[12pt]{article} % --- Márgenes (opcional) --- \usepackage[margin=2.2cm]{geometry} % --- Idioma y acentos --- \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[spanish]{babel} % --- Matemática y TikZ --- \usepackage{amsmath,amssymb} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{arrows.meta,calc,3d} \pagestyle{empty} \begin{document} \begin{center} % --- TU FIGURA --- \begin{tikzpicture}[ scale=1.15, line cap=round, line join=round, x={(-0.95cm,-0.55cm)}, % Eje X: oblicuo hacia abajo-izquierda y={(1.15cm,0cm)}, % Eje Y: horizontal z={(0cm,1.15cm)} % Eje Z: vertical ] % Colores/estilos \definecolor{axisblue}{RGB}{20,90,130} \tikzset{ axis/.style={very thick, draw=axisblue, -Latex}, proj/.style={dashed, black, line width=0.8pt}, edge/.style={black, line width=0.9pt}, face/.style={draw=black, fill=gray!35, opacity=0.55}, topface/.style={draw=black, fill=gray!25, opacity=0.55}, frontface/.style={draw=black, fill=gray!45, opacity=0.55} } % Ejes \draw[axis] (0,0,0) -- (4.8,0,0) node[below left] {Eje X}; \draw[axis] (0,0,0) -- (0,5.4,0) node[right] {Eje Y}; \draw[axis] (0,0,0) -- (0,0,4.8) node[above] {Eje Z}; % Título \node[anchor=west] at (0.9,2.4,4.0) {\Large Gráfico de $g(x,y)=x$}; % -------- PRISMA 1: x in [0,1], y in [-1,1], altura 1 -------- \def\xa{0}\def\xb{1} \def\ya{-1}\def\yb{1} \def\hA{1} % Vértices base \coordinate (A1) at (\xa,\ya,0); \coordinate (B1) at (\xb,\ya,0); \coordinate (C1) at (\xb,\yb,0); \coordinate (D1) at (\xa,\yb,0); % Vértices top \coordinate (A1t) at (\xa,\ya,\hA); \coordinate (B1t) at (\xb,\ya,\hA); \coordinate (C1t) at (\xb,\yb,\hA); \coordinate (D1t) at (\xa,\yb,\hA); % Proyecciones (sombras) al plano z=0 \draw[proj] (A1) -- (A1t); \draw[proj] (B1) -- (B1t); \draw[proj] (C1) -- (C1t); \draw[proj] (D1) -- (D1t); % Caras visibles \filldraw[frontface] (A1) -- (B1) -- (B1t) -- (A1t) -- cycle; % cara "frontal" \filldraw[face] (B1) -- (C1) -- (C1t) -- (B1t) -- cycle; % cara derecha \filldraw[topface] (A1t) -- (B1t) -- (C1t) -- (D1t) -- cycle; % tapa % Aristas principales \draw[edge] (A1) -- (B1) -- (C1) -- (D1) -- cycle; \draw[edge] (A1t) -- (B1t) -- (C1t) -- (D1t) -- cycle; \draw[edge] (A1) -- (A1t); \draw[edge] (B1) -- (B1t); \draw[edge] (C1) -- (C1t); \draw[edge] (D1) -- (D1t); % Etiquetas \node at (\xa,\ya,\hA) [above left] {$1$}; \node at (0.55,0, -0.02) [below, yshift=-2pt] {$[0,1]\times(-1,1)$}; % -------- PRISMA 2: x in [2,3], y in [-1,1], altura 2 -------- \def\xc{2}\def\xd{3} \def\hB{2} \coordinate (A2) at (\xc,\ya,0); \coordinate (B2) at (\xd,\ya,0); \coordinate (C2) at (\xd,\yb,0); \coordinate (D2) at (\xc,\yb,0); \coordinate (A2t) at (\xc,\ya,\hB); \coordinate (B2t) at (\xd,\ya,\hB); \coordinate (C2t) at (\xd,\yb,\hB); \coordinate (D2t) at (\xc,\yb,\hB); % Proyecciones \draw[proj] (A2) -- (A2t); \draw[proj] (B2) -- (B2t); \draw[proj] (C2) -- (C2t); \draw[proj] (D2) -- (D2t); % Caras \filldraw[frontface] (A2) -- (B2) -- (B2t) -- (A2t) -- cycle; \filldraw[face] (B2) -- (C2) -- (C2t) -- (B2t) -- cycle; \filldraw[topface] (A2t) -- (B2t) -- (C2t) -- (D2t) -- cycle; % Aristas \draw[edge] (A2) -- (B2) -- (C2) -- (D2) -- cycle; \draw[edge] (A2t) -- (B2t) -- (C2t) -- (D2t) -- cycle; \draw[edge] (A2) -- (A2t); \draw[edge] (B2) -- (B2t); \draw[edge] (C2) -- (C2t); \draw[edge] (D2) -- (D2t); % Etiquetas \node at (\xc,\ya,\hB) [above left] {$2$}; \node at (2.55,0,-0.02) [below, yshift=-2pt] {$[2,3]\times(-1,1)$}; % Marcas -1 y 1 sobre eje Y (opcional) \node at (0,-1,0) [below] {$-1$}; \node at (0, 1,0) [below] {$1$}; \end{tikzpicture} \end{center} \end{document}

  • circuitikz inverted voltage EU vs american
    by MrI2C on December 22, 2025 at 8:49 pm

    I was wondering why there's a different polarity used in EU vs american symbols for voltage sources. As one can see the eu version and the american version have oposite polarity, which make's it hard once you start mixing circuits with a EU base and american base. example: \documentclass[a4paper,11pt]{article} \usepackage{circuitikz} \usepackage{siunitx} %\sisetup{locale = DE} % komma als decimaalteken (optioneel) \begin{document} \begin{circuitikz}[american] \draw (0,0) to[V=10V] (2,0); \end{circuitikz} \begin{circuitikz}[european] \draw (0,0) to[V=10V] (2,0); \end{circuitikz} \begin{circuitikz} \draw (0,0) to[V=10V] (2,0); \end{circuitikz} \end{document} So I get a polarity swap between EU and american If a read the manual it should not invert (image/code 1 vs 3 )

  • Booktabs cmidrule creates unwanted vertical space
    by profj on December 22, 2025 at 7:30 pm

    I am making the following table using LaTeX. One way to do it is to make a separate row for the "Top Header" header. However, this results in space below that header and the "sub headers": \documentclass{article} \usepackage{booktabs} \begin{document} \begin{table} \centering \begin{tabular}{ll rr} \toprule (1) & (2) & (3) & (4) \\ \midrule & & \multicolumn{2}{c}{Top Header} \\ \cmidrule(lr){3-4} Main & Main & \\ Header 1 & Header 2 & Sub 1 & Sub 2 \\ \midrule 0.01 & 0.25 & 0.05 & 0.00 \\ 0.02 & 0.25 & 0.11 & 0.03 \\ 0.05 & 0.25 & 0.16 & 0.09 \\ \bottomrule \end{tabular} \end{table} \end{document} An alternative way is to include "Top Header" on the same line as the top line of the "Main Headers", but the use of \cmidrule creates awkward space for the two "Main Headers": \documentclass{article} \usepackage{booktabs} \begin{document} \begin{table} \centering \begin{tabular}{ll rr} \toprule (1) & (2) & (3) & (4) \\ \midrule Main & Main & \multicolumn{2}{c}{Top Header} \\ \cmidrule(lr){3-4} Header 1 & Header 2 & Sub 1 & Sub 2 \\ \midrule 0.01 & 0.25 & 0.05 & 0.00 \\ 0.02 & 0.25 & 0.11 & 0.03 \\ 0.05 & 0.25 & 0.16 & 0.09 \\ \bottomrule \end{tabular} \end{table} \end{document} A third way, with no \cmidrule gets the vertical spacing right, but I do want a to use \cmidrule to get a line under "Top Header": \documentclass{article} \usepackage{booktabs} \begin{document} \begin{table} \centering \begin{tabular}{ll rr} \toprule (1) & (2) & (3) & (4) \\ \midrule Main & Main & \multicolumn{2}{c}{Top Header} \\ Header 1 & Header 2 & Sub 1 & Sub 2 \\ \midrule 0.01 & 0.25 & 0.05 & 0.00 \\ 0.02 & 0.25 & 0.11 & 0.03 \\ 0.05 & 0.25 & 0.16 & 0.09 \\ \bottomrule \end{tabular} \end{table} \end{document} How can I get columns 1 and 2 to behave as in the first table, but columns 3 and 4 to behave as in the second table? In other words, I'd like the headers to take up two lines, as in the second table, and I'd like to use the \cmidrule command for columns 3 and 4, but I don't want the the extra space in between "Main" and "Header 1" and "Main" and "Header 2" that we see in the second table.

  • How to increase the separation between acronym and description?
    by stefaniecg on December 22, 2025 at 5:45 pm

    Using the glossaries package, how can I increase the separation between the ACRONYM and the description? Here is an example code. \documentclass{IEEEtran} \usepackage[acronym]{glossaries} \makeglossaries % generates the acronym list \newacronym{acm}{ACM}{Association for Computing Machinery} \newacronym{lacr}{LACROO}{Longer acronym which overlaps with description} \begin{document} This is an \ac{acm} article. \ac{acm} is very popular in computer science. But the problem is, the following acronym is too long \ac{lacr} and it overlaps with its description. \printglossaries % prints the acronym list \end{document} Code ref. Setting up Acronym on IEEEtran Class Documemt

  • CircuiTikZ inconsistent behaviour of voltage/distance from node
    by DraUX on December 22, 2025 at 2:40 pm

    I found that the behaviour of the voltage/distance from node-key varies depending on the component, as can be seen in the mwe below. Is there a fix that I am missing? Also, when I set voltage/distance from node=0 there is still some distance to the actual center of the node (marked in red). I have no idea where this is coming from (maybe a TikZ-thing?). I thought, maybe the inner sep of the nodes was not being accounted for, but after some testing, I found that the distance differs from the standard inner sep of nodes. Does someone have an idea? \documentclass{standalone} \usepackage{tikz} \usepackage[straightvoltages]{circuitikz} \begin{document} \begin{tikzpicture} \draw (0,0) to[R,name=R,v=U,voltage/distance from node=0] (2,0); \draw (0,-1) to[open,name=v,v=U,voltage/distance from node=0] (2,-1); \draw (0,-1.25) to[open,v=U,voltage/distance from node=0,open voltage position = legacy] (2,-1.25); \draw[red] (0,0 |- R-Vfrom) -- (R-Vfrom) node[midway,below] {?}; \draw[red] (0,-1) -- (v-Vfrom) node[midway,below] {?}; \end{tikzpicture} \end{document}

  • How to create an overhead right-pointing arrow that ends with a small filled/empty circle, in math-mode?
    by Evan Aad on December 22, 2025 at 2:08 pm

    How can I create a command that will ornament a letter in math-mode with an overhead right-pointing arrow that has a filled circle at its end? Likewise with an empty circle? The ornaments should look and behave similar to \overrightarrow in the following document, except that there should be a small filled circle at the right-hand tip of the arrow, resp. a small empty circle. \documentclass{article} \usepackage{amsmath} \begin{document} \[ \overrightarrow{A}\quad\overrightarrow{a}\quad\overrightarrow{\beta} \] \end{document}

  • tikz with overlay and remember picture parameter doesn't work in TL2025
    by Chow Hui on December 22, 2025 at 1:27 pm

    \documentclass{article} \usepackage[a4paper,margin=2cm]{geometry} \usepackage[fontset=fandol]{ctex} % 和原环境一致 \usepackage{tikz} \newdimen\X \newdimen\Y \X=89.62253pt \Y=85.35826pt \begin{document} 这里是普通正文。 \begin{tikzpicture}[remember picture,overlay] \node[inner sep=0pt, anchor=north west] at (current page.north west) ++ (\X, -\Y) (posblock-math-test) {SIMPLE}; \end{tikzpicture} \end{document} errlog: ! Package tikz Error: A node must have a (possibly empty) label text. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.18 + + (\X, -\Y)

  • CircuiTikZ behavior of voltage shift at open component
    by DraUX on December 22, 2025 at 1:04 pm

    In CiruciTikZ, I tried to shift the voltage arrow and label away from an open-component. But apparently the usual options (voltage shift and voltage/distance from line) don't seem to work, as you can see in the mwe below. So, I was wondering what's causing this behavior. I stumbled upon this Issue and this Question addressing problems related to voltage shift and the open-component as well, but couldn't figure out how to solve my problem using them. \documentclass{standalone} \usepackage{tikz} \usepackage[straightvoltages]{circuitikz} \begin{document} \begin{tikzpicture} \draw (0,0) to[open,v=$U$] (2,0) (3,0) to[open,v=$U$,voltage shift=2] (5,0) (6,0) to[open,v=$U$,voltage/distance from line = .2] (8,0); \draw (0,-1.5) to[R,v=$U$] (2,-1.5) (3,-1.5) to[R,v=$U$,voltage shift=2] (5,-1.5) (6,-1.5) to[R,v=$U$,voltage/distance from line = .2] (8,-1.5); \end{tikzpicture} \end{document}

  • circuitikz: voltage arrow exactly from position to position
    by cis on December 22, 2025 at 8:45 am

    What is the correct syntax for placing a voltage arrow precisely between the two input terminals? By the way: To make the whole look nicer, I wanted to increase the pin lengths, but I couldn't manage it. I probably didn't place the current arrow quite correctly either, syntax-wise. \documentclass[margin=5pt, multi=circuitikz]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz} \node [en amp, %Increase pin length: %circuitikz/amplifiers/pin length=<*>, does not work ] (amp1) {}; \node [ocirc] at (amp1.-) {}; \node [ocirc] at (amp1.+) {}; \node [ocirc] at (amp1.out) {}; % v-arrow \draw[blue] ([xshift=-2mm]amp1.-) -- ([xshift=-2mm]amp1.+) node[midway, left] {$U$} node[sloped, currarrow, pos=1, blue] {}; % i-arrow \path[] (amp1.out) to[short, f=$\color{red}I$, color=red] ([xshift=5mm]amp1.out); \end{circuitikz} \end{document}

  • How best to align a grid of expressions divided by vertical lines
    by Steven Thomas Hatton on December 22, 2025 at 8:12 am

    That which is to be Rendered Pfaff, Johann Friedrich -- Methodus generalis, aequationes differentiarum partialium, nec non aequationes differentiales vulgares, utrasque primi ordinis inter quotcunque variabiles, complete integrandi The Current Effort % -*- mode: latex; TeX-engine: luatex; coding: utf-8 -*- \documentclass[a4paper,10pt]{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{unicode-math} \setmainfont{STIX Two Text} \setmathfont{STIX Two Math} \begin{document} \begin{equation*} \begin{array}{c|c|c|c|c} 0 =\,Z &dy+\phantom{p}\zeta & da+\zeta' &db+\zeta'' & dc.\\ \phantom{0}-pX &\phantom{dy}-p\chi & \phantom{da}-p\chi'&\phantom{db}-p\chi''& {}\\ \phantom{0}-\,q & {} & {} & {} & {} \end{array} \end{equation*} \end{document} The Result Discussion The current rendering isn't horrible, but it isn't as disciplined as I would like. Is there deterministic way to arrange content of this kind so that, for example, the '+' aligns vertically with the '-'? Discussion of Suggested Approach My original \begin{equation*} \begin{array}{c|c|c|c|c} 0 =\,Z &dy+\phantom{p}\zeta & da+\zeta' &db+\zeta''& dc.\\ \phantom{0}-pX &\phantom{dy}-p\chi & \phantom{da}-p\chi'&\phantom{db}-p\chi''&{}\\ \phantom{0}-\,q & {} & {} & {} &{} \end{array} \end{equation*} Suggested \begin{equation*} \begin{array}{c|c|c|c|l} \begin{aligned} 0 &= \; Z \\ &- pX \\ &- \;\; q \end{aligned} & \begin{aligned}[b] dy &+ \;\zeta \\ &- p\chi \end{aligned} & \begin{aligned}[b] da &+ \; \zeta' \\ &- p\chi' \end{aligned} & \begin{aligned}[b] db &+ \;\zeta'' \\ &- p\chi'' \end{aligned} & \begin{aligned}[b] dc. \\ & \end{aligned} \end{array} \end{equation*} This is not as robust as I would like. For example: Variations \begin{equation*} \begin{array}{c|c|c|c|c} 0 =\,\frac{Z}{t} &dy+\phantom{p}\zeta & da+\zeta' &db+\zeta''& dc.\\[1.6ex] \phantom{0}-\frac{pX}{2} &\phantom{dy}-p\chi & \phantom{da}-p\chi'&\phantom{db}-p\chi''&{}\\[1.6ex] \phantom{0}-\,\frac{q}{3} & {} & {} & {} &{} \end{array} \end{equation*} \begin{equation*} \begin{array}{c|c|c|c|l} \begin{aligned} 0 &=\,\frac{Z}{t} \\ &-\frac{pX}{2} \\ &- \;\; \,\frac{q}{3} \end{aligned} & \begin{aligned}[b] dy &+ \;\zeta \\ &- p\chi \end{aligned} & \begin{aligned}[b] da &+ \; \zeta' \\ &- p\chi' \end{aligned} & \begin{aligned}[b] db &+ \;\zeta'' \\ &- p\chi'' \end{aligned} & \begin{aligned}[b] dc. \\ & \end{aligned} \end{array} \end{equation*} I agree that the suggested version is an improvement in appearance to my original version in the specific case. If the content is varied so that different ``cells'' have different heights the horizontal alignment of the array of aligned environments no longer aligns grid rows. Perhaps there is no simple, ideal solution. I am hoping for something that will "naturally" align partitioned grid cells. I've done something similar in the past. The code that produced the following is listed below. I didn't really know what I was doing, I just tried things that I cribbed from this forum until it looked acceptable. % -*- mode: latex; TeX-engine: luatex; coding: utf-8 -*- \documentclass[a4paper,10pt]{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{unicode-math} \setmainfont{STIX Two Text} \setmathfont{STIX Two Math} \newcommand{\SBRAK}[1]{\left[#1\right]} \newcommand{\ARGS}[1]{\SBRAK{#1}} \newcommand{\CBRACE}[1]{\left\lbrace #1 \right\rbrace} \newcommand{\SPOT}{\smblkcircle} \newcommand{\CONST}[1]{\mathrm{#1}} \newcommand{\FTN}[1]{\mathscr{#1}} % scalar function \newcommand{\FTNA}[2]{\FTN{#1}\ARGS{#2}} \newcommand{\LNF}[1][L]{\mathfrak{#1}} % linear form representative \newcommand{\LNFC}[1][L]{\pmb{\LNF[#1]}} % linear form class \begin{document} \paragraph{My original} \begin{equation*} \begin{array}{c|c|c|c|c} 0 =\,Z &dy+\phantom{p}\zeta & da+\zeta' &db+\zeta''& dc.\\ \phantom{0}-pX &\phantom{dy}-p\chi & \phantom{da}-p\chi'&\phantom{db}-p\chi''&{}\\ \phantom{0}-\,q & {} & {} & {} &{} \end{array} \end{equation*} \paragraph{Suggested} \begin{equation*} \begin{array}{c|c|c|c|l} \begin{aligned} 0 &= \; Z \\ &- pX \\ &- \;\; q \end{aligned} & \begin{aligned}[b] dy &+ \;\zeta \\ &- p\chi \end{aligned} & \begin{aligned}[b] da &+ \; \zeta' \\ &- p\chi' \end{aligned} & \begin{aligned}[b] db &+ \;\zeta'' \\ &- p\chi'' \end{aligned} & \begin{aligned}[b] dc. \\ & \end{aligned} \end{array} \end{equation*} \paragraph{Variations} \begin{equation*} \begin{array}{c|c|c|c|c} 0 =\,\frac{Z}{t} &dy+\phantom{p}\zeta & da+\zeta' &db+\zeta''& dc.\\[1.6ex] \phantom{0}-\frac{pX}{2} &\phantom{dy}-p\chi & \phantom{da}-p\chi'&\phantom{db}-p\chi''&{}\\[1.6ex] \phantom{0}-\,\frac{q}{3} & {} & {} & {} &{} \end{array} \end{equation*} \begin{equation*} \begin{array}{c|c|c|c|l} \begin{aligned} 0 &=\,\frac{Z}{t} \\ &-\frac{pX}{2} \\ &- \;\; \,\frac{q}{3} \end{aligned} & \begin{aligned}[b] dy &+ \;\zeta \\ &- p\chi \end{aligned} & \begin{aligned}[b] da &+ \; \zeta' \\ &- p\chi' \end{aligned} & \begin{aligned}[b] db &+ \;\zeta'' \\ &- p\chi'' \end{aligned} & \begin{aligned}[b] dc. \\ & \end{aligned} \end{array} \end{equation*} \begin{equation*} \begin{array}{|c|c|} \hline \begin{aligned}[t]\\[\dimexpr-\normalbaselineskip] y&=+\CONST{m}x+\CONST{b} =\FTNA{y}{x} \vphantom{\frac{1}{\CONST{m}}}\\ &=-\frac{\CONST{y}_0}{\CONST{x}_0}x+\CONST{y}_0 % \\[\dimexpr-\normalbaselineskip] \\\hline \\[\dimexpr-\normalbaselineskip] % \CONST{m}&=-\frac{\CONST{y}_0}{\CONST{x}_0} =-\frac{\CONST{A}}{\CONST{B}}\\ \CONST{b}&=+\CONST{y}_0 =-\frac{\CONST{C}}{\CONST{B}}\\ 0&=+\CONST{b}+\CONST{m}x-y\vphantom{\frac{\CONST{Y}}{\CONST{m}}} % \\[\dimexpr-\normalbaselineskip] \\\hline \\[\dimexpr-\normalbaselineskip] % \LNFC&\doteq\phantom{-} \CBRACE{\CONST{b}:\CONST{m}:-1} \vphantom{\CBRACE{\frac{1}{\CONST{m}}}}\\ &=-\CBRACE{ \CONST{-\CONST{y}_0}:\CONST{\frac{\CONST{y}_0}{\CONST{x}_0}}:1 }\\ &=-\frac{\CBRACE{\CONST{C}:\CONST{A}:\CONST{B}}} {\CONST{B}} \\[\dimexpr-\normalbaselineskip]\\ \end{aligned} & \begin{aligned}[t]\\[\dimexpr-\normalbaselineskip] x&=+\frac{1}{\CONST{m}}y+\CONST{a}=\FTN{x}\ARGS{y}\\ &=-\frac{\CONST{x}_0}{\CONST{y}_0}y+\CONST{x}_0 % \\[\dimexpr-\normalbaselineskip] \\\hline \\[\dimexpr-\normalbaselineskip] % \frac{1}{\CONST{m}}&=-\frac{\CONST{x}_0}{\CONST{y}_0} =-\frac{\CONST{B}}{\CONST{A}}\\ \CONST{a}&=+\CONST{x}_0 =-\frac{\CONST{C}}{\CONST{A}}\\ 0&=+\CONST{a}-x+\frac{y}{\CONST{m}} % \\[\dimexpr-\normalbaselineskip] \\\hline \\[\dimexpr-\normalbaselineskip] % \LNFC&\doteq\phantom{-} \CBRACE{\CONST{a}:-1:\frac{1}{\CONST{m}}}\\ &=-\CBRACE {-\CONST{\CONST{x}_0}:1:\CONST{\frac{\CONST{x}_0}{\CONST{y}_0}}}\\ &=-\frac{\CBRACE{\CONST{C}:\CONST{A}:\CONST{B}}} {\CONST{A}} \end{aligned}\\ \hline \end{array} \end{equation*} \end{document}

  • Using flowfram: Paragraphs keep previous page width when spanning across pages with different frame layouts
    by John Stone on December 22, 2025 at 3:21 am

    Related: This question follows from my previous one about dynamic page margins, where flowfram was suggested as a solution approach from MS-SPO @ms-spo. I'm trying to use the flowfram package to create a LaTeX document with different page layouts matching different background PDFs, as suggested in this comment on my previous question. My setup works well except for one issue: when a paragraph spans across pages with different frame widths, the text on the new page continues using the previous page's frame width, causing misalignment; please see the png attachment! MWE: \documentclass{article} \usepackage{lipsum} % ===== Load packages ===== \usepackage[margin=0pt]{geometry} % Disable geometry's margin control \usepackage{eso-pic, graphicx} \usepackage{flowfram} % ===== Define three page layouts ===== % 1. First page layout \newflowframe[1]{% \dimexpr\paperwidth-66mm\relax}{% width \dimexpr\paperheight-104mm\relax}{% height 52mm}{% left (x-coordinate) 38mm% top (y-coordinate from bottom) }[firstpage] % 2. Odd pages layout (except first) \newflowframe[3,5,7,9,11,13,15,17,19,21,23,25,27,29,31]{% \dimexpr\paperwidth-66mm\relax}{% width \dimexpr\paperheight-70mm\relax}{% height 62mm}{% left (x-coordinate) 38mm% top (y-coordinate from bottom) }[oddpage] % 3. Even pages layout \newflowframe[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30]{% \dimexpr\paperwidth-44mm\relax}{% width \dimexpr\paperheight-64mm\relax}{% height 30mm}{% left (x-coordinate) 34mm% top (y-coordinate from bottom) }[evenpage] % ===== Background images ===== \AddToShipoutPictureBG{ \ifnum\value{page}=1 \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{c1b.pdf}} \else \ifodd\value{page} \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{c3.pdf}} \else \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{c2.pdf}} \fi \fi } % ===== Header/Footer handling (optional) ===== \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} % Clear defaults \fancyheadoffset[LE,RO]{0pt} % Ensure headers don't shift \begin{document} \section{earth} \lipsum[1-5] \lipsum*[6-7] \section{universe} \lipsum[1-6] \lipsum*[7-8] \lipsum[1-4] \lipsum*[5-6] \lipsum[1-7] \end{document} The Problem: In the generated PDF, paragraphs that continue from page 1 (width: paperwidth-66mm) to page 2 (width: paperwidth-44mm) still use the wider width on page 2, causing text to overflow or misalign with the background. What I've tried: The flowfram manual mentions using \framebreak to handle this: "If the flow frames are not all of the same width, the change in \hsize will not come into effect until the end of the paragraph. Provide a command to simulate a paragraph break..." However, I'm not sure: Where to insert \framebreak (at potential break points? automatically?) How to use it properly (the manual mentions grouping for \parfillskip and \parskip) If there are better alternatives for handling this Questions: How should \framebreak be used in practice to fix cross-page paragraph width issues? Is there a way to automate this, or must I manually insert break points? Are there alternative approaches within flowfram to handle different frame widths across pages? automatically?

  • How to Enclose Long Text with a Single-Sized Set of Parentheses?
    by Jethro on December 21, 2025 at 10:01 pm

    MWE: \documentclass[12pt]{article} \textwidth=3.5in \begin{document} \thispagestyle{empty} \begin{equation} \left( \frac{A}{B} \right) \end{equation} \vspace{35pt} \noindent How to enclose text extending over multiple lines with parentheses (\emph{as if} it were a fraction)? \end{document} The output: I would like to enclose text which extends over two or more lines by an appropriately sized set of parentheses. I have tried using \left( and \right) as if I were in a mathematical environment, such as shown in in the fractional expression. However, this does not work when in a text environment. Using $...$ does not help either. How may I enclose the given text, which extends over two lines, entirely with one set of appropriately sized parentheses?

  • circuitikz: anchoring a circular path symbol
    by cis on December 21, 2025 at 1:02 pm

    How do I choose the anchor so that the line starts exactly at the edge at a path-source to[american current source]? \documentclass[margin=5pt, multi=circuitikz]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[] %\ctikzset{bipoles/border margin=0.0}% no effect \draw[] (0,0) to[american current source, o-o, name=GS] (2,0); \draw[->] (GS.north east) -- +(45:1); \end{circuitikz} \end{document}

  • \prime \dprime \tprime (not so much) \qprime (looks good) STIX TWO
    by Steven Thomas Hatton on December 21, 2025 at 6:20 am

    The motivation Pfaff, Johann Friedrich: Methodus generalis, aequationes differentiarum partialium, nec non aequationes differentiales vulgares, utrasque primi ordinis inter quotcunque variabiles, complete integrandi The Problem \documentclass[a4paper,10pt]{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{unicode-math} \setmainfont{STIX Two Text} \setmathfont{STIX Two Math} \newcommand{\tprime}{\char"2034} % ‴ \newcommand{\qprime}{\char"2057} % ⁗ \begin{document} Prime notation: $x^{\prime},x^{\dprime},x^{\tprime},x^{\qprime}$ \end{document} Obviously, the desired result would be for the triple prime to look like the double prime with one more prime, and to look like the quadruple prime with one less prime. This appears to be a feature of unicode since it appears in browsers, in Kate, in Emacs, (differently un-uniform) in xterm. Is there a way to produce a uniform set of prime, double prime, triple prime, quadruple prime using LuaLaTeX? Preferably with STIX Two. Post Script. I was unaware that $x'''$ would work. I learned to author LaTeX using LyX which is WYSIWYM not WYSIWYG. I rarely compiled what I was writing. My reality was what I saw in LyX.

  • How to create Tikz figure with surface and its shadow, as shown in image
    by Latexfan on December 19, 2025 at 7:17 pm

    I wish to make this figure with Tikz. I have tried but I can't make as in figure. Can you please assist me? \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta,3d,calc} \begin{document} \begin{tikzpicture}[ x={(1cm,0cm)}, y={(0.6cm,0.4cm)}, z={(0cm,1cm)}, >=Stealth ] % Axes \draw[->] (0,0,0) -- (4,0,0) node[below left] {$x$}; \draw[->] (0,0,0) -- (0,4,0) node[below right] {$y$}; \draw[->] (0,0,0) -- (0,0,4) node[left] {$z$}; % Origin \node at (0,0,0) [below left] {$O$}; % Bottom region D \fill[blue!15,opacity=0.6] plot[smooth cycle,variable=\t,domain=0:360] ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, 0); \node at (2,2,0) [below] {$D$}; % Boundary C' \draw[blue!70,thick,->] plot[smooth cycle,variable=\t,domain=0:360] ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, 0); \node at (3.8,2,0) {$C'$}; % Vertical dashed lines \foreach \t in {30,110,200,290} { \draw[dashed] ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, 0) -- ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, 2.3); } % Surface S : z = f(x,y) \fill[blue!40,opacity=0.7] plot[smooth cycle,variable=\t,domain=0:360] ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, {2+0.3*sin(\t)}); \node at (1.3,3.2,2.4) {$S$}; \node at (3.2,3.4,2.6) {$z=f(x,y)$}; % Boundary C \draw[blue!80,thick,->] plot[smooth cycle,variable=\t,domain=0:360] ({2+1.6*cos(\t)}, {2+1.1*sin(\t)}, {2+0.3*sin(\t)}); \node at (3.7,2.3,2.2) {$C$}; % Normal vector N \draw[red,very thick,->] (2,2,2.2) -- (2,2,3.6) node[above] {$\mathbf{N}$}; \end{tikzpicture} \end{document} ```

  • Custom 3D line plot in plain tikz and/or luadraw
    by Dr. Manuel Kuehner on December 19, 2025 at 12:30 pm

    Disclaimer This question is a bit of "do it for me" but there is a histrory behind it, see this question. User Jasper offered me a solution without using pgfplots. I plan to add a bounty as soon as it is possible. Question I want to create diagram with a 3D line plots. The main feature is to have several x axes that share the same y axis. Each x axis has its own F (or z) axis. There are only data points on specific y values (in the example below at +30, +15, 0, -15). In addition, the y axis is reversed (+ and - direction reversed). I need a grid in each F-x plane. Important ist also, that all F axes share the same min and max. Each axis should have a label and the diagram should have a title. The data is given in separate csv files, see example below. The MWE contains the data and plots the data (for testing) using pgfplots. Goal: The goal is to have a plain tikz solution and maybe in addition, a solution based on luadraw or lua-tikz3dtools respectively. I am looking for a easy-to-use custom interface for my plot task. If the result looks as it is created with pgfplots, then I am happy. S!#i, I forgot a key feature (not shown in the hand drawing) In addition to the x-F plots described above, there is ONE plot in the y-F plane (= from left to right). This works, because all F axes share the same min and max. \begin{filecontents*}{y_F_data.csv} y,F -15,20 -14,8 30,-4 \end{filecontents*} \documentclass{article} \usepackage{pgfplots} % ------------------------------- \begin{filecontents*}{x_zero.csv} x,F -30,12 -29,8 30,-4 \end{filecontents*} \begin{filecontents*}{x_neg_one.csv} x,F -30,12 -29,8 30,-4 \end{filecontents*} \begin{filecontents*}{x_pos_one.csv} x,F -30,12 -29,8 30,-4 \end{filecontents*} \begin{filecontents*}{x_pos_two.csv} x,F -30,12 -29,8 30,-4 \end{filecontents*} % ------------------------------- \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines = center, title = {$x_0$}, xlabel = {$x_0$}, ylabel = {$F_0$}, xmin = -30, xmax = 30, ymin = -100, ymax = 100, ] \addplot table [x=x, y=F, col sep = comma] {x_zero.csv}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ axis lines = center, title = {$x_{-1}$}, xlabel = {$x_{-1}$}, ylabel = {$F_{-1}$}, xmin = -30, xmax = 30, ymin = -100, ymax = 100, ] \addplot table [x=x, y=F, col sep = comma] {x_neg_one.csv}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ axis lines = center, title = {$x_{1}$}, xlabel = {$x_{1}$}, ylabel = {$F_{1}$}, xmin = -30, xmax = 30, ymin = -100, ymax = 100, ] \addplot table [x=x, y=F, col sep = comma] {x_pos_one.csv}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ axis lines = center, title = {$x_{2}$}, xlabel = {$x_{2}$}, ylabel = {$F_{2}$}, xmin = -30, xmax = 30, ymin = -100, ymax = 100, ] \addplot table [x=x, y=F, col sep = comma] {x_pos_two.csv}; \end{axis} \end{tikzpicture} \end{document}

  • Create macro with named arguments
    by user1724887 on December 18, 2025 at 1:30 pm

    I am new to latex. I need to create a text that has a bunch of entries that have the same structure, so I thought I would create a macro for it. However there are 7 moving parts, so it needs 7 arguments. It's becoming hard to read, hard to know which argument number I'm on. So I want to name the arguments (not so much in the definition of the macro, but at least when it's used). I tried searching on the net, but found no easy solution, and it gets very quickly highly unreadable (using xparse and things like that) for non-latex experts. I found out, using luatex, I can include lua code, which seems way more readable. So I switched to luatex. The usage that I am proposing is as follows. I'm open to other usages, but it should be at least easily readable, prone to extra spaces (and newlines), and close to the latex syntax. values can themselves have newlines, and latex code (such as \textbf). curly braces (the character ending the value) should be able to be escaped in the values. \myfunction { arg1 = {value1}, arg2 = {value2}, arg3 = {value3}, arg4 = {value4}, arg5 = {value5}, arg6 = {value6}, arg7 = {value7} } The way I tried to parse it is as follows. \documentclass{article} \usepackage{luacode} \begin{luacode} function parse_args(input) local result = {} local pattern = '(%w+)%s*=%s*{%s*([^}]+)%s*}' for key, value in input:gmatch(pattern) do result[key] = value end return result end function my_function(input) local args = parse_args(input) for key, value in args do tex.print(key .. " : " .. value .. "\\") end \end{luacode} \newcommand{\myfunction}[1]{% \directlua{ my_function([===[#1]===]) }% } \begin{document} \myfunction { arg1 = {value1}, arg2 = {value2}, arg3 = {value3}, arg4 = {value4}, arg5 = {value5}, arg6 = {value6}, arg7 = {value7} } \end{document} This doesn't work, I'm getting weird issues, it seems to closing bracket in the pattern string is interpreted as latex code and I get a closing bracket error within the string. I'm open to either making my code work with minimal changes, or to provide a whole other solution, if it's elegant and easy to read.