• Randomize an enumerate list containing lstlisting
    by Dimitrios ANAGNOSTOU on November 19, 2025 at 10:52 am

    I would like to create a randomized enumerate list whose items may contain lstlisting environments. So far, I can successfully randomize ordinary items, but items containing a lstlisting environment break the mechanism. I have a workaround, but it forces all listings to stay in fixed positions, which defeats the purpose of randomization. I would like all items—including those containing listings—to be included in the shuffle performed by \additem. Here is an example of my 'workaround' solution. \documentclass{article} % ---------- Packages ---------- \usepackage[french]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{enumitem} \usepackage{xcolor} \usepackage{listings} % ----------- Style Matlab ----------- \lstdefinestyle{stylematlab}{ language=Matlab, basicstyle=\ttfamily\small, keywordstyle=\color{blue}, commentstyle=\color{green!60!black}, numbers=left, numberstyle=\tiny, stepnumber=1, frame=single } % ----------- Randomized items ----------- \usepackage{pgffor} \usepackage{pgf} \usepackage{xparse} \ExplSyntaxOn % Sequence storing the items \seq_new:N \g_myitems_seq % Add item \NewDocumentCommand{\additem}{m}{ \seq_put_right:Nn \g_myitems_seq {#1} } % Shuffle and typeset \NewDocumentCommand{\shuffleitems}{}{ \pgfmathsetseed{\number\pdfrandomseed} \seq_shuffle:N \g_myitems_seq \begin{enumerate} \seq_map_inline:Nn \g_myitems_seq {##1} \end{enumerate} } \ExplSyntaxOff \begin{document} Indiquer si chaque affirmation est vraie (V) ou fausse (F). % ---- Ajout des items ---- \additem{ \item En programmation numérique, une complexité algorithmique en $\mathcal{O}(n^2)$ est toujours préférable à une complexité en $\mathcal{O}(n \ln n)$. } \additem{ \item Les fonctions anonymes en \textsc{Matlab} ne peuvent pas être passées comme arguments à d'autres fonctions. } \additem{ \item En général, dans un problème d’optimisation, une solution optimale locale est garantie d’être aussi une solution optimale globale. } % ---- Mélange des items ---- \shuffleitems % ---- Items supplémentaires (non randomisés) ---- \begin{enumerate}[start=4] \item Exemple avec listing Matlab : \begin{lstlisting}[style=stylematlab] f = @(x) x.^2 + 1; x = -5:0.1:5; plot(x,f(x)) \end{lstlisting} \end{enumerate} \end{document} Items containing lstlisting do not behave well inside the token storage. They seem to prevent the shuffle from working properly. My temporary workaround is to keep such items outside the randomized block, but this defeats the point. Is there a way to fully integrate items containing lstlisting into the randomization process performed by \additem, without switching to the exam class and eventually exam-randomizechoices?

  • Link with many %
    by Sebastiano on November 18, 2025 at 5:27 pm

    Generally, I don't include many links in my PDFs. Until now I’ve never had problems with \href from the hyperref package: when the URL contains % characters, I escape them using \% and everything works fine. I suppose to have a URL with many % https://www.emathhelp.net/calculators/calculus-2/series-calculator/?f=n%5E%280.9999%29*%281%2F%28n-2%29-1%2F%28n-1%29%29&var=n&a=3&b=%2Binf \documentclass[12pt]{article} \usepackage{hyperref} \begin{document} \href{https://www.emathhelp.net/calculators/calculus-2/series-calculator/?f=n\%5E\%280.9999\%29*\%281\%2F\%28n-2\%29-1\%2F\%28n-1\%29\%29&var=n&a=3&b=\%2Binf}{t} \end{document} I put for every % the symbol \ thus the \href work correctly. If I use the original link provides me with an incomplete URL because the first % acts as a comment (see the picture below). But if a URL contains, for example, twenty % characters, what is the correct way to handle them so that \href works properly without put manually twenty \?

  • circuiTikZ: Transistor where the lines of the emitter and collector start at the same point
    by cis on November 18, 2025 at 2:56 pm

    Is there a circuitikz-package-like way, to get a transistor like this? This means where the lines of the emitter and collector start at the same point. \documentclass[margin=5mm]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[] \draw (0,0) node[npn](T){}; \draw (T.B) node[left]{B} (T.C) node[above]{C} (T.E) node[below]{E}; \end{circuitikz} \end{document}

  • help with 3D Surface plot TikZ
    by Mark Roelands on November 16, 2025 at 9:20 pm

    Can someone please help with coding the surface plot for $\sqrt{(x - 1)^2 + y^2} + \sqrt{(x + 1)^2 + y^2} - 4 = -|z|$ in TikZ for my article in LateX? I have been trying, but can't seem to manage it. This is what I have so far, it only plots one half of the surface on a square but not within the disk: \begin{tikzpicture} \begin{axis}[ hide axis, colormap/cool, ] \addplot3[ mesh, samples=50, domain=-2:2, ] {deg(sqrt((x - 1)^2 + y^2) + sqrt((x + 1)^2 +y^2) - 4)}; \end{axis} \end{tikzpicture}

  • fourier-otf font package: incorrect size of integral symbol in \displaystyle math mode
    by jowe_19 on November 15, 2025 at 2:51 pm

    For the past few weeks, my integrals have not been displaying in display-style math mode. I can reproduce the issue with this small minimal example. How can I fix this? \documentclass[11pt]{report} \usepackage{mathtools} \usepackage{fourier-otf} \begin{document} Test \( \int_0^1 \). Test \( \displaystyle\int_0^1 \). \end{document}

  • How to draw a rectangle in tikz at scale 0.9 without broken line joins
    by msrd0 on November 15, 2025 at 10:28 am

    I have a tikz picture that I apply scale=0.9 to that \draws a rectangle, like this: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.9] \draw[draw=red, fill=red, fill opacity=0.3, thick] (0.24999999999999997, 5.8) -| (0.44999999999999996, 6.2) -| cycle; \end{tikzpicture} \end{document} This results in one corner not having the correct line join: If I would remove the scale argument, the line joint would be correct, but the whole picture no longer fits on my page. I also would like to avoid having to manually multiply all coordinates with 0.9. As a workaround, I could draw a second rectangle over it, with the "missing" corner in a different location. Is there a better solution?

  • How can I draw a filled plane using tikz/closedcycle
    by katang on November 13, 2025 at 11:26 pm

    I want to make a 3-D figure with a spatial diagram line and draw its projections onto the three axes planes. For better visibility, I want to mark the projections' positions with shaded planes. The MWE and the result are shown below. It looks like that \closedcycle wants to close anyhow in the plane containing the z-axis. Is there any option to draw a plane perpendicular to the z-axis (i.e., to the other two planes)? (I also tried \addplot3 [surf, fill] and fill between, but to no avail.) \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis} %XZ plane \addplot3 [fill=red!20,opacity=30,draw=none,fill opacity=0.5,] coordinates {(0,120,3900)(3,120,3900)} \closedcycle; %YZ plane \addplot3 [fill=green!20,opacity=30,draw=none,fill opacity=0.5,] coordinates {(3,-40,3900)(3,120,3900)} \closedcycle; %XY plane \addplot3 [fill=blue!20,opacity=30,draw=none,fill opacity=0.5,] coordinates {(0,-40,3900)(3,120,3900)} \closedcycle; \end{axis} \end{tikzpicture} \end{document} As a reply to @Jasper, I attach the figure here I need one more plane, for the blue diagram line. The thick spatial curve is projected to the axial planes. Thanks to all for your helpfulness and the useful hints.

  • Error linked to active characters?
    by Bibi on November 13, 2025 at 5:46 pm

    This MWE gives an error that disappears if line #3 or line #4 are commented. I would say that this has probably something to do with active characters, but I am not able to understand what goes wrong here. Any help? \documentclass[9pt, professionalfont]{beamer} \usepackage{pgfplots} \usepackage[french]{babel} % No error if this line (or the next one) is commented \usetikzlibrary{babel} \begin{document} \begin{frame} \begin{overlayarea}{\textwidth}{5cm} \only<1>{ \begin{center} \begin{tikzpicture} \begin{axis} \addplot {x^2+4}; \end{axis} \end{tikzpicture} \end{center} } \end{overlayarea} \end{frame} \end{document}

  • How to avoid \big having more space than \left?
    by allo on November 13, 2025 at 4:03 pm

    When using \big instead of \left \right I get some unwanted extra space. Example: \documentclass{article} \usepackage{amsmath} \usepackage{stix} \begin{document} \begin{align*} \big\langle \star \hat A \big\rangle \\ % Bad \left\langle \star \hat A \right\rangle % Good \end{align*} \end{document} I want to use \big, because in my more complicated equation \left \right would cause larger angles to be used that look worse than using \big for my equation.

  • Strange node naming scope issues across two tikzpictures environment?
    by Explorer on November 13, 2025 at 1:27 am

    This post raised from my previous answer, and pascal974's comment: Consider the following two codes: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \foreach[remember=\n as \lastn] \n in {0,...,5}{ \node (\n) [right = of \lastn] {\n}; } \end{tikzpicture} \end{document} It would complain that as expected: ! Package pgf Error: No shape named `0' is known. See the pgf package documentation for explanation. Type H <return> for immediate help. ... l.10 } ? However, if I add \tikz \node (0) {}; in another tikzpicture, the definition of node's namespace looks like "penetrated" the tikzpicture, which affect the next node named 0 as below: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{positioning} \begin{document} \tikz \node (0) {}; \begin{tikzpicture} \foreach[remember=\n as \lastn] \n in {0,...,5}{ \node (\n) [right = of \lastn] {\n}; } \end{tikzpicture} \end{document} My question is: Why the namespace of \node is shared across different tikzpictures? It looks like some information leak happened here? I believe that this case is different with cfr's this excellent solution.

  • How come when filling in TikZ, there is a visible gap between adjacent fills?
    by Jasper on November 12, 2025 at 1:00 am

    How come when filling in TikZ, there is a visible gap between adjacent fills? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) -- (1,1) -- (1,0) -- cycle; \fill (0,0) -- (1,1) -- (0,1) -- cycle; \end{tikzpicture} \end{document}

  • How to distribute TikZ pics along entire path consisting of multiple subpaths?
    by dsacre on November 11, 2025 at 7:25 pm

    Assume the following: One wants to distribute (ideally: equally by length) TikZ pics along a path consisting of multiple subpaths. MWE \documentclass[border=5pt]{standalone} \usepackage{tikz} % DESCRIPTION: Definition of picture for positioning along the path \tikzset{ mypic/.pic={ \path[fill=cyan](0,0)circle(5pt); } } \begin{document} \begin{tikzpicture} \path[draw=black] (0,0)--++(0,2.5) arc(0:180:5) --++(0,-2.5) arc(180:360:5) % DESCRIPTION: Distributes pictures only on last part of path foreach \t in {0, 0.125, ..., 1}{ pic[pos=\t]{mypic} } ; \end{tikzpicture} \end{document} Result Goals Distribute pics along complete path (without copy pasting the foreach construct to each subpath) Achieve equal distribution by length over the whole path Question Is there a way to achieve this with plain TikZ or a TikZ library? Ideally, the solution should be as programmatically as possible, since it is intended to be used in an animation later on.

  • Why does activating tagging in a footnote-heavy document increase the PDF file size much more with lualatex than with pdflatex?
    by Senex on November 11, 2025 at 11:32 am

    Update: following the code change in pdfmanagement (mentioned by @UlrikeFischer in the comments) to mitigate the underlying luatex bug, the test code in the question now produces a much smaller tagged PDF with lualatex — only 384kB (1.42× the untagged size), smaller than is produced with pdflatex. The code below generates a 70 page "lorem ipsum" document with ~5–10 footnotes per page. Activating tagging (just changing tagging=off to tagging=on) produces a much larger increase in PDF file size when compiling with lualatex compared with pdflatex, although the output of show-pdf-tags seems to indicate that the tagging structure is actually smaller for lualatex: pdflatex lualatex tagging=off PDF size 297kB 270kB tagging=on PDF size 529kB 870kB relative size of PDFs 1.78 3.22 show-pdf-tags output size 929kB 810kB If I remove the \footnote command, so that everything appears as body text, the difference is much smaller: pdflatex lualatex tagging=off PDF size 206kB 231kB tagging=on PDF size 326kB 397kB relative size of PDFs 1.58 1.71 show-pdf-tags output size 357kB 359kB These results are from an up-to-date TeX Live 2025. So: (1) What is going on? (2) Is it possible to reduce the file size produced by lualatex? (Is there some setting I should have applied?) (I understand that tagging is under active development and this might be a transient issue. I noticed this when converting a private book style to be tagging-compatible.) Code for the document: \DocumentMetadata{ pdfversion=2.0, pdfstandard=UA-2, lang=la, tagging=off, } \documentclass{book} \ExplSyntaxOn \cs_new:Npn\generatecomplexfile { \int_zero:N\l_tmpa_int \int_do_until:nNnn{\l_tmpa_int}>{500}{ \int_incr:N\l_tmpa_int \group_begin: \int_set:Nn\l_tmpa_int{\int_mod:nn{\l_tmpa_int}{100}+1} \int_set:Nn\l_tmpb_int{\int_mod:nn{\l_tmpa_int}{19}+1} \lipsum_aux:ee{\int_use:N\l_tmpa_int}{\int_use:N\l_tmpb_int} \footnote{\lipsum_aux:ee{\int_use:N\l_tmpa_int}{1}}~ \par \group_end: } } \cs_new:Npn\lipsum_aux:nn #1#2 { \lipsum[#1][1-#2] } \cs_generate_variant:Nn\lipsum_aux:nn{ ee } \ExplSyntaxOff \usepackage{lipsum} \begin{document} \generatecomplexfile \end{document}

  • How can I use a counter with a dynamically-created name in Latex Expl3?
    by Jean-Louis Brabant on November 10, 2025 at 6:55 am

    I am new to Expl3 and would like to be able to use a counter by retrieving its name dynamically, performing this operation within a user command for other stuff. I am unable to display the counter value. I may be making a beginner's mistake, but I don't know where it might be... Here is the minimal example I am working on : \documentclass{article} \ExplSyntaxOn % declare counter \int_new:N \g_strxdiv_leveliv_division_count_int % initialize counter \int_gset:Nn \g_strxdiv_leveliv_division_count_int { 1 } % Construct the counter name dynamically \cs_new:Npn \__strxgen_construct_counter_name:nn #1% first variable part #2% second variable part { g_strx#1_#2_count_int % used as-is, \__strxgen_construct_counter_name:nn { div } { leveliv } gives the correct name ('g_strxdiv_leveliv_count_int') } % For user purposes \NewDocumentCommand\Test { m m } { \int_use:c { \__strxgen_construct_counter_name:nn { #1 } { #2 } } % <other stuff should be placed here using the counter once "reconstructed"> } \ExplSyntaxOff \begin{document} \Test{div}{leviv} % displays the error messg 'You can't use '\relax' after the. (...)' ) % Thinking it was an expansion issue with \int_use:c, I've tried with \exp_args:... without more success. \end{document} Thank you so much for your help.

  • Simplified space-separated vector macro not working
    by Hugh on November 9, 2025 at 4:03 pm

    I'm trying to write a macro that allows me to turn something like this: \vec{12 12 12} ...into something like this: \begin{bmatrix}12 \\ 12 \\ 12\end{bmatrix} Here is the code I wrote for it: \renewcommand{\vec}[1]{\begin{bmatrix}{\vecHelper#1}\end{bmatrix}} \newcommand{\vecHelper}[1]{#1\@ifnextchar\@sptoken{\\\vecHelper}{\@ifnextchar\egroup{}{\vecHelper}}} The idea is to keep parsing characters one at a time, adding \\ upon seeing a space and terminating the recursion upon the end of the input (in this case, seeing an \egroup). When I then try writing: $$\vec{12 12 12}$$ it actually displays correctly: However, I get the following error messages (I use Overleaf): I suspect the issue has something to do with the ending brace not being there at some point when it is supposed to, but I'm not sure when or why and I'm not sure how to fix it. In case it's of any use, I tried adding debugging characters to my macro to see if it was functioning correctly, and I didn't see any issues: \renewcommand{\vec}[1]{\begin{bmatrix}{\vecHelper#1}\end{bmatrix}} \newcommand{\vecHelper}[1]{#1\@ifnextchar\@sptoken{a\\\vecHelper}{b\@ifnextchar\egroup{c}{d\vecHelper}}} $$\vec{12 12 12}$$ This also gives the same errors as above. Thank you all for your time.

  • beautification of a block matrix
    by RIPAN DAS on November 9, 2025 at 3:21 pm

    I am looking for suggestions on how to improve the visual presentation of a block matrix I created in LaTeX. I'm hoping to "beautify" it and make it easier to read. Here is the code: \documentclass{article} \usepackage{amsmath} \newcommand{\bigzero}{\mbox{\normalfont\Large\bfseries 0}} \newcommand{\rvline}{\hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep}} \begin{document} \[ \begin{bmatrix} \begin{matrix} \dfrac{\partial \tilde{x}_1}{\partial x_1}(x) &\cdots & \dfrac{\partial \tilde{x}_1}{\partial x_n}(x)\\ \vdots &\ddots &\vdots \\ \dfrac{\partial \tilde{x}_1}{\partial x_1}(x) &\cdots & \dfrac{\partial \tilde{x}_1}{\partial x_n}(x) \end{matrix} & \rvline & \bigzero \\ \hline \bigzero & \rvline & \begin{matrix} \dfrac{\partial \tilde{x}_1}{\partial x_1}(x) &\cdots & \dfrac{\partial \tilde{x}_1}{\partial x_n}(x)\\ \vdots &\ddots &\vdots \\ \dfrac{\partial \tilde{x}_1}{\partial x_1}(x) &\cdots & \dfrac{\partial \tilde{x}_1}{\partial x_n}(x) \end{matrix} \end{bmatrix} \] \end{document} as you can see, there is no gap between the horizontal line and the rows just above and below it. i want to make it better and look beautiful and if possible some more beautification.

  • Bracket covers sum limits using mathclap environment
    by mlg on November 9, 2025 at 12:09 pm

    I have the following code: \documentclass{article} \usepackage{mathtools} \begin{document} \[S_1 = \frac{1}{2} \left(\sum_{\mathclap{i = n + 1}}^{n + m} a_i t_i \right)\] \end{document} And it produces this output: As you can see, the bracket partially covers the lower sum limit. How can I avoid this?

  • TikZ: How to draw a 3D shape by defining its 2D cross-section and 3D path?
    by Diaa on November 8, 2025 at 12:24 pm

    For the following, I would like to draw a 3D shape by sweeping the cross-section (i.e., rectangle or circle) along the 3D path from its start to end coordinates, while having, if possible, the option to draw the hidden edges as dashed lines based on the 3d view view angles control the smoothness of connectivity at vertices (getting right-angled bends or curved ones). \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{3d,calc,perspective} \begin{document} \begin{tikzpicture}[3d view={140}{40}] \begin{scope}[->, black, thin] \draw (0,0,0)-- (3,0,0) node[anchor=north east]{$x$}; \draw (0,0,0) -- (0,3,0) node[anchor=north west]{$y$}; \draw (0,0,0) -- (0,0,3) node[anchor=south]{$z$}; \end{scope} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \coordinate (start1) at (3,1,2); \coordinate (end1) at (3,1,-2); \draw[canvas is xy plane at z=2, fill=blue!10] ($(start1) - (0.25,0.5)$) rectangle ($(start1) + (0.25,0.5)$); \coordinate (v1) at ($(start1)+(0,0,1)$); \coordinate (v2) at ($(v1)+(-2,0,0)$); \coordinate (v3) at ($(v2)+(0,0,-6)$); \coordinate (v4) at ($(v3)+(2,0,0)$); \draw[blue] (start1) -- (v1) -- (v2) -- (v3) -- (v4) -- (end1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \coordinate (start2) at (-3,1,2); \coordinate (end2) at (-3,1,-2); \draw[canvas is xy plane at z=2, fill=red!10] (start2) circle (0.25); \coordinate (v11) at ($(start2)+(0,0,1)$); \coordinate (v22) at ($(v11)+(2,0,0)$); \coordinate (v33) at ($(v22)+(0,0,-6)$); \coordinate (v44) at ($(v33)+(-2,0,0)$); \draw[red] (start2) -- (v11) -- (v22) -- (v33) -- (v44) -- (end2); \end{tikzpicture} \end{document}

  • How can I get \enumerate to use Chinese numerals instead of Arabic ones?
    by neruneru on November 7, 2025 at 5:22 pm

    I'm trying to set up \enumerate to use Chinese numerals (一,二,三,四……) using the zhnumber package. The effect I'm trying to achieve is this: Desired Output: The package zhnumber provides a macro to convert counters into Chinese numerals, \zhnum, and I tried using it with the enumi counter and the label option in the enumitem package. However, it looks like what happens is the label computes once when the counter is 0 instead of with every new instance of \item. This is the MWE and output: Code: \documentclass{ltjtarticle} \usepackage{zhnumber} \usepackage{enumitem} \begin{document} \begin{enumerate}[label=(\zhnum{enumi})] \item 道可道,非常道。 \item 名可名,非常名。 \item 無名天地之始。 \item 有名萬物之母。 \item 故常無欲,以觀其妙。 \item 常有欲,以觀其繳。 \end{enumerate} \end{document} Actual Output: Here, 零 is the Chinese numeral for 0. This is not the case, for instance, if you use label=\arabic{enumi}, which works as expected: I am using the ltjtarticle document class which calls the luatex-jp package (and compiles with LuaLaTeX), since I need this to typeset other things in my document. If anyone has any idea how I can fix this problem please let me know! I'm willing to use packages that aren't zhnumber but they need to be compatible with luatex-jp and ltjtarticle (ctex doesn't seem to work, for example). PS: Incidentally, is there a way to use fullwidth Arabic numerals with enumitem? In this vertical document, the fullwidth Arabic numerals would not rotate like the halfwidth ones.

  • Book design with TikZ
    by Francesco Sieni on November 7, 2025 at 10:25 am

    there's a way to desgin a book cover like this one? MWE The only thing i managed to do were the frames \documentclass{book} \usepackage[paperwidth=115mm, paperheight=195mm]{geometry} \usepackage{tikz} \usepackage{tikzpagenodes} \usetikzlibrary{calc} \begin{document} \thispagestyle{empty} %external frame \tikz[overlay,remember picture]\draw($(current page.north east)+(-1.0cm,-1.0cm)$)--($(current page.north west)+(1.0cm,-1.0cm)$)--($(current page.south west)+(1.0cm,1.0cm)$)--($(current page.south east)+(-1.0cm,1.0cm)$)--cycle; %inside \tikz[overlay,remember picture]\draw($(current page.north east)+(-1.1cm,-1.1cm)$)--($(current page.north west)+(1.1cm,-1.1cm)$)--($(current page.south west)+(1.1cm,1.1cm)$)--($(current page.south east)+(-1.1cm,1.1cm)$)--cycle; \end{document} It doesn't matter if the color of the page (in this case black) because then I would like to invert it (i.e. white page and black frames,) Can you help me? Thank you very much!

  • Is excludeonly still working? (TeXlive 2025)
    by Markus Nißl on November 7, 2025 at 8:38 am

    I came across excludeonly with this question: Is there an \exclude option? Is excludeonly still working? I'm using 2003/03/14 v1.0 with TeXlive 2025. This next minimal example has file b.tex in the generated output. I only want files a.tex and c.tex in the output. \documentclass{article} \usepackage{excludeonly} \excludeonly{b} \begin{document} \include{a} \include{b} \include{c} \end{document} What am I doing wrong? Or what am I misunderstanding?

  • "Hanging" corners on Tikz diagram
    by pwesterbaan on November 6, 2025 at 7:23 pm

    I'm creating a diagram of an open box using Tikz: \documentclass[margin=5pt, convert={density=1000, size=10000}]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \pagecolor[RGB]{255,255,255} \begin{document} % H-------G % /| /| % / | / | % / E----/--F % / / / / % D-------C / % | / | / % |/ |/ % A-------B \begin{tikzpicture}[ declare function={ wdth=4.35; hgt=2; x_offset=2.75; y_offset=2.75;} ] \coordinate (A) at (0,0); \coordinate (B) at (wdth,0); \coordinate (C) at (wdth,hgt); \coordinate (D) at (0,hgt); \coordinate (E) at ($(A)+(x_offset, y_offset)$); \coordinate (F) at ($(B)+(x_offset, y_offset)$); \coordinate (G) at ($(C)+(x_offset, y_offset)$); \coordinate (H) at ($(D)+(x_offset, y_offset)$); \draw[fill=black!15, line width=1pt] (A) -- (B) -- (F) -- (E) -- cycle; \draw[line width=1pt] (E) -- (F) -- (G) -- (H) -- cycle; \draw[fill=white, line width=1pt] (A) -- (E) -- (H) -- (D) -- cycle; \draw[fill=white, line width=1pt] (B) -- (F) -- (G) -- (C) -- cycle; \draw[fill=white, line width=1pt] (A) -- (B) -- (C) -- (D) -- cycle; \draw[dotted] (A) -- (E) -- (F); \end{tikzpicture} \end{document} The problem I'm having is that the lines protrude where the corners meet (likely because my line width=1pt). How do I draw this diagram without the "hanging" bits at the corners?

  • Want to use LaTeX for Students
    by GowriSaro on November 6, 2025 at 6:03 am

    The students don’t have knowledge of TeX but they want to use it. I heard that BakomaTeX has a facility to use LaTeX even the user doesn’t have knowledge of TeX, but I wasn’t able to use it. (The actual problem is that I’m not able to get much information regarding BakomaTeX.) Please refer me to any free LaTeX tool which is more user friendly, so that it’s more likely that the students are going to use it. I can train the students to the basic level of TeX, but what I’m looking for is something based on the WYSIWYG principle, like BakomaTeX.

  • Iterated plot with TikZ, PGFPlots and foreach loop
    by Dominique on November 5, 2025 at 4:31 pm

    I'm trying to plot an illustration of the fixed point method in which a function is evaluated repeatedly in a loop. The result should be a staircase or spiral plot on top of the plot of the function itself. I've read here about the use of \edef inside a foreach loop. The following MWE should show what I'm trying to do, but it seems to only perform a single iteration. Notes: the loop variable isn't used inside the loop. perhaps it's an illusion that only single iteration is performed and the real issue is that \xprev and \xnext aren not updated at each pass through the loop. I tried placing the updates inside the \edef, but that gives an undefined control sequence error. I also tried \pgfplotsinvokeforeach instead of \foreach, but only obtained other errors. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \pgfmathdeclarefunction{g}{1}{\pgfmathparse{#1^2 - 2}} \begin{tikzpicture} \begin{axis} [ xmin = -2.5, xmax = 2.5, ymin = -3, ymax = 3, axis x line = center, axis y line = center, domain=-2.5:2.5, samples=300, ] \addplot[ultra thick] {g(x)}; % graph of g \addplot[thin] {x}; % diagonal \def\xstart{-0.75} \pgfmathsetmacro{\xprev}{\xstart}; \pgfmathsetmacro{\xnext}{g(\xprev)}; \draw[thick, blue] (\xstart, 0) -- (\xstart, \xnext) -- (\xnext, \xnext); \foreach \i in {1, 2, 3}{ \pgfmathsetmacro{\xprev}{\xnext} \pgfmathsetmacro{\xnext}{g(\xprev)} % x <- g(x) \edef\plotoneiter{% \noexpand% \draw[thick, blue] ({\xprev}, {\xprev}) -- ({\xprev}, {\xnext}) -- ({\xnext}, {\xnext}); }\plotoneiter% } \end{axis} \end{tikzpicture} \end{document} Thanks in advance for any hints! EDIT: Here is a quick sketch of what I'm trying to achieve:

  • I want a command which can take two arbitrary ellipses, and shade the region between them, bounded by their mutual tangents
    by Jasper on November 2, 2025 at 9:31 pm

    I want a command which can take two arbitrary ellipses, and shade the region between them, bounded by their mutual tangents. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (-5,0) ellipse[x radius = 1, y radius = pi]; \fill ({sqrt(2)},e) ellipse[x radius = {sqrt(pi)}, y radius = {sqrt(e^sqrt(pi))}]; \end{tikzpicture} \end{document}

  • TikZ arrow difference in different PDF-viewer(PDF-XChange-Editor v10.5.2)?
    by Explorer on November 1, 2025 at 6:03 pm

    I have the following mwe: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[% foo/.tip={Latex[width=0pt 5, length=5pt]}, line cap=round,line join=round,scale=1.3 ] \begin{scope} \coordinate (A) at (-1,0); \coordinate (B) at (1,0); \coordinate (C) at (0,{sqrt(3)}); \draw[foo-foo] (A) -- (B); \draw[foo-foo] (A) -- (C); \draw[foo-foo] (B) -- (C); \end{scope} \end{tikzpicture} \end{document} Then the output's arrow differs in different PDF-viewers: case1: PDF.js in LaTeXWorkshop case2: Edge browser case3: PDF-Xchange-Editor The abnormal arrow tip only shown with PDF-Xchange-Editor. Is this the PDF-viewer to be blamed, what caused this difference? Edit to mizimizhi Z's comments(@muzimuzhiZ): The test code: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \tikz \draw[line join=round, {-Latex}] (0,0) -- (1,0); \begin{tikzpicture}[ line width=5pt, line join=round ] \draw (0,0) -- (1,1) -- (1,0); \draw[line join=miter, xshift=2cm] (0,0) -- (1,1) -- (1,0); \end{tikzpicture} \end{document} While in contrast, I compared it with another PDF-viewer: foxit-PDF-editor-pro, it gives the correct result:

  • With the Roboto Flex font, siunitx \micro not displayed with an upright mu
    by Denis Bitouzé on October 31, 2025 at 11:35 am

    The following MCE displays \unit{\micro\gram} as expected, that is with the (upright mu) Micro Sign character: \documentclass{article} \usepackage{fontspec} \usepackage{siunitx} \setmainfont{TeX Gyre Schola} % \setmainfont{RobotoFlex-VariableFont.ttf} \begin{document} \begin{itemize} \item Greek Small Letter Mu/Unicode char 03BC: μ/\char"03BC \item Micro Sign/Unicode char 00B5: µ/\char"00B5 \item \verb|\unit{\micro\gram}|: \unit{\micro\gram} \end{itemize} \end{document} However, if the TeX Gyre Schola font is replaced with the Roboto Flex font, \unit{\micro\gram} is displayed with a slanted mu, so not with a Micro Sign: I assume this is a bug in the Roboto Flex font, but is there anything that can be done on the (Lua)LaTeX side to resolve the issue?

  • Error with `\DocumentMetadata` and nicematrix
    by Keks Dose on October 29, 2025 at 12:00 pm

    TexLive 2025, up to date MWE: \DocumentMetadata{pdfstandard=A-2b, lang=de-DE, pdfversion=1.7} \documentclass{article} \usepackage{nicematrix, array} \begin{document} \begin{NiceTabular}{p{4em}p{4em}p{4em}} \multicolumn{3}{p{8em}}{Überschrift}\\ $\downarrow$ & zwei & drei \\ \end{NiceTabular} \end{document} % Local Variables: % TeX-engine: luatex % End: Works, if I comment out the first line. Throws errors otherwise, first one: ./251029-lua-dev-nicematrix.tex:9: Use of \@@array doesn't match its definition. \@ifnextchar ...\reserved@d = #1\def \reserved@a { #2}\def \reserved@b {#3}\f... It took me hours to boil my file down to this mwe. The \downarrow line threw errors with the developer version of LuaLaTeX, I had to replace it with \(\downarrow\). And for whatever reason another error isn't visible, but there was another error with the dev version. I added here the tag "tagged-pdf", because neither "documentmetadata", nor PDF-management were predefined. Feel free to change to better fitting tag of this question.

  • Parsing command arguments with xstring within tikzpicture block
    by UnderscorePoY on October 26, 2025 at 10:26 pm

    I'm trying to write a custom command to automatically adapt the shape of intervals in Tikz. I'm currently trying to pass an orientation argument to the command \intervalle to parse it via another command \intervalleParseOrientation. Here's a MWE: \documentclass[crop,tikz]{standalone} \usepackage{xstring} \newcommand{\intervalleParseOrientation}[2]{ \IfStrEqCase{#1}{ {h}{{#2}, 0} {v}{0, {#2}} }[\GenericError{}{}{}{h (horizontal) or v (vertical)}] } \newcommand{\intervalle}[1]{ \draw[|-|] (0, 0) -- (\intervalleParseOrientation{h}{1}); } \begin{document} \begin{tikzpicture} \intervalle{1}; \end{tikzpicture} \end{document} This gives the error Illegal parameter number in definition of \tikz@scan@point@coordinate., pointing at the argument within the call to \intervalle. Anyone happens to have encountered such error ? I'd really appreciate some help on that one. Thanks in advance!

  • Segmented cake symbol
    by Sebastiano on October 26, 2025 at 9:50 pm

    Let's take as an example an old request of mine, where I asked to create small symbols (eyes) to indicate the difficulty of an exercise. TikZ or symbol eyes for difficulty of examples/exercises Since I can't find a symbol, among those available in the symbol manual, that represents 1/4 of a cake to indicate time (and that can be associated with 1/2, 3/4, and 4/4), I wonder if it's possible to adapt the Marsupilam code to use a symbol that can be found in an Italian national newspaper. I think that is an image and not a symbol. \documentclass[12pt]{standalone} \usepackage{tikz} \newcommand\straightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,0) circle (.25); \end{tikzpicture}% } \newcommand\downwardsEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,-.25) circle (.25); \end{tikzpicture}% } \newcommand\rightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (.25,0) circle (.25); \end{tikzpicture}% } \begin{document} \straightEye \downwardsEye \ look at me \rightEye\rightEye \end{document}