Week
- Better approach to plot the double path style as subpath?by Explorer on March 29, 2026 at 3:03 am
What I want to replicate is something as below: Now is my code, but good with the conjuction(the double path's start and end, and the glitch of double), even with line join=round: \documentclass[tikz,border=5pt]{standalone} \begin{document} \begin{tikzpicture}[line join=round] \coordinate (start) at (0,1.5); \coordinate (end) at (0,0); \draw[magenta] (start) -- ++(3,0) coordinate (doublestart) ++(-.5,-1.5) coordinate (doubleend) -- (end); \draw[cyan,double,double distance=2.5pt] (doublestart) .. controls ++(.25,-.75) and ++(-.3,1) .. (doubleend) ; \end{tikzpicture} \end{document}
- Embracing the future (LuaTeX, LaTeX3, ...): where to start? [closed]by PHL on March 29, 2026 at 1:14 am
Which ressources (and in which order) would you recommend to learn modern (lua)(La)TeX(3) for an advanced user? I do not intend to write packages, but I would like to be able to write some moderately complicated simple macros(1) using lua/explsyntax. The emphasis is on learning things that will probably still be useful in a few years, even if it might be experimental now (for example: lua-unicode-math instead of unicode-math). (1) Concrete example: write lecture notes for a math class. So both expl3 (for the typesetting) and lua (for computations/graphics) might be useful; but not necessarily together. For context: I started to use TeX 20 years ago. At the time I read lshort, The LaTeX Companion (2e) and the TeXbook. This allowed me to became an advanced user of LaTeX and produce documents of far better quality than the one produced by some old professors still using deprecated methods and preamble full of outdated packages. With the years passing I started to add more and more packages to my preamble, as fixltx2e to finally discover that they became obsolete. Moreover, a lot as happens these past 20 years and it seems that LuaTeX, LaTeX3 and tagging are the future (and to some extend the present) of LaTeX, so it seems reasonable to start anew.
- How to embed and syntax-highlight EBNF in a LaTeX documentby IA7 on March 28, 2026 at 4:40 pm
I am currently writing a LaTeX document which will involve quite a fair bit of EBNF (Extended Backus-Naur Form). It would be incredibly convenient for the reader of this document if the EBNF was automatically syntax highlighted, but I cannot find a way to do this. If it helps, I am using luaLaTeX and my EBNF snippets are all in external files so I don't have to surround them with a verbatim environment.
- How to change vertical spacing above and below lists when using the parskip option of KOMA-Script and enumitem?by Simon on March 28, 2026 at 12:06 am
I use a template that utilizes the document class scrreprt and thus the KOMA-Script and 1.5x line spacing. Following given guidelines, paragraphs should be separated by vertical spacing and not by indentation, which is why I put the option parskip=full- in the preamble. In order to adopt the appearance of lists to the given guidelines, I included the package enumitem and set the parameters topsep, partopsep, parsep, and itemsep, accordingly. Almost everything works as intended, with one exception: The vertical spacing above and below lists appears bigger than intended and should be smaller. I have prepared an MWE that describes the desired result. How can the MWE be modified, so that the issue regarding the vertical spacing is resolved? Changing topsep=0pt to topsep=-18pt resolves this issue only for below the list and topsep=-36pt only for above the list, despite them having a symmetric effect according to both answers on \topsep, \itemsep, \partopsep, \parsep - what do they each mean (and what about the bottom)?. Thanks in advance! P.S.: The lists without the KOMA-Script also do not fit the given guidelines, yet, it should be mentioned that the KOMA-Script changes the formatting of lists (this behavior is mentioned in its documentation) on top. MWE: \documentclass[a4paper,12pt,parskip=full-]{scrreprt} \usepackage[left=3.5cm,right=3cm,top=3.5cm,bottom=2.5cm]{geometry} \pagenumbering{gobble} \usepackage[onehalfspacing]{setspace} \usepackage{enumitem} \setlist{topsep=0pt,partopsep=18pt,parsep=18pt,itemsep=-18pt}%alternatively:topsep=-18pt or topsep=-36pt \begin{document} I want to write about \begin{enumerate} \item this, and \item that, \end{enumerate} without ending the paragraph, so there should appear 1.5x line spacing (= 18pt) above, within, and below the list, but not the increased vertical spacing of a full line that is reserved for the space between the end and the beginning of two paragraphs as follows. \par Furthermore, a list usually has something to do with its preceding and/or following text and hence is put in the same paragraph like in the example above or here, where it is preceded by a colon: \begin{enumerate} \item A sentence about this, and \item one about that \end{enumerate} ends right here. However, a list could potentially also have nothing to do with its preceding and/or following text and hence they are put into seperate paragraphs -- of which one ends with this sentence -- and show the increased vertical spacing of a full line. \par \begin{enumerate} \item A sentence on these. \item A sentence on those. \end{enumerate} \par This here is about something totally different, hence the new paragraph. Last but not least, one should not forget about paragraphs within an item of a list, as they should be seperated by the increased vertical spacing of a full line: \begin{enumerate} \item The first paragraph of the first item. \par The second paragraph of the first item. \item The second item. \end{enumerate} This line concludes the MWE. \end{document}
- Different types of lines in tree diagramby user242399 on March 27, 2026 at 5:25 pm
I am making a horizontal tree diagram and want the lines (or part of them) to look different in different parts of the diagram. I want to use continuous and dashed lines. Below is an example of what I want to be able to do. I want the lines to be dashed near the root and continuous as they get close to the nodes. The lines can be slightly curved or not, but I specifically do not want them to meet at the root. And a MWE: \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{trees} \begin{document} \begin{tikzpicture}[ grow=right, level distance=3cm, sibling distance=1.5cm, every node/.style={thick, minimum size=8mm} ] \node {Root} child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, dashed] { node {C} } child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, dashed] { node {B} child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, solid] { node {B3} } child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, solid] { node {B2} } child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, solid] { node {B1} } } child [edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}, dashed] { node {A} }; \end{tikzpicture} \end{document}
- Ignoring the tail of the letter "g" in setting the baseline of text in nodes of a tikz diagramby user143462 on March 27, 2026 at 4:22 pm
I would like the baseline of "with nitrogen" to be aligned with the bottom edge of the square shaded gray. The bottom of the tail (descender) in the "g" is currently setting the baseline for the phrase. I tried using \makebox[0pt]. Same edit for the other node. \documentclass[10pt]{amsart} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm,y=1.5cm] %The key is drawn. The keys in other bar graphs have sample regions that are squares with edge length 0.25 centimeters. As the vertical dimension is scaled by 150%, the heights of the sample squares must be scaled by 2/3. \path[fill=gray] (6, {2 + (2/3)*0.125}) -- (6.25, {2 + (2/3)*0.125}) -- (6.25, {2 + (2/3)*0.375}) -- (6, {2 + (2/3)*0.375}) -- cycle; \draw (6, {2 +(2/3)*0.125}) -- (6.25, {2 +(2/3)*0.125}) -- (6.25, {2+(2/3)*0.375}) -- (6, {2+(2/3)*0.375}) -- cycle; \node[anchor=south west, inner sep=0, font=\small] at (6.375, {2 + (2/3)*0.125}){\makebox[0pt][l]{with nitrogen}}; \path[fill=black] (6, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.375}) -- (6, {2 - (2/3)*0.375}) -- cycle; \draw (6, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.375}) -- (6, {2 - (2/3)*0.375}) -- cycle; \node[anchor=south west, inner sep=0, font=\small] at (6.375, {2 - (2/3)*0.375}){without nitrogen}; \draw (5.875, {2 - (2/3)*0.5}) -- (5.875, {2 + (2/3)*0.5}) -- (8.85, {2 + (2/3)*0.5}) -- (8.85, {2 - (2/3)*0.5}) -- cycle; \end{tikzpicture} \end{document}
- tabular text besides imageby Viesturs on March 27, 2026 at 12:32 pm
In a tabular environment, text needs to be placed symmetrically besides a drawing: Code: \documentclass[a4paper]{article} \usepackage{graphicx} \begin{document} \begin{tabular}[t]{@{}c@{\hspace{0.5cm}} l@{}} \includegraphics[width=0.9cm]{example-image-a} & \begin{minipage}[t]{10cm} % [t] ensures top alignment line 1\\ line 2\\ \end{minipage} \end{tabular} \end{document} Output: Text is hanging below the image. How to place the image and text side by side symmetrically?
- Table with varying number of cells per row [duplicate]by fpuentegomez on March 27, 2026 at 8:45 am
I am trying to replicate the table in the image: As you can see, it has varying number of cells in some of the rows. Sample of what I've tried so far (contains only the rows with varying number of cells): \documentclass{article} \usepackage{tabularx} \begin{document} % 1st table with only 1 cell per row \begin{tabularx}{\textwidth}{|>{\centering\arraybackslash}X|} \hline \textbf{LX -- Left Seat LVO}\\ \end{tabularx} % 2nd table with 4 cells per row \begin{tabularx}{\textwidth}{|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|} \hline \textbf{Weights/CG} & A320 & A330 & A350\\ \end{tabularx} % 3rd table with one cell per row \begin{tabularx}{\textwidth}{|>{\centering\arraybackslash}X|} \hline Profile A: Takeoff Perf: FlySmart\\ \end{tabularx} % 4th table with 5 cells per row \begin{tabularx}{\textwidth}{|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|>{\raggedleft\arraybackslash}X|} \hline \textbf{Weights/CG} & A320 CEO & A320 NEO & A330 & A350\\ \hline \end{tabularx} \end{document} I have tried to concatenate tabularx environments because I would like it to fill the whole page laterally, but the problem is that those are different tables, which creates two problems: There are tiny (but still noticeable) gaps in the borders of the cells right after every \end{tabularx} If the "whole table" doesn't fit in the page it is split by one of the \begin{tabularx} instead of filing the page. Is it possible to create everything in a single table? Are there other table packages that you would recommend? Thank you very much in advance
- hline between colored rows in tblrby Sak on March 26, 2026 at 8:45 pm
I’m coloring the background of some rows, i have a drawn some hlines leaving the boundary between rows 4 and 5 in column 1 without an hline. Visually, I still get a thin white gap where that missing hline would be, even though both rows cells are fully background‑colored. I tried to “fill” that gap by drawing an hline with the same color as the background, and also by using tblrtikzabove/tblrtikzbelow to paint over the gap as a possible workaround. In all of these cases, a visible artifact remains: a narrow strip that is a slightly different shade or just white than the surrounding background, so the line is still noticeable. I cannot globally change rows/rowsep or similar table‑wide settings, because I need to scope this behavior and later add specific hlines at selected positions. What I’m looking for is a way, localized to certain row boundaries, to either eliminate that white gap entirely or fill it without causing the visible shade difference, ideally without having to restructure the whole table. \documentclass{article} \usepackage{tabularray} \usepackage{graphicx} \usepackage{geometry} \geometry{margin=0in} %\usepackage{showframe} \usepackage{siunitx} \usepackage{xcolor} \usepackage{bm} \UseTblrLibrary{tikz} \UseTblrLibrary{varwidth} \begin{document} \centering \vspace*{1em} \scalebox{0.59}{ \begin{tblrtikzabove}%tikz attempt %\draw[color=blue] (h4-|v1) -- (h4-|v3); \end{tblrtikzabove} \begin{tblr}{ colspec = { Q[c,wd=3.5cm]%1 Q[c,wd=2cm]%2 Q[c,wd=2cm]%3 Q[c,wd=2cm]%4 Q[c,wd=1.5cm]%5 Q[c,wd=1.5cm]%6 Q[c,wd=2cm]%7 Q[c,wd=2cm]%8 Q[c,wd=1.7cm]%9 Q[c,wd=1.7cm]%10 Q[c,wd=1.7cm]%11 Q[c,wd=1.7cm]%12 Q[c,wd=1.7cm]%13 Q[c,wd=1.7cm]%14 },rowsep=6pt, row{1}={h,ht=2.5cm,font=\sffamily\Large},row{2}={ht=2cm,font=\sffamily\bfseries\Large,h},row{3}={ht=.7cm,font=\sffamily\bfseries\Large},row{4}={ht=.6cm,font=\sffamily\bfseries\large},row{Z}={c,m,font=\Large\sffamily,ht=.8cm}, vlines, hline{Z,Y,1}={solid},hline{1-Z}={3-Z}{solid}, row{1-Y}={fg=red,bg=blue}, %hline{4}={1-2}{blue}, } \SetCell[r=3]{c} {\textbf{Designation}} & \SetCell[r=3]{c} \textbf{Mass per metre} & \SetCell[r=2]{c} \textbf{Depth of section} & \SetCell[r=2]{c}\textbf{Width of section} & \SetCell[c=2]{c} \textbf{Thickness} & & \SetCell[r=2]{c} \textbf{Root radius} & \SetCell[r=2]{c} \textbf{Depth between fillets} & \SetCell[c=2]{c,wd=3.4cm} \textbf{Ratios for local buckling} & & \SetCell[c=2]{c,wd=4cm} \textbf{Second moment of area} & & \SetCell[c=2]{c,wd=3.4cm} \textbf{Radius of gyration} \\ & & & & \textbf{of web} & \textbf{of flange} & & & \textbf{Flange} & \textbf{Web} & \textbf{x--x} & \textbf{y--y} & \textbf{x--x} & \textbf{y--y} \\ & & $\bm{D}$ & $\bm{B}$ & $\bm{t}$ & $\bm{T}$ & $\bm{r}$ & $\bm{d}$ & $\bm{B/2T}$ & $\bm{d/t}$ & $\bm{I_{xx}}$ & $\bm{I_{yy}}$ & $\bm{r_{xx}}$ & $\bm{r_{yy}}$ \\ \textbf{Serial size} & kg/m & mm & mm & mm & mm & mm & mm & & & \si{\textbf{cm}^{\bm{4}}} & \si{\textbf{cm}^{\bm{4}}} & cm & cm \\ 356 × 171 × 45 & 45.0 & 351.4 & 171.1 & 7.0 & 9.7 & 12.7 & 306.6 & 8.82 & 43.8 & 12195 & 811 & 14.50 & 3.75 \\ \end{tblr}} \end{document} my end goal
- Why does the hook in \chapter fail?by Explorer on March 26, 2026 at 4:56 pm
I have to automatially switch from two-multicols and onecolumn mode with \chapter, here below is what I was after: \documentclass[openany]{book} \usepackage{multicol} \usepackage{lipsum} \begin{document} \chapter{AAAAAAAAAAAAAAAA} \begin{multicols}{2} \section{11} \lipsum[1-3] \section{22} \lipsum[1-3] \end{multicols} \chapter*{BBBBBBBBBBBBBBBBB} \begin{multicols}{2} \section*{11} \lipsum[1-3] \section*{22} \lipsum[1-3] \end{multicols} \chapter{CCCCCCCCCCCCCCCCC} \begin{multicols}{2} \section{11} \lipsum[1-3] \section{22} \lipsum[1-3] \end{multicols} \end{document} However, I want to hook to switch the one/two-columns with \chapter, I tried with: \documentclass{book} \usepackage{multicol} \usepackage{lipsum} \makeatletter \AddToHook{cmd/chapter/before}{\ifnum\col@number>1\end{multicols}\fi\clearpage} \AddToHook{cmd/chapter/after}{\begin{multicols}{2}} \AtEndDocument{\ifnum\col@number>1\end{multicols}\fi} \makeatother \begin{document} \chapter{AAAA} \lipsum[1-3] \chapter*{BBBB} \lipsum[1-3] \chapter{CCCC} \lipsum[1-3] \end{document} but it complained with: ! Argument of \hook_use:nnw has an extra }. <inserted text> \par l.13 \chapter {AAAA} ? Looks like there exists some group mismatch ;-( I wonder why this happened? And how to achieve what I want?
- tikz, drawing edge with option "double"by Zarko on March 26, 2026 at 4:13 pm
I'm just curious why drawing a line with edge doesn't consider option double. For example: \documentclass[margin=1pt, 11pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[auto=right, Jvmes/.style args = {#1/#2}{very thick, double distance=#1, draw=#2, double=#2!30}, Jvmes/.default = 2mm/orange, ] \draw[Jvmes] (0,0) -- ++ (0,1); % works as expected \draw[Jvmes] (1,0) edge ++ (0,1); % doesn't works \end{tikzpicture} \end{document}
- How to restore Type1-style subscript placement when using unicode-math?by tmc on March 26, 2026 at 2:20 pm
I recently noticed that switching from Type1 Latin Modern to OpenType Latin Modern (via unicode-math) changes the placement of subscripts (and superscripts) in both inline and display math. Inline math Consider \sum_{k = 1}^{n} a_{k}. With Type1 Latin Modern (loaded via the lmodern package), the result looks like this: Notice how the subscripts sit compactly: the subscript k in the operator does not protrude far below the baseline; also notice the subscript k in the term of the sum. With OpenType Latin Modern and unicode-math, the result is as follows: Notice that the subscript k on the operator protrudes noticeably further below the baseline, and the subscript k in a_{k} also drops lower. I prefer the Type1 behavior, where the subscripts are more compact and the overall inline expression feels tighter, so that the formula wont't stick out too much. The following GIF might also be helpful to further notice the differences: the first frame is Type1 Latin Modern and the second frame is OpenType Latin Modern. Display math A similar, but opposite, issue appears in displayed sums: with unicode-math, the upper limit n of the index of summation appears noticeably closer to the \sum operator than with Type1 fonts. I am happy with this aspect of the unicode-math behavior. However, the subscript k in the term a_{k} once again drops lower with unicode-math. This may be fine in this context, since it is a formula in display mode (hence, one does not need to be concerned with how it fits with subsequent lines in a paragraph); nevertheless, for consistency with the inline case, I would also prefer to restore the Type1 behavior for subscript placement. Here is a GIF — the first frame is without unicode-math, and the second frame is with unicode-math: Minimal working example (MWE) For Type1 Latin Modern, compile with pdftex: \documentclass{article} \usepackage{lmodern} \begin{document} \(\sum_{k = 1}^{n} a_{k}\) \[ \sum_{k = 1}^{n} a_{k} \] \end{document} For OpenType Latin Modern via unicode-math, compile with luatex: \documentclass{article} \usepackage{unicode-math} % Latin Modern Math is the default font; included for clarity. \setmathfont{Latin Modern Math} \begin{document} \(\sum_{k = 1}^{n} a_{k}\) \[ \sum_{k = 1}^{n} a_{k} \] \end{document} Question Is there a way to restore subscript placement as in the Type1 Latin Modern defaults, without switching back to Type1 fonts? Also, should I do it? That is: would this break other features where one would actually want the subscript placement of unicode-math?
- Multi attribute listsby mf67 on March 26, 2026 at 1:25 pm
I'm trying to understand “lists” and made an attempt to store 2 attributes (name and dates); \documentclass{book} \ExplSyntaxOn \prop_new:N\g_personA_prop \prop_new:N\g_personB_prop \newcommand\storeperson[3]{ \prop_gput:Nnn\g_personA_prop{#1}{#2} \prop_gput:Nnn\g_personB_prop{#1}{#3} } \newcommand\person[1]{ \prop_item:Nn\g_personA_prop{#1}~(\prop_item:Nn\g_personB_prop{#1}) } \ExplSyntaxOff \storeperson{001}{Johann Sebastian Bach}{1685–1750} \storeperson{002}{Ludwig van Beethoven}{1770–1827} \begin{document} \person{001} and \person{002} \end{document} Is this the correct way? Is there a better way to store multiple attributes? Is the ~ the correct “hard space” code? I think I read that ~ is treated differently in latex3. (Credit to Ulrike Fischer, who originally made another (one-attribute) macro from which I “Frankenstein’ed” the above attempt.)
- Incompatibilities bewteen xfrac and lua-unicode-mathby PHL on March 26, 2026 at 7:25 am
The following MWE gives 3 warnings Font shape in size <3.486> not available with lua-unicode-math, but none with unicode-math % !TEX TS-program = lualatex \documentclass{article} \usepackage{xfrac}% \sfrac for a/b fractions \usepackage{lua-unicode-math} %\usepackage{unicode-math} \begin{document} \(\sfrac{4}{5}\) \end{document} It is unclear to me if the fix should be on the xfrac side or on the lua-unicode-side. The three warnings are for OT1/cmr/m/n, OML/cmm/m/it and OMS/cmsy/m/n. Changing the separator (as in \sfrac{4}[L]{5}) does not remove the warnings.
- Defining list of commands using \foreachby Lorenzo Riva on March 25, 2026 at 11:02 pm
I want to use a \foreach loop to define a series of commands of the form \bf\l where \l runs through the uppercase letters of the alphabet and \bf\l evaluates to \mathbf{\l}. This is so that I don't have to manually define \bfA, \bfB, etcetera at the start of all my documents. I've tried the following setup (patched together from Defining a newcommand, with variable name, inside another newcommand): \documentclass{article} \usepackage{amsmath,pgffor} \foreach \l in {A,B,C,D} { \expandafter\newcommand\csname bf\l\endcsname{ \mathbf{\l}% } } \begin{document} $\bfA$ $\bfB$ $\bfC$ $\bfD$ \end{document} It resulted in four errors, namely that the four commands are undefined. Where am I going wrong, and why does this not work?
- How to Vertically Stretch Arched Wordsby Jethro on March 25, 2026 at 10:52 pm
MWE: \documentclass[12pt]{book} \usepackage{tikz,xcolor,scalefnt,scalerel} \usetikzlibrary{decorations.text} \begin{document} \thispagestyle{empty} {\Huge{\scalefont{1.25}{ \begin{tikzpicture} \path[-latex,white!30!black,postaction={decorate},decoration={text along path,text={HOW TO ADD A VERTICAL STRETCH?},text color={black},text align=center}] (7,0) arc [start angle=180,end angle=0,radius=7]; \end{tikzpicture}}}} \end{document} which produces: How may I add a vertical stretch to the letters? I have called in the scalerel package and tried placing \vstretch{}{} at various places in the code, but to no avail. It is necessary that I compile the code with xelatex.
- Nesting decorations in TikZ disconnects subpathby Sandy G on March 25, 2026 at 9:49 pm
The decorations in the decorations.fractals library can be used to create fractal lines by applying the decoration repeatedly to an originally straight path. (This can be done with decorations from other libraries as well.) For example, the code \begin{tikzpicture}[decoration=Koch snowflake] \draw decorate{decorate{decorate{(0,0)--(3,0)}}}; \end{tikzpicture} produces the expected result. When a decoration is applied to a subpath however, nesting the decoration produces a result I did not expect. Namely, the decorated subpath appears to be disconnected from the path as a whole. Consider the following image: which is produced by the code below. A single iteration of the decoration produces a closed path (orange) as expected. But when the decoration is nested (blue) the --cycle does not close the whole path, only the portion beginning with the decoration. If you look closely, you can see that the first segment of the path is not connected to the decorated portion. What is the reason for this behavior? Note the partial fix in purple does not solve the problem (unless one only wanted to fill the path without drawing it) but it does show that the --cycle is not the problem—the issue is the missing connection between the initial segment and the decorated segment. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.fractals} \begin{document} \begin{tikzpicture}[decoration=Koch snowflake] \draw[help lines] (0,0) grid (5,3); \draw[orange, very thick] (1,0)--(0,0) decorate{--(0,3)}--cycle; \draw[blue, very thick] (3,0)--(2,0) decorate{decorate{--(2,3)}}--cycle; \draw[purple, very thick] (5,0)coordinate(A)--(4,0) decorate{decorate{--(4,3)}}--(A); \end{tikzpicture} \end{document}
- Gray vector appears with fading in TikZby Sebastiano on March 25, 2026 at 8:33 pm
In TikZ, for my previous answer here: Circular Motion when I use the fading library to create a vector with a fading effect, a smaller gray vector appears inside the main vector. Why does this happen, and is there a way to prevent the inner gray vector from being visible? \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{tikz} \usetikzlibrary{arrows.meta, decorations.markings} \usetikzlibrary{fadings} \usepackage{newtxmath} \definecolor{myblue}{RGB}{0, 119, 200} \definecolor{mygreen}{RGB}{27, 175, 78} \definecolor{myorange}{RGB}{245, 130, 32} \begin{document} \begin{center} \begin{tikzpicture}[ vvec/.style={mygreen, line width=2.5pt, -{Latex[length=5mm, width=4mm]}}, avec/.style={myorange, line width=2.5pt, -{Latex[length=5mm, width=4mm]}}, dot/.style={circle, fill=black, inner sep=0pt, minimum size=7pt} ] \def\R{2.5} \draw[gray!20, line width=4mm, -{Latex[length=7mm, width=8mm]}, path fading=north] (155:\R+0.8) arc (155:205:\R+0.8); \node at (180:\R+1.5) {\Large $\boldsymbol{\omega}$}; \end{tikzpicture} \end{center} \end{document}
- Online tool to write LaTeX formulas on a non-editable PDFby Sebastiano on March 25, 2026 at 8:26 pm
Suppose I have a PDF containing Math or Physics exercises, but it is not editable. I would like to know if there is an online tool or web service that allows me to: Upload the PDF. Preview the pages. Write LaTeX formulas directly on top of the PDF (for example, as annotations or overlays). Basically, I am looking for a way to add formulas written in LaTeX to the original PDF without having to recreate the entire document from scratch. Are there any tools like this available? Addendum: After my question I have found PDF Annotator but it is not free.
- longtable cell is not expanded when using multirowby Snowrabbit on March 25, 2026 at 5:52 pm
I like to use longtable because table will be long and span several pages. But I have a problem using multirow in the longtable, the cell is not expanded vertically. How to use multirow correctly in a longtable? Can someone explain in simple terms why the cell doesn't expand? If you have any suggestions for improvements to the code, I would be grateful 🙂 \documentclass{article} \usepackage{longtable} \usepackage{multirow} \usepackage{multicol} \usepackage{lipsum} \usepackage[table]{xcolor} \usepackage{array} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \begin{document} \begin{longtable}[c]{|L{1cm}|L{3cm}|L{1cm}|L{7cm}|} \caption{Long table with multirow} \label{tab:long table with multirow}\\ \hline \rowcolor{lightgray}\textbf{Col 1} & \textbf{Col 2} & \textbf{Col 3} & \textbf{Col 4}\\ \hline \endfirsthead \hline \rowcolor{lightgray}\textbf{Col 1} & \textbf{Col 2} & \textbf{Col 3} & \textbf{Col 4}\\ \hline \endhead 1 & Name 1 & 42 & \multirow[t]{3}{=}{\lipsum[1]} \\ 2 & Name 2 & & \\ 3 & Name 3 & & \\ \hline \end{longtable} \end{document} This is what I get: This is the desired result: I apologize if the question has already been answered elsewhere and please provide a reference.
- sourcesanspro and siunitx conflictby Paul on March 25, 2026 at 2:20 pm
I'm using sourcesanspro as my default text font to write my thesis (with fourier for the math mode), along with siunitx to deal with number and units printing. Everything was working just fine until I decided to update all of my packages with miktex and especially the sourcesans package. The error I got is : ! Use of ??? doesn't match its definition. ??? ! LaTeX Error: Erroneous variable \l__siunitx_print_version... l.27 ...mathrm{l} \left[\unit{\ohm\per\kilo\meter} \right] \cdot x \left[\un... If you say, e.g., \def\a1{...}', then you must always put 1' after `\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it. This error happen for every siunitx command (\qty, \unit, \num) used in math mode. Outside of math mode (in text mode), it seems to be ok. Here is a MWE : \documentclass[12pt]{article} \usepackage[utf8]{inputenc}\usepackage[T1]{fontenc} \usepackage[default]{sourcesans} % Police Source Sans \usepackage{amsmath,mathtools,amssymb,amsthm,amsfonts,bm,siunitx,commath,xfrac} % Math Presets \sisetup{detect-family=true, detect-mode=true, detect-weight=true, detect-shape=true} %police pour siunitx \begin{document} $\unit{\ohm\per\kilo\meter}$ \unit{\ohm\per\kilo\meter} \qty{90}{\kilo\volt} \end{document} I reported this bug to the sourcesans package git hub (https://github.com/silkeh/latex-sourcesanspro/issues/10#issue-4128078876) and still waiting for a response. What should I do ? Should I try to manually roll back the update ? How should i do that ? Thanks for your help
- ltx-talk: \visible command not working as I expectedby Svend Tveskæg on March 25, 2026 at 12:50 pm
Consider the following (almost?) MWE: % lualatex test.tex \DocumentMetadata{ lang = da, tagging = on } \documentclass{ltx-talk} \usepackage{fontspec} \usepackage{pstricks} \begin{document} \begin{frame}{\visible<1->{Exercise}} \begin{enumerate} \item \visible<2->{A} \visible<3->{B} \visible<4->{% \begin{center} \begin{pspicture}(8,2) \psframe(8,2) \end{pspicture} \end{center}}% \end{enumerate} \end{frame} \end{document} Do to the order of the visible<n->{} commands, I expected the PSTricks drawing to not show up before the 4th slide but it is drawn right from the beginning. Question How do I fix the above-mentioned "issue"? Thanks in advance.
- The order of \pgfkeys always mattered in tikz's option?by Explorer on March 25, 2026 at 12:11 pm
I have the following code example: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \draw[->,>=latex] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \draw[>=latex,->] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,below=of tmp,node distance=.5cm] {below}; \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,node distance=.5cm,below=of tmp] {below}; \end{tikzpicture} \end{document} Which gives the following: What I get confused is that: ->,>=latex and >=latex,-> behaves the same below=of tmp,node distance=.5cm honer the default value node distance=1cm, and node distance=.5cm,below=of tmp honer the previous node distance=.5cm Why caused the difference between >= and node distance? How to know whether an option's order is important with \pgfkeys? Edited: As jps commented: Keys are generally ordered as key code is executed in the order given. Whether the order of keys then matters strongly depends on the key code. The way to know whether an option's order matters is to either know the implementation by heart, or trial and error and Jasper Habicht supplemented that: Some keys only store a value in a macro that is later retrieved (which is true for the arrow settings, for example). The values stored in the macros are only retrieved when the arrows is drawn, that is at the end of the path. But other keys actually use values that are stored in macros and if these values are set my other keys, the order is relevant. But as was said above: You really need to know how the implementation is exactly to know whether the first or the second holds in a specific case. Here below is my follow-up doubt: In my understanding, "TikZ keys are applied in the order they are given", so is the following always safer (avoid the unexpected behavior of below=of tmp,node distance=.5cm)? >=latex,->: define the arrow style at first, then set the arrow node distance=.5cm,below=of tmp: set the distance at first, then apply the position
- Setting fixed text labels for enumerate-based environment according to the item counterby Stephen on March 24, 2026 at 12:47 pm
\documentclass{article} \usepackage{enumitem} \newlist{syntax}{enumerate}{1} \renewcommand{\labelsyntaxi}{\bfseries\ifcase\value{syntaxi}\or Usage\or Argument\or Return\fi} \begin{document} \begin{syntax} \item aaa \item bbb \item ccc \end{syntax} \end{document} I've defined an enumerate-based environment (called syntax) and I want the first three labels are Usage, Argument and Return, respectively. However, the above code gives error. How to fix and what's the reason behind the error? Similar question: enumerate with custom alphabet for items
- Index of topics at beginning of documentby Martin on March 24, 2026 at 10:20 am
I have a document, where I describe topics (one page per topic). I want to have a list of all topics together with some additional information at the beginning of the document. So far my solution is this: First I make a file whrere the list is at the end of the file. MWE (file called Themen.tex): \documentclass[a4paper,12pt]{scrartcl} \usepackage{longtable} \newcounter{nummer} \def\Uebersicht{% Nr. & Topic & A & Page \\\hline \endfirsthead Nr. & Topic & A & Page \\\hline \endhead } \usepackage{hyperref} \newcommand{\Thema}[3]{% \refstepcounter{nummer}\label{#3}% \begin{center} \LARGE #1 \end{center} \begin{table}[h!] \centering \begin{tabular}{p{4.3cm}p{1cm}p{11cm}} A: && #2 \end{tabular} \end{table} \hrule \appto\Uebersicht{\getrefnumber{#3} & #1 & #2 & \pageref{#3} \\} } \begin{document} \clearpage \Thema{A}{A}{A} \clearpage \Thema{B}{B}{B} \clearpage \Thema{C}{C}{C} \clearpage \Thema{D}{D}{D} \clearpage \clearpage \begin{longtable}[h!]{r|p{0.48\linewidth}|p{0.34\linewidth}|r} \centering \Uebersicht \end{longtable} \end{document} Afterwards, I rearrange the pages. MWE: \documentclass{scrartcl} \usepackage{pdfpages} \pdfximage{Themen.pdf}% Read entire PDF \edef\totalpages{\the\pdflastximagepages}% Store number of pages \edef\lastbutonepage{\number\numexpr\totalpages-1}% Store last page - 1 \begin{document} \includepdf[pages=last]{Themen} \includepdf[pages=1-\lastbutonepage]{Themen} \end{document} The problem is, that in the end, the cross-references to pages inside the document, as well as external links that I put in the description of the topics do not work. How can I achieve what I want with working links (either with my 2-file-solution or directly)?
- Why does \DocumentMetadata conflict with package mdframed?by Randall on March 23, 2026 at 5:05 pm
In an effort to meet federal (US) law for accessibility of documents, I have started experimenting with various accessibility enhancements for my LaTeX source files. (As a stable TeX user for over 30 years, this is a big change to process.) Following advice posted here and at the LaTex Tagging Project, I have been including the following as the first line in my source: \DocumentMetadata{lang = en, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on, tagging-setup={math/setup=mathml-SE}} I must say, this has thus far worked marvelously. When I compile using LuaLaTeX, I get a PDF that passes all my institution's accessbility checkers. So far, a lifesaver. The sole issue I've experienced is in using the package mdframed. When I attempt to use the package, as in something like \begin{mdframed} This is a key point! \end{mdframed} I get the following fatal error: l.74 This is a key point! ? h Try typing <return> to proceed. If that doesn't work, type X <return> to quit. No output is created. I have toggled on and off all reasonable combinations of packages, and the error only occurs when mdframed is invoked while the DocumentMetadata is inserted. I feel that I am a bit over my head here, so am looking for an explanation of this conflict or a fix for it. I fully admit that I may have something set incorrectly in the DocumentMetadata call, because I do not completely understand the effect that is having.
- How to protect a comma in a name in biblatex (to cite someone known by a noble title)by Roel on March 23, 2026 at 4:08 pm
I would like to cite J. W. Strutt, who--to the best of my knowledge---is best known as Lord Rayleigh: https://archive.org/details/theorysound03raylgoog/page/108/mode/1up I think the name should appear as "J. W. Strutt, Baron Rayleigh" or---to facilitate looking up "Rayleigh" in a sorted list---"Rayleigh, J. W. Strutt, Baron". The latter format (also shown on archive.org) is something I don't see on a daily basis, so maybe there is a better way. This is how far I got. Since I don't think it is common to show his 'real' family name, but also it should not be abbreviated to initials, I treat it as a prefix. Mind that the extra comma in the name is something the bibliography system (biber+biblatex) will choke on, so I had to hide it. Unfortunately, simple wrapping {,} or obfuscating \char44 did not work so I ended up with this: \documentclass{article} \usepackage[ giveninits=true ]{biblatex} \usepackage[hidelinks]{hyperref} \addbibresource{main.bib} \begin{document} According to \textcite[\href{https://archive.org/details/theorysound03raylgoog/page/108/mode/1up}{p 108}]{Rayleigh1878ThSoundv2}: ``Measured by the resulting potential, a source of given magnitude, i.e. a source at which a given introduction and withdrawal of fluid takes place, is thus twice as effective when close to a rigid plane, as if it were situated in the open; and the result is ultimately the same, whether the source be concentrated in a point close to the plane, or be due to a corresponding normal motion of the surface of the plane itself.'' \printbibliography % Once more with names in a different format: \DeclareNameAlias{author}{family-given} \printbibliography[title={References with `family' name first}] \end{document} @preamble{{\newcommand{\comma}{,}}} @book{Rayleigh1878ThSoundv2, title = {The Theory of Sound}, author = {given=John William, prefix={Strutt\comma\ Baron}, family=Rayleigh}, publisher = {MacMillan \& Co., Ltd.}, date = {1896}, volume = {2}, url = {https://archive.org/details/theorysound03raylgoog} } This just doesn't feel right, but is there a better way?
- TikZ externalization fails with precompiled header (.fmt) and "Incomplete \iffalse" errorby dp21 on March 23, 2026 at 12:26 pm
I am trying to speed up the compilation of a complex project using a format file and tikz externalize. In particular I tried a setup like shown in the follwing MWE: preamble-min.tex \documentclass[a4paper,12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{external} \dump main-min.tex: \tikzset{ external/system call={% pdflatex -shell-escape -fmt=preamble-min \ -interaction=nonstopmode -jobname "\image" "\def\tikzexternalrealjob{\texsource}\input{\texsource}"% } } \tikzexternalize[prefix=tikz-cache/] \begin{document} \begin{tikzpicture} \begin{axis} \addplot+[raw gnuplot, mark=none] gnuplot { plot [-5:5] sin(x); }; \end{axis} \end{tikzpicture} \end{document} Compilation Steps: mkdir -p tikz-cache pdflatex -ini -shell-escape -jobname=preamble-min "&pdflatex preamble-min.tex" pdflatex -shell-escape -fmt=preamble-min main-min.tex The compilation stops with: ! Incomplete \iffalse; all text was ignored after line 19. <inserted text> \fi <*> main-min.tex Any ideas how to make this work well and robust? I am using texlive-2025.
- Tikz-cd arrow labels conflict with background colourby Amitai on March 22, 2026 at 6:11 pm
I'm using q.uiver.app to make commutative diagrams for a project. There is a feature that allows for the label of an arrow to be displayed directly above it. This creates a white background for the label, which clashes visually with the background box. Here is an example of what it looks like: Here is an example of the code for the commutative diagram, using {description} to overlay the text above the arrow: \[\begin{tikzcd} Q &&& \\ & P && X \\ \\ & {X'} && Y \arrow["{\exists!h}"{description}, dashed, from=1-1, to=2-2] \arrow["p"{description}, from=1-1, to=2-4] \arrow["q"{description}, from=1-1, to=4-2] \arrow["a"{description}, from=2-2, to=2-4] \arrow["b"{description}, from=2-2, to=4-2] \arrow["f"{description}, from=2-4, to=4-4] \arrow["g"{description}, from=4-2, to=4-4] \end{tikzcd}\] I'm using a template for the project; here is what the stylesheet uses to define the lemma/proof boxes: % proofs: proof \definecolor{prooflinecolor}{RGB}{103, 103, 103} % rgba(40, 40, 40, 180) %FORMAT \definecolor{proofbgcolor}{RGB}{247, 247, 247} % rgba(40, 40, 40, 10) %FORMAT \linedbox{@proof}{Proof}{proof}{proofbgcolor}{prooflinecolor} % this numbers the proofs, so we renew the environment to prevent that; but we still allow a title, so you can do e.g. "Proof (of Theorem 1.2.3)" \def\qed{\null\nobreak\hfill\ensuremath{\blacksquare}} % qed square %FORMAT switch \blacksquare to \square for the not-filled-in version \renewenvironment{proof}[1][]{\csname @proof*\endcsname{#1}{}}{\qed\csname end@proof*\endcsname} \def\flushproof{\vspace{-\parskip}} % put this before a proof to make it flush with the result it's proving How do I make this white background transparent? Or, if necessary, how do I set it to a certain colour (so that I can just choose the backdrop colour)?
- I am trying to make a really cool animation using Koch snowflakes, but don't know howby Jasper on March 22, 2026 at 3:28 pm
I was scrolling through reels earlier and came across a really cool animation: https://www.youtube.com/shorts/aQbq_Fpyyb4. Note: You can analyze the gif frame by frame using the method suggested by MS-SPO in the comments, or by using the website ez-gif, or by using custom python scripts. I interchangeably use ez-gif and python for these sorts of things, and in this instance used ez-gif. I did some digging and found this old post, which I modified slightly. % Source - https://tex.stackexchange.com/a/205608 % Posted by Mark Wibrow % Retrieved 2026-03-22, License - CC BY-SA 3.0 \documentclass[tikz, border=5]{standalone} \usetikzlibrary{lindenmayersystems} \tikzset{koch snowflake/.style={insert path={% l-system [l-system={rule set={F -> F-F++F-F}, axiom=F++F++F, step=0.75cm/3^#1, angle=60, order=#1,anchor=center}] -- cycle}}} \begin{document} \begin{tikzpicture} \path[fill=orange,koch snowflake=4]; \end{tikzpicture} \end{document} I am however without a clue as to how to go about producing this gif I found. I am seeking assistance in creating this gif.