Week
- Is there a straightforward way to break and align an equation on more than one 'level'?by Simon on April 1, 2026 at 4:46 pm
There is an equation that I would like to break and align as follows: ( in the second line and - in the third line should be aligned the same way that [ in the first line and + in the second line are, which requires aligning on more than one 'level' if level is the correct term. Intuitively, it would work as shown in the MWE, just with && not commented out: & for the first 'level' and && for the second one. (The concept could be extended by &&& for the third one and so on.) \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} E_\mathrm{kinetic}=\frac{1}{2}&\left[m_\mathrm{1}\left(v_\mathrm{1}-v_\mathrm{2}\right)^2\right.\notag\\ &\left.+m_\mathrm{2} % && \left(v_\mathrm{3}+...+...+...+...+a\omega_\mathrm{1}\right.\right.\notag\\ % && -\left.\left.b\omega_\mathrm{2}-...-...-...-...-v_\mathrm{4}\right)\right] \end{align} \end{document}
- How to colorized any line drawed with draw (nor with plot expression)?by Mika Ike on April 1, 2026 at 1:44 pm
How to colorized any line drawed with draw (nor with plot expression)? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines = middle, %title={Cor baseada no valor de $y$}, title={Color depending on $y$ coordinate}, colormap/hot % Podes usar 'hot', 'cool', 'jet', etc. ] \addplot[ mesh, % Divide o trazo en segmentos para aplicar cores thick, domain=-3:3, samples=100, point meta=y % Indica que a cor depende do valor de y ] {x^2}; % A función matemática \draw[thick, xshift=0.5,rounded corners] (-2,0.5) .. controls (0,-1) and (0,7) .. (1,7.8) .. controls (2,1) and (2,4) .. (3,3) node[anchor=east,pos=0.95] {How to colorize black line with colormap?} node[anchor=north east,pos=0.95] {depending on $y$ coordinate}; \end{axis} \end{tikzpicture} \end{document}
- Retrieve coordinates of self-intersections of a curveby Ventrikle on April 1, 2026 at 11:06 am
I am trying to extract the intersection points of a closed curve using the spath3 package. Currently, I have managed to find these points by splitting the path at self-intersections and then using the spath cs (coordinate system) on the resulting components. However, I noticed that the spath3 documentation doesn't seem to provide a direct command for "finding intersections" and returning them as coordinates. My current workaround involves a somewhat manual process: splitting the path, identifying components, and then grabbing the coordinates at the end of specific segments. Here is my MWE. \documentclass[tikz, border=10pt]{standalone} \usetikzlibrary{spath3, knots, hobby, intersections} \begin{document} \begin{tikzpicture}[ use Hobby shortcut, ] \path[spath/save=trefoil] ([closed]90:2) foreach \k in {1,...,3} {.. (-30+\k*240:.5) .. (90+\k*240:2) } (90:2); \tikzset{ spath/.cd, split at self intersections=trefoil, remove empty components=trefoil, get components of={trefoil}\pathcomponents, } % Label each component at its midpoint for reference \foreach[count=\k] \cpt in \pathcomponents { \node[] at (spath cs:{\cpt} 0.5) {\tiny \k}; } % Extracting coordinates before inserting gaps \foreach[count=\k] \i in {1, 3, 5} { \coordinate (A\k) at (spath cs:\getComponentOf{\pathcomponents}{\i} 1); } \tikzset{ % Gaps are inserted after coordinate retrieval. % If inserted earlier, spath cs would only capture positions within the fragmented arcs. spath/insert gaps after components={trefoil}{10pt}{1,3,5}, } \draw[spath/use=trefoil]; % Mark the original intersection points \foreach \k in {1,2,3} { \fill[red, opacity=0.5] (A\k) circle[radius=2pt] node[above, black, opacity=1] {\color{red}\(\k\)}; } \end{tikzpicture} \end{document} While this code works, it feels like a "workaround." Is there a more concise or idiomatic way to retrieve these intersection coordinates directly using spath3 or its integration with the intersections library?
- circuitikz, how to prettify connection between transformer and connecting lines?by Zarko on March 31, 2026 at 10:52 pm
I would like to reproduce the following image using the circuitikz package: So far I was able to write the following MWE: \documentclass[border=1mm, 11pt]{standalone} \usepackage{circuitikz} \usetikzlibrary{positioning} %---------------------------------------------------------------% \begin{document} \begin{circuitikz}[ node distance = 3mm and 7mm, N/.style = {draw, minimum height=13mm, text width=#1, font=\small\linespread{0,84}\selectfont, align=center}, ] \ctikzset{inductors/coils=6, quadpoles/transformer core/inner = 1.0, quadpoles/transformer core/width = 0.5, quadpoles/transformer core/height= 0.68} \node (n1) [N=13mm] {SPE\\ PHY}; \node (n2) [transformer core, rotate=90, transform shape, right=of n1, anchor=base] {}; \node (n3) [transformer core, right=of n2.south] {}; \node (n4) [N=23mm, right=of n3] {common mode\\ termination}; %--- \draw[semithick] (n2.north east) -- (n2.north east -| n1.east) (n2.north west) -- (n2.north west -| n1.east) % (n2.south east) |- (n3.north west) (n2.south west) |- (n3.south west) % (n3.north east) -- (n3.north east -| n4.west) (n3-L2.midtap) -- (n4.west) (n3.south east) -- (n3.south west -| n4.west); %-------------------- \end{circuitikz} \end{document} which produce: As you can see, connections between transformers and connecting lines are not as on image, which I want to reproduce. Is there a (if possible simple) way to improve these connections?
- Phantom overline over visible expressionby Michael on March 31, 2026 at 4:22 pm
The following code: \documentclass{article} \begin{document} \[ f(x',\overline{x'}) \] \end{document} produces the following output for me: I'm a bit bothered that the heights of the primes are mismatched. My first thought for how to fix this issue was to add a phantom overline over the first argument so that the prime in the first argument would get pushed down to the same height. However, despite some experimentation with syntax (\phantom{\overline}{x'} for instance), I couldn't find something which compiles. Apologies if this has been asked before. The inverted version of this question overline over no text does not seem relevant here.
- Graph of f and f' with luacas packageby Sebastiano on March 31, 2026 at 1:29 pm
Recently I have discovered the interesting package named luacas (compilable with LuaLaTeX). To pag. 14 of the manual https://ctan.mirror.garr.it/mirrors/ctan/macros/luatex/latex/luacas/doc/luacas.pdf I have not understood the necessary packages to put in the preamble to compile the MWE to plot f and f'. Someone please, can help me? Here the fragment of the code: \directlua{ tex.print(h:tolatex()) } For Bob’s purposes, \fetch{h} is exactly what he needs: \begin{tikzpicture}[scale=0.9] \begin{axis}[legend pos = north west] \addplot [domain=-3.5:1.5,samples=100] {\fetch{h}}; \addlegendentry{$f$}; \addplot[densely dashed] [domain=-3.25:1.25,samples=100] {\fetch{dh}}; \addlegendentry{$df/dx$}; \addplot[gray,dashed,thick] [domain=-3.5:1.5] {0}; \end{axis} \end{tikzpicture} Alternatively, Bob could use \store. The \store command will fetch the contents of its mandatory argument and store it in a macro of the same name. \store{h} \store{dh}
- Is there a lowercase Greek letter font with a fixed width in math format?by 2023 Siri on March 31, 2026 at 1:20 pm
I've noticed that monospaced fonts have uppercase Greek letters but no lowercase Greek letters. Is there a mathematical format to resolve this issue with monospaced fonts? \documentclass{article} \begin{document} $\mathtt{\Gamma \Delta \Theta \Lambda \Xi \alpha \beta \gamma \delta}$ \end{document}
- Hyperlink does not scale in pgfplotsby Thomas on March 31, 2026 at 10:32 am
I have a figure drawn with pgfplots where I cite a reference in the legend. the issue I have is when I try to scale the whole figure, I noticed that the green hyper link for the reference is not scaled and inserted at the original place. Here is an ECM with on the one hand the figure in whole size, and on the other hand the figure scaled. \documentclass{article} \usepackage{biblatex} \usepackage{hyperref} \usepackage{pgfplots} \pgfplotsset{compat=1.5} \addbibresource{biblatex-examples.bib} \begin{document} \begin{tikzpicture} \begin{axis} \addplot[red, domain=-3e-3:3e-3, samples=51]{exp(-x^2 / (2e-3^2)) / (1e-3 * sqrt(2*pi))}; \addlegendentry{Text \cite{aksin}} \end{axis} \end{tikzpicture} % \begin{tikzpicture}[scale=0.9] \begin{axis} \addplot[red, domain=-3e-3:3e-3, samples=51]{exp(-x^2 / (2e-3^2)) / (1e-3 * sqrt(2*pi))}; \addlegendentry{Text \cite{aksin}} \end{axis} \end{tikzpicture} \printbibliography \end{document} On the linked export, we see that the second green boxed is not over the reference [1], but over the place it would have been if the figure were not scaled. Is it possible to set the correct location for this box ?
- Luadraw as a background imageby PHL on March 31, 2026 at 7:43 am
I would like to use a luadraw picture as a background image on a page. I tried overlay, but this is not working as the picture is shifted above right. Luadraw is not (yet?) on CTAN, but available on github: luadraw %!TEX TS-program = lualatex \documentclass[a4paper]{article} %\usepackage[ignoreall, margin=-0cm, marginparsep=0cm]{geometry} \usepackage{luadraw} \begin{document} \begin{luadraw}{} local g = graph:new{ margins={0,0,0,0} , size={31,31} , pictureoptions="overlay" } for j= 1, 5 do for k=1,10*j do g:Dcircle(Zp(j,k*math.pi/(5*j)),1) end end g:Show(true) \end{luadraw} % without overlay, the center of the picture (on a new page) is approximately at (20,10) (if (0,0) is the bottom left corner % with overlay, the center of the picture is out the page (at (30,50) ? maybe) \end{document} (The original picture is more complex than this one, so using a standard tikzpicture is not really an option)
- How do I break a link within \url{} only after / or //?by Simon on March 30, 2026 at 10:15 pm
I am required to break the links within \url{} to my references only after / or //, not after any other symbol that also might occur in a link. How do I implement this properly for all the links to my references at once? Have I just missed an option of the hyperref package or the \url{} command, or could an input to Forcing linebreaks in \url solve the problem? I have prepared a MWE to illustrate the problem: \documentclass{article} \usepackage[hidelinks]{hyperref} \begin{document} {\raggedright \begin{thebibliography}{} \bibitem[Reference 1]{reference1} Available at \url{https://tex.stackexchange.com/one/two-three/four_five_six} \bibitem[Reference 2]{reference2} Available at \url{https://tex.stackexchange.com/seven-eight-nine/ten_eleven/twelve} \end{thebibliography} } \end{document}
- Setting node style on specific slide, in a deferred mannerby ysalmon on March 30, 2026 at 7:43 pm
I want to animate a DFS in an example graph. I know I can use keys like onslide to activate specific styling on a given slide, but this requires to give the instruction at the place where the node is defined. I would like to be able to just specify the order in which DFS visits the nodes, eg. \foreach \val[count=\slide from 2] in {0,1,2,3,4,5,11,16,15,14,20,19,25,18,24,,31,30,,36,42,43,38,39,46,47,40,35,34,27} {set node l\val to be red-filled starting on slide \slide} I got the idea to use a expl3 proplist to store, on a given slide, which nodes should have which style (full code below). Then I can define a custom tikz style with some code to retrieve from the proplist and do a \pgfkeysalso. Presently, this works if I set the style to eg. fill. However, setting it to eg. fill=red gives an error Package pgfkeys Error: I do not know the key '/tikz/fill=red' and I am going to ignore it. Perhaps you misspelled it. I presume this is a catcode issue, but I am not able to solve it (I tried converting from tokenlist to expl3 string, to no avail). I know I can avoid the need for an = sign by defining a custom style with the appropriate colour (and this is better code style anyway). But still, this limitation is annoying. MWE : \documentclass{beamer} \usepackage{tikz} \ExplSyntaxOn \NewDocumentCommand{\DeferPropInit}{m} { \prop_gclear_new:c {__DeferPropList#1} } \NewDocumentCommand{\DeferPropReplace}{D<>{.-}mmm} { \only<#1>{\prop_gput:cee {__DeferPropList#2} {#3} {#4}} } % not used here, might be useful in other circumstances \NewDocumentCommand{\DeferPropAppend}{D<>{.-}mmm} { \only<#1>{\prop_get:ceNTF {__DeferPropList#2} {#3} \l_tmpa_tl {\prop_gput:cee {__DeferPropList#2} {#3} {\l_tmpa_tl, #4}} % #3 present in list {\prop_gput:cee {__DeferPropList#2} {#3} {#4}} % #3 not present in list } } \tikzset{DeferPropGet/.code~2~args = { \prop_get:ceNT {__DeferPropList#1} {#2} \l_tmpa_tl {\pgfkeysalso {\l_tmpa_tl}} }} % for debug \NewDocumentCommand{\DeferPropLog}{m}{\prop_log:c {__DeferPropList#1}} \ExplSyntaxOff \begin{document} \begin{frame} \begin{center} \begin{tikzpicture} \DeferPropInit{DFS} \foreach \val[count=\slide from 2] in {0,1,2,3,4,5,11,16,15,14,20,19,25,18,24,,31,30,,36,42,43,38,39,46,47,40,35,34,27} {\DeferPropReplace<\slide->{DFS}{l\val}{fill}} % breaks with {fill=red} %\DeferPropLog{DFS} % for debug \foreach \i in {0,...,5}{ \foreach \j in {0,...,7}{ \pgfmathtruncatemacro\eti{\i+\j*6} \draw(\j,-\i) node[DeferPropGet={DFS}{l\eti}] (l\eti) {\eti}; } } % graph edges omitted for brievety \end{tikzpicture} \end{center} \end{frame} \end{document}
- ltx-talk: \visible command not working as I expected, part IIby Svend Tveskæg on March 30, 2026 at 11:59 am
This is a follow-up question to ltx-talk: \visible command not working as I expected. Code IMPORTANT: I'm not near a TeX distribution at the moment so I don't know if the following will compile but I think this is the code that I tested at home. % lualatex test.tex \DocumentMetadata{ lang = da, tagging = on } \documentclass[ danish ]{ltx-talk} \usepackage{pstricks} \begin{document} \begin{frame}{\visible<1->{Exercise}} \begin{center} \begin{pspicture}(1,1) \visible<2->{\psframe(0,0)(1,1)} \end{pspicture} \end{center} \end{frame} \end{document} Problem The problem described in the first part is now solved after updating ltx-talk but there is still a problem; if I put \visible<n->{...} (for n > 1) inside a pspicture environment, the behaviour with the picture being drawn right from the start of the frame persists.
- Issue with kashida inside underlineby Salim Bou on March 30, 2026 at 11:21 am
This example of arabic text (babel with lualatex engine) does not give the desired result, text inside \underline with kashida activated displays an incorrect result. Used font Noto Naskh Arabic. \documentclass{article} \usepackage[bidi=basic]{babel} \babelprovide[import=ar, main, justification = kashida, transforms = kashida.base] {arabic} \babelfont{rm}{Noto Naskh Arabic} \begin{document} \large\bfseries \makebox[4cm][s]{سلام} \underline{\makebox[4cm][s]{سلام}} \end{document}
- Beamer miniframes: side-by-side gets shifted when \beamergotobuttonby scottkosty on March 29, 2026 at 5:18 pm
I am using code that makes it so the mini frames are on the same line as the section names. However, when I remove navigation symbols and use \beamergotobutton{}, the mini frames can "jump" (i.e., have vertical shift). The problem does not occur if I use "smoothbars" instead. I have the following example file, modified from Beamer miniframes: side-by-side section names and navigation dots. % Source - https://tex.stackexchange.com/a/88403 % Posted by diabonas, modified by community. Modified again by scottkosty to show problem. % Retrieved 2026-03-29, License - CC BY-SA 3.0 \documentclass[compress]{beamer} % using "smoothbars" does not give the same behavior. \useoutertheme[subsection=false]{miniframes} % remove the navigation bar \setbeamertemplate{navigation symbols}{} \usepackage{etoolbox} \makeatletter \patchcmd{\slideentry}{\advance\beamer@tempdim by -.05cm}{\advance\beamer@tempdim by\beamer@vboxoffset\advance\beamer@tempdim by\beamer@boxsize\advance\beamer@tempdim by 1.2\pgflinewidth}{}{} \patchcmd{\slideentry}{\kern\beamer@tempdim}{\advance\beamer@tempdim by 2pt\advance\beamer@tempdim by\wd\beamer@sectionbox\kern\beamer@tempdim}{}{} \makeatother \begin{document} \section{Sec 1} \subsection{} \frame{}\frame{hello \beamergotobutton{anything}}\frame{}\frame{} \section{Sec 2} \subsection{} \frame{}\frame{}\frame{}\frame{} \end{document} I get the following output. The problem can be seen on the second image of the sequence. On the second image, the first mini frame dot is shifted upwards for some reason.
- Why is "every [shape] node" applied after node options?by karlh on March 29, 2026 at 3:35 pm
As a sort of follow-up to a previous question, why is "every [shape] node" applied after node options? For example, \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[every rectangle node/.style={draw=black, minimum width=1cm,minimum height=1cm}] \node [rectangle] {hello!}; \node [rectangle] at (2.5,0) {hello again!}; \node [rectangle,minimum height=2cm] at (0,-2) {Hello, world!}; \bgroup \tikzset{every rectangle node/.style={draw=black,minimum width=1cm, minimum height=2cm}} \node [rectangle] at (2.5,-2) {Hello, world!}; \egroup \node [rectangle] at (0,-3.75) {goodbye!}; \end{tikzpicture} \end{document} which produces The two "Hello, world!" boxes should look the same, but because of the order in which things are applied, they do not. Creating a group with "every rectangle node" fixes it, as in the example, but is cumbersome. (The bgroup...egroup guards prevent the \tikzset settings from propagating to the rest of the picture, too.) My main question: Why is "every [shape] node" applied after the node options, overriding what is (presumably) the user's choice for that particular object, and is there interest from TikZ developers in changing that default to restore what seems to me to be the more intuitive behavior, that is, applying the "every [shape] node" settings just before the node's optional arguments, so the optional arguments override anything that is applied "globally"? If it would be helpful for me to raise this as an issue on Github, I can do that.
- Draw a TikZ path behind cell content and rules in nicematrixby projetmbc on March 29, 2026 at 2:47 pm
I want to draw a TikZ connector between two cells in a NiceTabular, but the path always appears on top of the rules (hvlines) and the text. If I use \CodeAfter, it's on top, and I can't use \CodeBeforebecause the nodes (i-j) are not recognized. How can I draw this path on the background layer? \documentclass[border = 3pt]{standalone} \usepackage{nicematrix} \usepackage{tikz} \begin{document} \renewcommand{\arraystretch}{1.2} \begin{NiceTabular}{>{\bfseries}*{6}{c}}[ hvlines, corners = NW, ] \RowStyle{\bfseries} & A & B & C & D & E \\ A & & & 1 & 1 & \\ B & & & & 1 & 1 \\ C & 1 & & & & 1 \\ D & 1 & 1 & & & \\ E & & 1 & 1 & & % \CodeAfter \tikz\draw[red, ->] (4-1.east) -| (1-2.south); \end{NiceTabular} \end{document}
- What is a better approach to plot the double path style as a subpath?by Explorer on March 29, 2026 at 3:03 am
I want to replicate something as below: Now is my code, but good with the conjunction (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 present and future of LaTeX: where to start?by PHL on March 29, 2026 at 1:14 am
Which ressources (and in which order) would you recommend to (re)learn modern LaTeX for an advanced user that learned LaTeX twenty years ago? I have the impression that many things have changed these past years: NewDocumentCommand, hooks, standard packages that became obsolete, useful things that have been moved to the kernel, utf8 support out of the box, … I thus need to update my LaTeX knowledge, but I am unsure to where to start. A document summarising the changes would be invaluable, but might not exist. An alternative would be recent ressources that assume some familiarities with TeX. If none of these exists, an introductory text will do. The emphasis is on learning things that will be useful in the present, but also in the future. Using experimental methods/packages is not a problem if there are good indications that they will be standard at some point in the future. On the opposite, I would like to avoid learning standard methods/packages that are doomed to be obsolete/deprecated soon. 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. A lot has happened these past 20 years and it seems reasonable to start anew in order to unlearn old habits and learn new ones.
- 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
- 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?
- How to refer the total chapter number and current chapter number in `shipout/background`?by Explorer on March 26, 2026 at 9:13 am
I want something decorative layout like this, where the magenta node indicated the current chapter(just for example): I have the following code now: \documentclass[12pt,oneside,openany]{book} \usepackage{libertine} \usepackage{lipsum} \usepackage{tikz,tikzpagenodes} \usetikzlibrary{matrix} \pagestyle{empty} \usepackage[showframe]{geometry} \usepackage{totcount} \regtotcounter{chapter} \ExplSyntaxOn \tl_new:N \l_matrix_content_tl \int_step_inline:nn {10} { \ifnum #1=4\relax%<-just for example \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} \fi \tl_put_right:Nn \l_matrix_content_tl {#1\\} } % I want something like this.. but not work % \int_step_inline:nn {\total{chapter}} { % \ifnum #1=\thechapter\relax % \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} % \fi % \tl_put_right:Nn \l_matrix_content_tl {#1\\} % } \AddToHook{shipout/background}{ \put (0pt,-\paperheight) {% \begin{tikzpicture}[% overlay,remember~picture, ]% % \node[draw,anchor=west,font=\sffamily\bfseries\Huge] at (current page marginpar area.west) {\thechapter/\total{chapter}}; \matrix[ anchor=east, matrix~of~nodes, nodes={draw, align=center,fill=cyan, minimum~size=1.2cm,font=\sffamily\bfseries\Huge}, row~sep=.75cm, column~sep=0mm, inner~sep=0pt, outer~sep=0pt, ] (m) at (current~page.east){% \l_matrix_content_tl }; \end{tikzpicture}% }% } \ExplSyntaxOff \begin{document} \chapter{First Chapter} \lipsum[1-10] \chapter{Second Chapter} \lipsum[1-10] \chapter{Third Chapter} \lipsum[1-10] \end{document} I want to construct the \l_matrix_content_tl with: \int_step_inline:nn {\total{chapter}} { \ifnum #1=\thechapter\relax \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} \fi \tl_put_right:Nn \l_matrix_content_tl {#1\\} } which complain that: ! Missing number, treated as zero. <to be read again> \def l.24 } ? I guess that \total{chapter} could be empty within the first run, but I have no idea of when and where(or how to delay) to construct the token list?
- 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.
- 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}