• Inaccurate TikZ/PGF plot
    by Dominique on November 24, 2025 at 6:31 pm

    I'm using the following code to produce a plot: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ width = 15cm, xtick = {0, 1, 2, 3, 4, 5}, ] \addplot[black, thick, smooth, domain=0:5] {exp(-100 * \x) + sin(\x)}; \addplot[blue, thick, smooth] table {stiff.dat}; \end{axis} \end{tikzpicture} \end{document} It produces the following plot: Here, the blue curve plots data points generated with Matlab for the same function. The blue curve is correct, but the black one is not. It seems TikZ is not able to plot the function accurately. I've read on this forum about this issue and I tried a few things: \ustikzlibrary{fpu}: did not help; that may be because the PFU is limited to 4-5 digits \usepackage{xfp}: I could not get this to work and kept getting an error with \fpeval \usepackage{expl3}: same. I must be doing something wrong. What is the correct incantation here? I would rather not resort to compiling with Lua because my document is part of series that all compile fine with PDFLaTeX. Thank you in advance!

  • Add a DPDT switch
    by Nicolas on November 24, 2025 at 1:55 pm

    I've diagrammed the charging and discharging of a capacitor. \documentclass[border = 1mm]{standalone} \usepackage[utf8]{inputenc} \usepackage{siunitx} \usepackage[european, straightvoltages, RPvoltages]{circuitikz} \usetikzlibrary{babel} \begin{document} \begin{circuitikz} \draw (0,0) node[spdt,rotate=90,anchor=in] (Sw) {} (Sw.in)--++(0,-1) coordinate(RC) --++(1,0) to[R] ++(0,-1.5) to [leDo]++(0,-1.5) --++(-1,0) (RC)--++(-1,0) to[capacitor]++(0,-3)--++(1,0) (RC)--++(1,0) to[R] ++(0,-1.5) to [leDo]++(0,-1.5) coordinate (basRC) ($(basRC)+(-1,0)$) --++(0,-1) node[ground](GND){} (Sw.out 1) to[R] ++(-2,0) to[leDo, invert, mirror] ++(-2,0) coordinate(posSource) to [vsource] (posSource|-GND) --(GND) (Sw.out 2) --++(3,0) coordinate (posMoteur) to [Telmech=M,n=motor] (posMoteur|-GND)--(GND); \end{circuitikz} \end{document} For the discharge, I'd like to add a DPDT switch (and an LED + protection resistor in the corresponding loop) to be able to change the motor's direction of rotation: I haven't found anything about this in the documentation.

  • Why do expl3 setting commands use \edef?
    by jlab on November 24, 2025 at 9:21 am

    Looking at the definition of \tl_set:Nn (for example, with latexdef \tl_set:Nn), we find \tl_set:Nn: \protected\long macro:#1#2->\__kernel_tl_set:Nx #1{\__kernel_exp_not:w {#2}} where \__kernel_tl_set:Nx is simply \edef; and \__kernel_exp_not:w is \unexpanded. So, \tl_set:Nn \l_my_tl {...} means \edef \l_my_tl {\unexpanded {...}} that is to say: \edef requests for the expansion of the macro definition, but this expansion is prevented by \unexpanded. I'm curious, why not using instead \def \l_my_tl {...} ?

  • How to align the visual bottom of a large quotation mark with the cap height of the text?
    by Mihai on November 23, 2025 at 10:03 pm

    I am trying to figure how to correctly place a symbol (e.g., a quotation mark) as illustrated below. So, far I have the following: % Document class. \documentclass[12pt]{article} % Dependencies. \usepackage{lipsum} % Start. \ExplSyntaxOn % Define a box for the quote symbol. \box_new:N \l_quote_box % Define the `\pquote` command. \NewDocumentCommand{\pquote}{ m }{% % Start the quote environment. \begin{quote} % Enter horizontal mode. \leavevmode % Set the quote box to its content. \hbox_set:Nn \l_quote_box {% % Define the quote symbol. \rule{1em}{1em}% } % Place the quote symbol to the left. \llap{% % Smash to avoid affecting line spacing. \smash{% % Raise to align with the top of the first line. \raisebox{ \dim_eval:n { \fontcharht\font`H } }{% % Render the box containing the quote symbol. \box_use:N \l_quote_box }% }% }% % Render the quote content. #1 \end{quote} } % Stop. \ExplSyntaxOff \begin{document} \lipsum[1][1-3] \pquote{\lipsum[1][1-3]} \end{document} Which produces as output: However, the moment I redefine \l_quote_box as % Set the quote box to its content. \hbox_set:Nn \l_quote_box {% % Define the quote symbol. \fontsize{46}{0}\selectfont``% } the positioning of the symbol along the y-axis offset seems off, and the output obtained is: I can correctly reposition the symbol by tweaking the \raisebox, e.g. by setting \dim_eval:n { \fontcharht\font`H - 0.8em } but this feels arbitrary and perhaps dependent on the size used in \fontsize, which is not what I want. I would ideally like to: Determine (i.e., or scale) the size of quotation mark without compromising its "touch" point with the cap height, and thus not have to adjust the y-shift manually. Be mindful that large quotation marks do not overlap the text above, but rather push the entire quote environment down. Is there a robust way of achieving this, preferably without tikZ? I'd appreciate any ideas!

  • How to Make TikZ Overlay Arrows Smoother and Better Arranged in Table?
    by mingabua on November 23, 2025 at 6:33 pm

    I'm creating a table with TikZ overlay arrows to illustrate the data flow between cells. The arrows currently work, but they look somewhat crude and could be improved. I'm looking for suggestions on: How to make the curved arrows look more fluid and natural Better positioning strategies for the labeled nodes (A, B, C, D) so they don't overlap with arrows How to avoid awkward arrow angles and improve the overall visual flow Here's my MWE: \documentclass{article} \usepackage[margin=1in]{geometry} \usepackage{amsmath} \usepackage{booktabs} \usepackage{xcolor} \usepackage{lipsum} \usepackage{caption} \usepackage{tikz} \usetikzlibrary{tikzmark} \usepackage[most]{tcolorbox} % Color \definecolor{boxBack}{RGB}{245, 247, 250} \definecolor{darkgrey}{HTML}{464e51} \definecolor{customGray}{HTML}{DDDDDD} \definecolor{customRed}{HTML}{FDE7A9} \definecolor{customOrange}{HTML}{FC8E64} \definecolor{customBlue}{HTML}{B83779} % tcolorbox settings \tcbset{ enhanced, colback=boxBack, colframe=gray!40, boxrule=0.5pt, fonttitle=\bfseries\sffamily, coltitle=black, attach boxed title to top left={xshift=0.5cm, yshift=-3mm}, boxed title style={colback=white, colframe=gray!40, arc=3pt}, top=1em, bottom=1em, left=1em, right=1em } \begin{document} \lipsum[1-3] \begin{tcolorbox}[title=Test] \footnotesize $\quad$ \lipsum[1] \renewcommand{\arraystretch}{1.2} \begin{center} \captionsetup{font=footnotesize,labelfont={color=darkgrey,bf}} \captionof{table}{\textcolor{darkgray}{Example}} \label{tab:shifte} \vspace{-0.5cm} \[ \begin{array}{@{\hspace{1em}}c@{\hspace{2em}}c@{\hspace{3.5em}}c@{\hspace{3.5em}}c@{\hspace{3.5em}}c@{\hspace{2em}}c@{\hspace{1.0em}}} \toprule \text{Day} & \text{$1$} & \text{$2$} & \text{$3$} & \text{$4$} & \text{$\ldots$} \\ \midrule \text{{\fontsize{9}{10}\selectfont ...}} & \text{{E}} & \text{{L}} & \text{{O}} & \text{{E}} & \text{$\ldots$} \\[6pt] \text{$a_{ds}$} & \tikzmarknode{A2}{\text{$(1,0)$}} & \tikzmarknode{A3}{\text{$(0,1)$}} & \tikzmarknode{A4}{\text{$(0,0)$}} & \tikzmarknode{A5}{\text{$(1,0)$}} & \tikzmarknode{A6}{$\ldots$} \\[6pt] \text{$b_{ds}$} & \tikzmarknode{B2}{\text{$(1,0)$}} & \tikzmarknode{B3}{\text{$(1,0)$}} & \tikzmarknode{B4}{\text{$(0,1)$}} & \tikzmarknode{B5}{\text{$(0,1)$}} & \tikzmarknode{B6}{$\ldots$} \\[6pt] \text{$c_{ds}$} & \text{$(0,0)$} & \text{$(0,0)$} & \tikzmarknode{Z1}{\text{$(0,1)$}} & \text{$(0,0)$} & \text{$\ldots$} \\[6pt] \text{$v_{ds}$} & \tikzmarknode{E3}{\text{$(0,0)$}} & \tikzmarknode{E4}{\text{$(0,1)$}} & \text{$(0,0)$} & \tikzmarknode{E5}{\text{$(1,0)$}} & \tikzmarknode{E6}{$\ldots$ } \\ [6pt] \text{$d_{d}$} & \text{$0$} & \text{$1$} & \tikzmarknode{Z12}{\text{$0$}} & \text{$1$} & \text{$\ldots$} \\ \bottomrule \end{array} \] \begin{tikzpicture}[remember picture,overlay] % Fixed the typo here \draw[thick, ->] (-1.94,0.98) -- (-1.32,0.98); \draw[thick, -<] (-1.94,2.02) -- (-1.32,2.02); \draw[thick, -<] (-1.94,2.58) -- (-1.32,2.58); \draw[thick, ->] (-2.44,2.8) -- (-1.32,2.26); \draw[thick, customGray, -] (1.48,1.6) -- (2.56,2.22); \draw[thick, ->] (-0.44,2.8) -- (0.6,1.60); \draw[thick, ->] (1.48,1.6) -- (2.56,2.22); \draw[thick, -] (-1.94,2.58) -- (-1.94,0.98); \fill[customGray] (-2.21,2.65) circle (0.19); \fill[customGray] (2.02,1.91) circle (0.19); \fill[customGray] (0.08,2.16) circle (0.19); \fill[customGray] (-1.94,1.5) circle (0.19); \node[circle,draw,inner sep=1pt,font=\tiny] at (-2.21,2.65) {A}; \node[circle,draw,inner sep=1pt,font=\tiny] at (-1.94,1.5) {B}; \node[circle,draw,inner sep=1pt,font=\tiny] at (0.08,2.16) {C}; \node[circle,draw,inner sep=1pt,font=\tiny] at (2.02,1.91) {D}; \end{tikzpicture} \end{center} \noindent \lipsum[1] \end{tcolorbox} \normalsize \lipsum[2] \end{document} I want the arrows to look something like this:

  • \foreach loop inside tikz
    by underflow on November 23, 2025 at 5:16 pm

    I need to loop through a variables in tikz, using the ifthen package. Here is a MWE: \documentclass{amsart} \usepackage{tikz, ifthen} \begin{document} \begin{tikzpicture} \foreach \x in {-1,0,1, 2, 3, 4, 5} { \ifthenelse{ \x > 3 } { $\bullet$ } { $\star$ } } \end{tikzpicture} \end{document} This works, but when I replace \foreach \x in {-1,0,1, 2, 3, 4, 5} with \foreach \x in {-1,0,1, ... , 5} (or similar variations) I got the error message Runaway argument? 5\pgffor@@stop \expandafter \pgffor@dots@charcheck \pgffor@dotsvalue \ETC. ! Paragraph ended before \pgffor@dots@stripcontext was complete. <to be read again> \par l.13 ? s OK, entering \scrollmode... ! Missing number, treated as zero. <to be read again> . l.25 } ! Missing = inserted for \ifnum. <to be read again> . I tried to look up the tikz manual but I could not figure out what happen. Many thanks for your help!

  • Automatic (but deactivatable) language switching when typing cyrillic
    by Apothikon on November 23, 2025 at 10:50 am

    this is my first question on this site, so I hope I didn't broke any social convention in not introducing myself. I'm writing a simple grammar of Church Slavonic, a slavic liturgical language written with an archaich variant of the cyrillic script. The main text of my document is in English (actually in Italian, but here I use English for clarity's sake) but it obviously contains quite a bit of Church Slavonic, both in long example texts and in short words or even single letters scattered in the English sentences. I've loaded the appropriate polyglossia options and a font for archaic cyrillic letters, and the long Church Slavonic passages are easily handled with \textchurchslavonic{⟨random text⟩} or: \begin{churchslavonic} ⟨random text⟩ \end{churchslavonic} However, in sentences such as the following, the use on \textchurchslavonic{} is quite inefficient: Letters \textchurchslavonic{і}, \textchurchslavonic{и} and \textchurchslavonic{ѵ} usually represent the same sound, but sometimes \textchurchslavonic{ѵ} is pronounced like \textchurchslavonic{в} instead. The above case is very frequent and not the worst possible. So I wanted a way to make the language switch more or less automatic using LuaLaTeX. A possible solution I found would be to load \usepackage{newunicodechar} and redefine each cyrillic letter to be treated as Church Slavonic, like this: \newunicodechar{А}{{\textchurchslavonic А}} \newunicodechar{а}{{\textchurchslavonic а}} The problem of this approach is that it seems impossible to deactivate the language/font switching in the rare instances in which I need to write in modern cyrillic, as shown in the following MWE: \documentclass{article} \usepackage{fontspec} \usepackage{polyglossia} \usepackage{xkeyval} % it solves an incompatibility issue between polyglossia and churchslavonic \usepackage{churchslavonic} \usepackage{newunicodechar} %%%%%%%%%%% \setmainlanguage{english} \setotherlanguage{churchslavonic} \setmainfont{EB Garamond} \newfontfamily\churchslavonicfont{Arial} % I actually use a specialized font which I've installed on my computer \newunicodechar{А}{{\textchurchslavonic А}} \newunicodechar{а}{{\textchurchslavonic а}} \begin{document} These letters are in Church Slavonic script (here set in Arial): А, а. These following should be in EB Garamond: \textnormal{А, а}, which are not! \end{document} I know that \textnormal or similar commands can't work in this situation, so I'm asking: is there any solution in LuaLaTeX? Thank you in advance

  • First paragraph not indented in paracol environment
    by Roland Chastain on November 23, 2025 at 10:04 am

    I am making a bilingual document using paracol. I don't know why the first paragraph is not indented, as other are. I would like that it be indented. Here is my code: \documentclass[14pt,a4paper]{extarticle} \usepackage{fontspec} \usepackage[german,latin]{babel} \usepackage{microtype} \usepackage[margin=16mm]{geometry} \usepackage{paracol} % https://tex.stackexchange.com/a/505562/295527 \newcommand\chunks[2]{% \begin{leftcolumn*}\begin{otherlanguage}{latin}% {#1}% \end{otherlanguage}\end{leftcolumn*}% \begin{rightcolumn}\begin{otherlanguage}{german}% {#2}% \end{otherlanguage}\end{rightcolumn}% } \setlength{\columnsep}{8mm} \setlength{\columnseprule}{0.4pt} \usepackage[center]{titlesec}% https://tex.stackexchange.com/a/107282/295527 \begin{document} \thispagestyle{empty} \section*{GEBETE.} \subsection*{Das «Gegrüsset seist du, Maria».} \begin{paracol}{2} \chunks{\textsc{Ave}, Maria, gratia plena, Dominus tecum, benedicta tu in mulieribus et benedictus fructus ventris tui, Jesus.} {\textsc{Gegrüsset} seist du, Maria, voll der Gnade; der Herr ist mit dir; du bist gebeinedeit unter den Weibern, und gebeinedeit ist die Frucht deines Leibes, Jesus.} \chunks{Sancta Maria, Mater Dei, ora pro nobis peccatoribus, nunc et in hora mortis nostræ. Amen.} {Heilige Maria, Mutter Gottes, bitte für uns Sünder jetzt und in der Stunde unseres Todes! Amen.} \end{paracol} \end{document}

  • Plans for evolution/support of {Xe|Lua[node|harf]}LaTeX?
    by Alain Stalder on November 23, 2025 at 7:44 am

    Let me first give some context: As far as I can see, the original TeX/LaTeX including rendering with pdflatex has been very reliably producing the same visual output for decades now and presumably will for many more decades into the future, while there can be glitches due to various optional packages influencing each other. If you plan to or need to support a series of possibly evolving documents with a shared *TeX source code base, that is a very important feature, often close to an absolute necessity. However, I guess still due to Donald E. Knuth’s decision of 1990 in a TUGboat article titled The Future of TeX and METAFONT to not allow especially METAFONT to evolve into the future, and with in parallel newer font features broadly needed and desired, new variants/"variants" of LaTeX emerged that use especially OpenType fonts, I presume having evolved partially via ConTeXt to now XeLaTeX and LuaLaTeX. As far as I understand, XeLaTeX uses the HarfBuzz library (C++, the basis of font support in modern web browsers, Android and a lot more), which is also used by LuaLaTeX with the HarfBuzz renderer, while LuaLaTeX with the default Node renderer is doing it in some other way (maybe native Lua or C?). These three "engines" (XeLaTeX, LuaLaTeX/HarfBuzz and LuaLaTeX/Node) seem to produce similar output in many typical use cases, but in border cases differ. In contrast, as Knuth writes in the above article, at least at the time he wrote it there were tests called TRIP and TRAP that specifically focus on border/edge cases, again a very desirable feature in the context of long-term reliability. Since I write software for a living and partially also as a hobby, I am well aware that for all that it appears the situation is not easy or simple: The three "engines" are broadly used (except maybe LuaLaTeX/HarfBuzz?) so that I presume even making small meaningful changes or small bug fixes would often be close to impossible. Now to the main question (which I presume is of interest to many *TeX users): What are the plans and/or the likely outcome for the three "engines" and thus what is the recommendation which of those three (if any) to use if you want long-term reliable output and need features beyond pdflatex? Related questions that could at least make it easier to decide individually for users: • Any plans to freeze one or some of the "engines"? (Has XeLaTeX already been essentially frozen? And maybe LuaLaTeX/HarfBuzz less future than LuaLaTeX/Node? Or the other way round? Or both to evolve? If several "engines" are planned to keep evolving, any plans to harmonize their output a bit further? Or plans for a new "engine" that would be largely compatible with "the best of all three" but have a more stringent design and tests? Maybe a new renderer "..." for LuaLaTeX?) • Are there tests similar to "TRIP and TRAP" for any of those "engines" or plans to implement more of that in the future? • Any helpful links around the planned/envisioned future of *TeX would be appreciated... Questions on the side: • Did anybody recently ask Donald E. Knuth if he would maybe be willing to change his mind regarding the Computer Modern font under some circumstances, like maybe a well-defined and well-tested environment, like maybe in a future "engine" out of or derived from the mentioned three? (In my personal view, the quality of the font is unparalleled, but it is also tied to it being typeset as intended, which I why I can understand his decision in 1990.)

  • Refactor AI code for a forest diagram
    by projetmbc on November 22, 2025 at 9:40 pm

    In the code below, made using the "AI" Claude, there is too much copying and pasting of lines like the ones shown below. What is the best way to refactor the full code? archivefile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{orange!80}{\faFileArchive}\ ##1 } } } Here is the full code. \documentclass{article} \usepackage{forest} \usepackage{fontawesome5} \definecolor{foldercolor}{RGB}{124,166,198} \definecolor{filecolor}{RGB}{88,88,88} \forestset{ dir tree/.style={ for tree={ font = \sffamily, grow' = 0, child anchor = west, parent anchor= south, anchor = west, calign = first, inner ysep = 1pt, inner xsep = 1.75pt, text depth = 0pt, edge path = { \noexpand \path[draw, \forestoption{edge}] (!u.south west) +(7.5pt,0) |- (.child anchor)\forestoption{edge label}; }, before typesetting nodes={ if n=1 {insert before={[,phantom]}} {} }, fit = band, before computing xy = {l = 15pt}, } }, open/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{foldercolor}{\faFolderOpen}\ ##1 } } }, closed/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{foldercolor}{\faFolder}\ ##1 } } }, file/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{filecolor}{\faFile}\ ##1 } } }, codefile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{filecolor}{\faFileCode}\ ##1 } } }, pdffile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{red!70}{\faFilePdf}\ ##1 } } }, textfile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{filecolor}{\faFile*}\ ##1 } } }, imagefile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{blue!70}{\faFileImage}\ ##1 } } }, archivefile/.style={ before typesetting nodes={ content/.wrap value={ \textcolor{orange!80}{\faFileArchive}\ ##1 } } }, } \begin{document} \subsection*{Exemple d'arborescence de fichiers} \begin{forest} dir tree [system, open [config, closed [settings.conf, textfile] [database.yml, codefile] ] [doc, open [manual.pdf, pdffile] [README.md, textfile] [images, closed [logo.png, imagefile] [banner.jpg, imagefile] ] ] [lib, closed [utils.py, codefile] [helpers.js, codefile] [archive.zip, archivefile] ] [test, open [test\_unit.py, codefile] [test\_integration.py, codefile] [fixtures, closed [data.json, file] ] ] ] \end{forest} \subsection*{Exemple simple} \begin{forest} dir tree [system, open [config, closed] [Dog, closed] [lib, closed] [test, closed] ] \end{forest} \end{document}

  • how to shade an region bounded by curves
    by underflow on November 22, 2025 at 6:43 pm

    I have a region on the plane bounded by two hyperbolas xy = +/- C. What is the best/simplest way to shade (not filled) the "star shaped" region enclosed by these two hyperbolas? Advanced version of this question: I have two rays in the first quadrant, starting from the origin. These two rays cut out a curved wedge in the star shaped region. How I can shade this wedge in a different color from the rest of the region? Here is a MWE for the star shaped region, plus the two rays: \documentclass{amsart} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw [thick, domain=0.5:3] plot (\x, { 1.2/\x)}); \draw [thick, domain=-3:-0.5] plot (\x, { 1.2/\x)}); \draw [thick, domain=0.5:3] plot (\x, {-1.2/\x)}); \draw [thick, domain=-3:-0.5] plot (\x, {-1.2/\x)}); \draw (-3.4,0) -- (3.4,0); \draw (0,-2.6) -- (0,2.6); \draw [thick] (0,0) -- (2.2,2.2); \draw [thick] (0,0) -- (3.1,1.5); \end{tikzpicture} \end{document} Thanks for your help! EDIT: I know how to fill a polygon using \draw [filled] (coord) -- (coord) -- etc but I don't know how to handle the parabolas.

  • circuitikz / pgfpicture: modify existing symbol to a new one and rename it
    by cis on November 22, 2025 at 1:37 pm

    I want to create these block-circuit-symbols (I don't know the correct English name. 'Size limiter'? 'Limiter'? [German: "Größenwertbegrenzer"]) So I stole the \pgfpicture-code for the saturation-block (manual, p.107) out of the file pgfcircquadpoles.tex this is \pgfcirc@define@twoports{blocks} ... {saturation} ... (see MWE too). My current result (see below) definitely needs improvement. Feel free to make changes! But my main problem right now is: How do I give the new symbol its own name? In other words: How to make \draw (0,0) to[saturation] (2,0) to \draw (0,0) to[<better name>] (2,0) MWE: \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} % How to give that another name as "saturation? \makeatletter %% origin: %% saturation block, contributed by P.Sacco <paul.sacco@estaca,eu> \pgfcirc@define@twoports{blocks} {} {\ctikzvalof{bipoles/saturation/width}} {saturation} {\ctikzvalof{bipoles/saturation/width}} {\ctikzvalof{bipoles/saturation/width}} { \pgfsetlinewidth{1.2\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{.6\pgf@circ@res@step}} % \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@step}{.4\pgf@circ@res@step}} % \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-.6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-0.85\pgf@circ@res@step}{-.6\pgf@circ@res@step}} \pgfusepath{draw} } \makeatother \begin{document} \begin{circuitikz} \draw (0,0) to[saturation, l=not orig. saturation] (2,0) to[L] (4,0); \end{circuitikz} \end{document}

  • Integral symbol
    by Didier on November 22, 2025 at 7:52 am

    I have a problem with the integral symbol. Previously, it was perfectly straight and now it's tilted, even though I haven't changed my code. Before: Now: Here are the packages I use: \usepackage[dvipsnames,table,xcdraw]{xcolor} \usepackage{wrapfig2}%pour mettre des figures à côté de texte \usepackage{babel}%francisation \usepackage{mathtools} \usepackage[warnings-off={mathtools-colon,mathtools-overbracket},math-style=french]{unicode-math} \usepackage[default,varnothing]{fontsetup} \newfontface{\STIXTWO}{STIX Two Math} \usepackage[scale={0.75,0.8},footskip=1.5cm,heightrounded]{geometry} \usepackage[shortlabels]{enumitem}%pour pouvoir changer les labels des listes \usepackage{siunitx}%pour les unités \usepackage{xspace}%pour la gestion des espaces \usepackage[np,autolanguage]{numprint}%pour la séparation des milliers \usepackage{autoaligne}%pour les systèmes linéaires \usepackage{nicematrix}%pour les matrices "évoluées" \usepackage{tikz}%pour les graphiques et bien d'autres choses \usetikzlibrary{babel,fit,calc,arrows.meta,positioning,% decorations.pathreplacing,patterns.meta,angles,matrix,3d,quotes,mindmap,backgrounds} \usepackage{tkz-tab} \usepackage{emoji} \setemojifont{Noto Color Emoji} \usepackage[most]{tcolorbox}%pour les théorèmes, définitions, etc. \tcbuselibrary{documentation} Maybe there is an option in a package I should add? PS: Sorry for my English (I am French) Here is a MWE: \documentclass[10pt,a4paper,french]{book} \usepackage[dvipsnames,table,xcdraw]{xcolor} \usepackage{wrapfig2}%pour mettre des figures à côté de texte \usepackage{babel}%francisation \usepackage{mathtools} \usepackage[warnings-off={mathtools-colon,mathtools-overbracket},math-style=french]{unicode-math} \usepackage[default,varnothing]{fontsetup} \newfontface{\STIXTWO}{STIX Two Math} \usepackage[scale={0.75,0.8},footskip=1.5cm,heightrounded]{geometry} \usepackage[shortlabels]{enumitem}%pour pouvoir changer les labels des listes \usepackage{siunitx}%pour les unités \usepackage{xspace}%pour la gestion des espaces \usepackage[np,autolanguage]{numprint}%pour la séparation des milliers \usepackage{autoaligne}%pour les systèmes linéaires \usepackage{nicematrix}%pour les matrices "évoluées" \usepackage{tikz}%pour les graphiques et bien d'autres choses \usetikzlibrary{babel,fit,calc,arrows.meta,positioning,% decorations.pathreplacing,patterns.meta,angles,matrix,3d,quotes,mindmap,backgrounds} \usepackage{tkz-tab} \usepackage{emoji} \setemojifont{Noto Color Emoji} \usepackage[most]{tcolorbox}%pour les théorèmes, définitions, etc. \tcbuselibrary{documentation} \begin{document} \[\int_a^b f\] \end{document} And here is the result: I can't reproduce the upright version (and that's what I would want) Edit: I tried the solution provided by Apporv Potnis with the upint option. It is better but that's not exactlty what I had before: What I had before: Now with the upint option: As you can see, before it was less straight and more bold. I remember I recently updated the packages in Miktex. Maybe, it is the reason of the change? New Edit: In the stix-two package documentation, I see this: I think that is what I had before. So how do I get the Stylistic set 8?

  • expl3: l3file: \iow_now:Ne... doesn't expand tokens before writing to the stream?
    by Grass on November 22, 2025 at 4:43 am

    MWE: \documentclass{article} \begin{document} \ExplSyntaxOn \iow_new:N \g__test_iow \iow_open:Nn \g__test_iow { test.pl } \iow_now:Ne \g__test_iow { \# } \iow_close:N \g__test_iow \ExplSyntaxOff \end{document} This produces the file test.pl with contents \# instead of #. Also, if I do \iow_now:Ne \g__test_iow { \$ }, I get the error \g__test_iow=\write3 \openout3 = `test.pl'. ./testing2.tex:7: TeX capacity exceeded, sorry [input stack size=10000]. \font@name -> \OT1/cmr/m/n/10 l.7 \iow_now:Ne \g__test_iow { \$ } I don't understand why this error occurs. In any case, to avoid a X-Y problem situation, here is more context: I want to make the following work: \documentclass{article} \begin{document} \ExplSyntaxOn \seq_new:N \l__test_seq \seq_put_right:Ne \l__test_seq { 1 } \int_new:N \l__test_int \iow_new:N \g__test_iow \iow_open:Nn \g__test_iow { test.pl } \iow_now:Ne \g__test_iow { \#!/usr/bin/perl \seq_map_inline:Nn \l__test_seq { \int_incr:N \l__test_int my~\$width\_\int_use:N \l__test_int~=~##1 } } \iow_close:N \g__test_iow \ExplSyntaxOff \end{document} As you can see, I'm trying to create a perl script to which I save some TeX values to.

  • Typesetting a more aesthetic continued fraction
    by user143462 on November 21, 2025 at 7:08 pm

    In the following code, the quotient $\pi/4$ is expressed as a continued fraction. There is only one modification that I would like to be made. The diagonal dots at the end of the continued fraction would look much better if they were typeset in alignment with the 2's. \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \begin{document} \begin{equation*} \frac{\pi}{4} = \cfrac{1}{\ 1 + \cfrac{1^{2}}{\ 2 + \cfrac{3^{2}}{\ 2 + \cfrac{\ 5^{2}}{\ 2 + \cfrac{7^{2}}{\ 2 + \vphantom{\dfrac{9^{2}}{2}}_{\ddots}}}}}} \ . \end{equation*} \end{document}

  • LaTeX: Matrix in Matrix
    by gefei on November 21, 2025 at 10:08 am

    I created a matrix by this code \documentclass{article} \usepackage{amsmath} \begin{document} \[ A_{n+1}= \begin{pmatrix} a & \begin{tabular}{ccccc} 0 & 0 & \ldots & 0 & 0 \\ \end{tabular} & 1\\ \begin{tabular}{c} 0\\ \vdots\\ \end{tabular} & A_n & \begin{tabular}{c} 0\\ \vdots \end{tabular} \\ 1 & \begin{tabular}{ccccc} 0 & 0 & \ldots & 0 & 0 \\ \end{tabular} & a\\ \end{pmatrix} \] \end{document} But I don't like the result because the margin between the "a" and the first "0" in the first line is too large. I guess it's due to the tabular environment. Anyway to improve it?

  • Command with `^^` and `__` as exponent optional arguments
    by projetmbc on November 21, 2025 at 8:54 am

    In the following toy example, I would like to use __ and ^^ instead of - and .. Is it possible? \documentclass[varwidth, border = 3pt]{standalone} \NewDocumentCommand{\hyperseq}{ m e_ e^ e- e. }{% $% {}% \IfValueT{#4}{_{#4}}% \IfValueT{#5}{^{#5}}% #1% \IfValueT{#2}{_{#2}}% \IfValueT{#3}{^{#3}}% $ } \begin{document} \hyperseq{u} \hyperseq{u}_{1} \hyperseq{u}_{1}^{2} \hyperseq{u}_{1}^{2}-{3} \hyperseq{u}_{1}^{2}-{3}.{4} \hyperseq{u}-{3}.{4} \end{document}

  • There is a problem for triangles which are capable of partitioning eachother, which also coincide at one vertex. I am having trouble debugging it
    by Jasper on November 21, 2025 at 5:45 am

    I am writing a software which is supposed to take a set of triangles, where some of the members of the set are capable of partitioning one another, and performing all possible partitioning. I built Lua functions which are capable of detecting and performing most intersections. Unfortunately, there appears to be a particular case which is causing me some trouble. For example, consider the following diagram where I deliberately used a complicated case to show that my algorithm works in most cases. [Unfortunately, you need to run the GitHub version of the package :-(. This is because I want to fix this bug and write new documentation before making another release.] \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \pgfmathsetmacro{\i}{-pi/4} \begin{tikzpicture} \useasboundingbox[scale=2] (-1,-1) rectangle (1,1); \setobject[ name = {T} ,object = { matrix_multiply( matrix_multiply( euler(pi/2,pi/3,7*pi/6) ,translate(0,0,-5) ) ,matrix_multiply( { {1,0,0,0} ,{0,1,0,0} ,{0,0,1,0} ,{0,0,0,1} } ,matrix_multiply(xscale(1),yscale(1)) ) ) } ] \setobject[ name = {I} ,object = { matrix_inverse(T) } ] \foreach \j in {2,3,1,0}{ \appendsurface[ ustart = {-2} ,ustop = {2} ,usamples = {2} ,vstart = {-2} ,vstop = {2} ,vsamples = {2} ,transformation = {matrix_multiply(euler(\j+\i,2*\j,\j),T)} ,x = {u} ,y = {v} ,z = {\j/10} ,fill options = { preaction = { \ifnum\j=0 fill = red \fi \ifnum\j=2 fill = green \fi \ifnum\j=1 fill = yellow \fi \ifnum\j=3 fill = blue \fi ,fill opacity = 0.6 } ,postaction = { draw = black ,ultra thin ,line join = round ,line cap = round } } ,filter = { abs(matrix_multiply(A,I)[1][3])<1.01 and abs(matrix_multiply(B,I)[1][3])<1.01 and abs(matrix_multiply(C,I)[1][3])<1.01 and abs(matrix_multiply(A,I)[1][2])<1.01 and abs(matrix_multiply(B,I)[1][2])<1.01 and abs(matrix_multiply(C,I)[1][2])<1.01 and abs(matrix_multiply(A,I)[1][1])<1.01 and abs(matrix_multiply(B,I)[1][1])<1.01 and abs(matrix_multiply(C,I)[1][1])<1.01 } ] } \appendsolid[ ustart = {-1} ,ustop = {1} ,usamples = {2} ,vstart = {-1} ,vstop = {1} ,vsamples = {2} ,wstart = {-1} ,wstop = {1} ,wsamples = {2} ,transformation = {T} ,x = {u} ,y = {v} ,z = {w} ,fill options = { preaction = { fill = gray ,fill opacity = 0.5 } ,postaction = { draw = black ,ultra thin ,line join = round ,line cap = round } } ] \displaysegments \end{tikzpicture} \end{document} Gif: This is a picture of four planes intersecting, clipped by a cube. Currently, for the clipping (filtering) to work, projective transformations currently do not work, only affine ones do. This will eventually be fixed, of course. So it works, and all is fine and well - why are we here? Well, in the above diagram, each plane is offset by a small (and in each case different) translation. If this translation weren't there (and even with it there sometimes), we are faced with two triangles, which are capable of partitioning one another, which are not partitioned. I have the sense (possibly wrong) that this case wherre partitioning fails is when two triangles are non-coplanar, and meet at a vertex with the rest of their bodies visually passing through each other. It appears that my functions are not detecting and/or are not partitioning this case. For example, without the translation (it's a small difference, look at the z key), we get the following horrible graphic. \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \pgfmathsetmacro{\i}{-pi/4} \begin{tikzpicture} \useasboundingbox[scale=2] (-1,-1) rectangle (1,1); \setobject[ name = {T} ,object = { matrix_multiply( matrix_multiply( euler(pi/2,pi/3,7*pi/6) ,translate(0,0,-5) ) ,matrix_multiply( { {1,0,0,0} ,{0,1,0,0} ,{0,0,1,0} ,{0,0,0,1} } ,matrix_multiply(xscale(1),yscale(1)) ) ) } ] \setobject[ name = {I} ,object = { matrix_inverse(T) } ] \foreach \j in {2,3,1,0}{ \appendsurface[ ustart = {-2} ,ustop = {2} ,usamples = {2} ,vstart = {-2} ,vstop = {2} ,vsamples = {2} ,transformation = {matrix_multiply(euler(\j+\i,2*\j,\j),T)} ,x = {u} ,y = {v} ,z = {0} ,fill options = { preaction = { \ifnum\j=0 fill = red \fi \ifnum\j=2 fill = green \fi \ifnum\j=1 fill = yellow \fi \ifnum\j=3 fill = blue \fi ,fill opacity = 0.6 } ,postaction = { draw = black ,ultra thin ,line join = round ,line cap = round } } ,filter = { abs(matrix_multiply(A,I)[1][3])<1.01 and abs(matrix_multiply(B,I)[1][3])<1.01 and abs(matrix_multiply(C,I)[1][3])<1.01 and abs(matrix_multiply(A,I)[1][2])<1.01 and abs(matrix_multiply(B,I)[1][2])<1.01 and abs(matrix_multiply(C,I)[1][2])<1.01 and abs(matrix_multiply(A,I)[1][1])<1.01 and abs(matrix_multiply(B,I)[1][1])<1.01 and abs(matrix_multiply(C,I)[1][1])<1.01 } ] } \appendsolid[ ustart = {-1} ,ustop = {1} ,usamples = {2} ,vstart = {-1} ,vstop = {1} ,vsamples = {2} ,wstart = {-1} ,wstop = {1} ,wsamples = {2} ,transformation = {T} ,x = {u} ,y = {v} ,z = {w} ,fill options = { preaction = { fill = gray ,fill opacity = 0.5 } ,postaction = { draw = black ,ultra thin ,line join = round ,line cap = round } } ] \displaysegments \end{tikzpicture} \end{document} It appears that there is a problem for triangles which are capable of partitioning one another, which also coincide at a single vertex. I am having trouble debugging it. These are the main functions of the document which I am suspect of (it's a huge pipeline of interacting functions, all from the Lua file in the package, if you want to just go there): --- returns the partition of the first triangle into three subtriangles, --- if it intersects the second, otherwise produces nil --- @param T1 table<table<number>> the first triangle --- @param T2 table<table<number>> the second triangle --- @return table<table<table<number>>,table<table<number>>,table<table<number>>> table of sub triangles local function triangle_triangle_partition(T1, T2) local I = triangle_triangle_intersections(T1, T2) if I == nil then return nil end if #I == 0 then return nil end if #I == 1 then return nil end if #I ~= 2 then assert(false, ("I is not 2, it is instead: %f"):format(#I)) end local IO = I[1] local IU = vector_subtraction(I[2], IO) local I_basis = {IO[1], IU[1]} local T1A = {T1[1], T1[2]} local T1AU = vector_subtraction({T1A[2]}, {T1A[1]}) local T1A_basis = {T1A[1], T1AU[1]} local T1B = {T1[2], T1[3]} local T1BU = vector_subtraction({T1B[2]}, {T1B[1]}) local T1B_basis = {T1B[1], T1BU[1]} local T1C = {T1[3], T1[1]} local T1CU = vector_subtraction({T1C[2]}, {T1C[1]}) local T1C_basis = {T1C[1], T1CU[1]} local T2A = {T2[1], T2[2]} local T2AU = vector_subtraction({T2A[2]}, {T2A[1]}) local T2A_basis = {T2A[1], T2AU[1]} local T2B = {T2[2], T2[3]} local T2BU = vector_subtraction({T2B[2]}, {T2B[1]}) local T2B_basis = {T2B[1], T2BU[1]} local T2C = {T2[3], T2[1]} local T2CU = vector_subtraction({T2C[2]}, {T2C[1]}) local T2C_basis = {T2C[1], T2CU[1]} local points = {} local non_intersecting = nil local int1 = line_line_intersection(I_basis, T1A_basis) if int1 == nil then int1 = {solution = {}} end if #int1.solution ~= 0 then local t = int1.solution[1] local intersect = vector_addition( IO, scalar_multiplication(t, IU) ) if point_line_segment_intersecting(intersect, T1A) then table.insert(points, intersect) else non_intersecting = "T1A" end else non_intersecting = "T1A" end local int2 = line_line_intersection(I_basis, T1B_basis) if int2 == nil then int2 = {solution = {}} end if #int2.solution ~= 0 then local t = int2.solution[1] local intersect = vector_addition( IO, scalar_multiplication(t, IU) ) if point_line_segment_intersecting(intersect, T1B) then table.insert(points, intersect) else non_intersecting = "T1B" end else non_intersecting = "T1B" end local int3 = line_line_intersection(I_basis, T1C_basis) if int3 == nil then int3 = {solution = {}} end if #int3.solution ~= 0 then local t = int3.solution[1] local intersect = vector_addition( IO, scalar_multiplication(t, IU) ) if point_line_segment_intersecting(intersect, T1C) then table.insert(points, intersect) else non_intersecting = "T1C" end else non_intersecting = "T1C" end -- if #points == 3 then return nil end -- if #points == 1 then return nil end if #points ~= 2 then -- print("Partition failure: got", #points, "points") -- print("Triangle 1:", T1) -- print("Triangle 2:", T2) -- print("Non-intersecting edge:", non_intersecting) -- for i, p in ipairs(points) do -- print("Point", i, p[1][1], p[1][2], p[1][3]) -- end return nil --assert(false, "triangle_triangle_partition doesn't have exactly two points") end local quad = {} local tri1 local A, B = points[1], points[2] table.insert(quad, A[1]) table.insert(quad, B[1]) if non_intersecting == "T1A" then table.insert(quad, T1A[1]) table.insert(quad, T1A[2]) tri1 = {A[1], B[1], T1B[2]} elseif non_intersecting == "T1B" then table.insert(quad, T1B[1]) table.insert(quad, T1B[2]) tri1 = {A[1], B[1], T1C[2]} elseif non_intersecting == "T1C" then table.insert(quad, T1C[1]) table.insert(quad, T1C[2]) tri1 = {A[1], B[1], T1A[2]} end quad = centroid_sort(quad) return { tri1 = tri1, tri2 = {quad[1], quad[2], quad[3]}, tri3 = {quad[3], quad[4], quad[1]} } end --- produces exactly zero, or exactly two intersection points between two triangles --- @param T1 table<table<number>> a triangle defined by its vertices --- @param T2 table<table<number>> another triangle defined by its vertices --- @return table<table<number>> a matrix of exactly zero or exactly two points nothing else local function triangle_triangle_intersections(T1, T2) local edges1 = { {T1[1], T1[2]}, {T1[2], T1[3]}, {T1[3], T1[1]} } local edges2 = { {T2[1], T2[2]}, {T2[2], T2[3]}, {T2[3], T2[1]} } local points = {} --- appends a point to a list if it is unique --- @param P table<table<number>> a point local function add_unique(P) -- if not P then return nil end for _, Q in ipairs(points) do if point_point_intersecting(P, Q) then return nil end end table.insert(points, P) end -- Check all edge pairs for _, E1 in ipairs(edges1) do local intersect = line_segment_triangle_intersection(E1, T2) if intersect ~= nil then add_unique(intersect.intersection) end end for _, E2 in ipairs(edges2) do local intersect = line_segment_triangle_intersection(E2, T1) if intersect ~= nil then add_unique(intersect.intersection) end end if #points ~= 2 then -- print(("two triangles intersected at %f points"):format(#points)) -- print(fmt_matrix(T1)) -- print(fmt_matrix(T2)) return nil --assert(false, ("two triangles intersected at %f points"):format(#points)) end return points end --- determines the intersection coefficients and intersection point of a line segment and triangle, if it exists, or returns nil --- @param L table<table<number>> line segment defined by endpoints --- @param T table<table<number>> triangle defined by vertices --- @return table<table<table<number>>,table<table<number>>>|nil the solution coefficients and literal R3 intersection point local function line_segment_triangle_intersection(L, T) local eps = 0.0000001 local num = 0 for _, P1 in ipairs(L) do for _, P2 in ipairs(T) do if distance({P1}, {P2}) < eps then num = num + 1 end end end if num > 1 then return nil end local LO = {L[1]} local LU = vector_subtraction({L[2]}, LO) local LA = {LO[1], LU[1]} local TO = {T[1]} local TU = vector_subtraction({T[2]}, TO) local TUA = {TO[1], TU[1]} local TV = vector_subtraction({T[3]}, TO) local TVA = {TO[1], TV[1]} local TA = {TO[1], TU[1], TV[1]} local TUVA = { vector_addition(TO, TU)[1] ,vector_subtraction(TV, TU)[1] } local coeffs = line_plane_intersection(LA, TA) if coeffs == nil then return nil end if #coeffs.freevars == 0 then local t = coeffs.solution[1] if 0-eps<=t and t<=1+eps then local I = vector_addition( LO, scalar_multiplication(t, LU) ) if point_in_triangle(I, T) then return { solution = coeffs, intersection = I } end end end return nil end --- obtains the coordinates and free variables of the intersection --- between a line and a plane, each defined by their affine bases. --- @param L table<table<number>> an affine basis of a line --- @param T table<table<number>> an affine basis of a plane --- @return table<table<number>> the solution and free variables local function line_plane_intersection(L, T) local LO = {L[1]} local LU = {L[2]} local TO = {T[1]} local TU = {T[2]} local TV = {T[3]} --- LO + (t) * LU = TO + (s) * TU + (w) * TV -- (t) * LU - (s) * TU - (w) * TV = TO - LO local rhs = vector_subtraction(TO, LO) local augmented_matrix = { {LU[1][1], LU[1][2], LU[1][3]}, {-TU[1][1], -TU[1][2], -TU[1][3]}, {-TV[1][1], -TV[1][2], -TV[1][3]}, {rhs[1][1], rhs[1][2], rhs[1][3]} } local sol = gauss_jordan(augmented_matrix) if not sol then -- print("No solution: line-plane system inconsistent") return nil end if #sol.freevars > 0 then -- print("Line lies in the plane (coplanar case). Free vars:", #sol.freevars) end return sol end --- determines the solution coefficients and solution set of two line segments, or produces nil --- @param L1 table<table<number>> the first line segment --- @param L2 table<table<number>> the second line segment --- @return table<table<table<number>>,table<table<number>>>|nil the solution coefficients and solution set local function line_segment_line_segment_intersection(L1, L2) local num = 0 for _, P1 in ipairs(L1) do for _, P2 in ipairs(L2) do if distance({P1}, {P2}) < eps then num = num + 1 end end end if num ~= 0 then return nil end local L1O = {L1[1]} local L1U = vector_subtraction({L1[2]}, L1O) local L1A = {L1O[1], L1U[1]} local L2O = {L2[1]} local L2U = vector_subtraction({L2[2]}, L2O) local L2A = {L2O[1], L2U[1]} local coeffs = line_line_intersection(L1A, L2A) if coeffs == nil then return nil end if #coeffs.solution == 0 then return nil end local t, s = coeffs.solution[1], coeffs.solution[2] if 0 < t - eps and t < 1 - eps and 0 < s - eps and s < 1 - eps then return { coefficients = coeffs, intersection = vector_addition( L1O, scalar_multiplication(t, L1U) ) } end return nil end --- return coordinates and free variables for line-line intersection --- @param L1 table<table<number>> affine basis of a line --- @param L1 table<table<number>> another 1D affine basis --- @return table<table<number>> the solution and free variables local function line_line_intersection(L1, L2) local L1O = {L1[1]} local L1U = {L1[2]} local L2O = {L2[1]} local L2U = {L2[2]} -- L1O + (t) * L1U = L2O + (s) * L2U -- (t) * L1U - (s) * L2U = L1O - L2O local rhs = vector_subtraction(L2O, L1O) local augmented_matrix = { {L1U[1][1], L1U[1][2], L1U[1][3]}, {-L2U[1][1], -L2U[1][2], -L2U[1][3]}, {rhs[1][1], rhs[1][2], rhs[1][3]} } return gauss_jordan(augmented_matrix) end --- CAUTION: CHATGPT GENERATED -- Correct column-major Gauss-Jordan solver (drop-in replacement) -- M is an array of columns; each column is an array of n rows. -- Last column is RHS. Returns: -- {solution = {..}, freevars = {..}} on success -- nil on inconsistency --- @param M table<table<number>> an augmented matrix --- @return table<table<number>> the solution set and free variables local function gauss_jordan(M) -- basic validation local m = #M -- number of columns (vars + RHS) if m == 0 then return {} end local n = #M[1] -- number of rows (equations) local vars = m - 1 if vars < 1 then return nil end for c = 1, m do if #M[c] ~= n then return nil end end -- Work on a local copy local cols = {} for c = 1, m do cols[c] = {} for r = 1, n do cols[c][r] = M[c][r] end end local rank = 0 local row = 1 local pivot_cols = {} -- track pivot columns -- Gauss–Jordan elimination for col = 1, vars do -- find pivot row in column col, rows row..n local pivot_row = nil local maxval = eps for r = row, n do local v = math.abs(cols[col][r]) if v > maxval then maxval = v pivot_row = r end end if pivot_row then -- swap pivot_row with current row if pivot_row ~= row then for c = 1, m do cols[c][row], cols[c][pivot_row] = cols[c][pivot_row], cols[c][row] end end -- normalize pivot row local pivot = cols[col][row] for c = 1, m do cols[c][row] = cols[c][row] / pivot end -- eliminate column in other rows for r = 1, n do if r ~= row then local factor = cols[col][r] if math.abs(factor) > eps then for c = 1, m do cols[c][r] = cols[c][r] - factor * cols[c][row] end cols[col][r] = 0 end end end pivot_cols[#pivot_cols+1] = col rank = rank + 1 row = row + 1 if row > n then break end end end -- check for inconsistency: [0 0 ... | b] with b≠0 for r = rank+1, n do local all_zero = true for c = 1, vars do if math.abs(cols[c][r]) > eps then all_zero = false break end end if all_zero and math.abs(cols[m][r]) > eps then return nil -- inconsistent end end -- Identify free variables local freevars = {} local pivotset = {} for _,c in ipairs(pivot_cols) do pivotset[c] = true end for c = 1, vars do if not pivotset[c] then freevars[#freevars+1] = c end end -- Extract one particular solution local sol = {} for i = 1, vars do sol[i] = 0 end for k,pcol in ipairs(pivot_cols) do sol[pcol] = cols[m][k] -- solution from reduced form end return {solution = sol, freevars = freevars} end

  • How can I control the horizontal and vertical space of an image using \llap in LaTeX?
    by Marco Moldenhauer on November 20, 2025 at 7:11 pm

    I’m trying to control the horizontal and vertical positioning of a graphic inside another graphic in a beamer presentation using \llap. However, the \hspace{-2cm} and \vspace{-2cm} commands don't seem to work as expected. \documentclass{beamer} \NewDocumentCommand\StepFrame{m m m m m o o} { \begin{frame}{#4 Step #2/#3} #5 \fbox{\includegraphics[width=\textwidth]{IMAGES/Set#1/Step#2.png}} \IfNoValueF{#6} { \llap{ \hspace{-2cm} % Horizontal offset does not work \vspace{-2cm} % Vertical offset does not work \includegraphics[width=0.4\textwidth]{IMAGES/Set#6/Step#7.png} } } \end{frame} } \begin{document} \StepFrame{2}{1}{54}{Vitis}{Click Set Workspace} \StepFrame{2}{2}{54}{Vitis}{image description missing} \StepFrame{2}{3}{54}{Vitis}{image description missing} \StepFrame{2}{4}{54}{Vitis}{image description missing} \StepFrame{2}{5}{54}{Vitis}{image description missing}[2][5b] \end{document}

  • circuitikz: How to rotate the "component-labels" in normal alignment (for example ϑ↑↓)
    by cis on November 20, 2025 at 2:40 pm

    Is there a package-like way to rotate the "component-labels" as like the others in normal alignment? For example: \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors] %\ctikzset{label/align=rotate} % something other... \draw[] (0,0) to[sinusoidal voltage source, l=$u(t)$] (0,3) to[vR=$R$, f>^=$i(t)$] (4,3) to[L=$L$] (4,0) to[ecapacitor=$C$] (0,0); % How to rotate component-label? \draw[blue] (3,0) to[thermistor ntc, *-*] (3,3); \end{circuitikz} \end{document} PS: Then I noticed that 'ϑ' doesn't turn blue when I say \draw[blue]; that's probably not intentional (?). €dit (side problem solved): I would have need to say \draw (3,0) to[thermistor ntc, color=blue, *-*] (3,3); as mentioned from @kabenyuk.

  • How can I draw a bond that overlaps/obscures another bond using `\usepackage{chemfig}`?
    by H4XeO6 on November 20, 2025 at 5:48 am

    In other words, how can I draw the dashed red bond in the following figure? I know that the following workaround works: \documentclass{standalone} \usepackage{chemfig} \begin{document} \chemfig{ A?[a]-[:30,2,,,color=red]B-[:-90]C(-[:150,2,,,color=white,line width=2pt])-[:150,2,,,line width=1.2pt]D?[a] } \end{document} However, this method requires drawing the bonds layer by layer, and in some situations it becomes difficult—or even impossible—to control the drawing order of the bonds. It also seems that chemfig itself does not provide any mechanism for rendering overlapping bonds. For example, even in the package documentation, cases like the one below show no explicit handling of overlapping bonds:

  • 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?

  • XeLaTeX vs. LuaLaTeX with special font
    by Alain Stalder on November 19, 2025 at 7:56 am

    This time from me a question around a set of issues that can maybe actually be resolved in the near future, even though more likely via code changes than just configuration, but I am asking here first for some insights... I have a document with a rather special font, a font has been working well with all of its features on modern webbrowsers and also e.g. on Mac since at least 2021, and I am using XeLaTeX to render it, where it also essentially works. But since apparently things gravitate towards evolving rather LuaLaTeX than XeLaTeX, I wanted to see if I can just switch to LuaLaTeX, also since that had worked fine for me with at least one "normal" font in a somewhat simpler setup. Well, this seems to fail in various ways. Here is some source that is close enough to my real use case to show them all: \documentclass{article} \usepackage[english]{babel} \usepackage{geometry} \usepackage{fontspec} \geometry{ twoside=true, paperwidth=4.37in, paperheight=7in, top=0.263in, bottom=0.613in, inner=0.64in, outer=0.5in, bindingoffset=0cm, } \AddToHook{normalfont}{ \fontdimen2\font=0.25em % interword space \fontdimen3\font=0.3em % interword stretch \fontdimen4\font=0.2em % interword shrink \fontdimen7\font=0.1em % extra space } % https://jack-daw.com/fonts/jackwrite.zip \setmainfont{Jackwrite.ttf}[ %Renderer=HarfBuzz, Scale=MatchLowercase, FakeBold=0.001, ] \begin{document} \noindent Cynthia was secretly peeking over Jack’s shoulder as he started to write: \vspace{2.2mm}\noindent All experience in life is personal. Life as experienced by everybody is a bit like a movie. Things are happening inside and outside of you. Unlike in a movie, you can influence some of it. But most of it is just happening independently of what you desire. Nobody ever looked at the world consistently from that perspective. The personal, individual perspective. How everybody experiences life. Obviously this is not the only viable perspective. But a fascinating one. With lots of potential to explore. Way more than it may seem. What’s in it for you? Well, many things in the world are simpler from this perspective. A lot of things should make sense that previously seemed hard to relate. This can be useful, make happy. It hardly ever makes things more convoluted. So let me just start. \end{document} Here is the output with XeLaTeX: Here with LuaLaTeX and HarfBuzz renderer: And the same but without FakeBold, since it "blurs" other issues: And here just as an example for basic usage outside TeX in TextEdit on Mac: Obviously, FakeBold behaves differently. I noticed that with XeLaTeX, there seems to be a discrete jump between no FakeBold and a very low values like FakeBold=0.001 and then things appear to stay roughly constant until you get to something around FakeBold=3, while with LuaLaTeX (HarfBuzz) the values seem to have a more linear effect. I can live with that, and seems rather to be an issue or limitation with XeLaTeX than LuaLaTeX. But worse is, of course, how the paragraphs are rendered overall. In principle, since XeLaTeX is apparently also based on HarfBuzz, you would expect the same result. The space between words shrinks much smaller with LuaLaTeX. Also, which is not immediately obvious, with LuaLaTeX the width of paragraphs is slightly larger, which I could presumably correct by reducing the nominal width, but that seem to be rather a workaround. About the font (download it here): It is based on a subset of the glyphs from Fredrick Brennan’s TT2020 Font, a monospaced typewriter font with the special feature of rendering each character as 9 slightly different glyphs with tiny "typewriter-like" defects, described who it works by him here. What I did for the Jackwrite font was to add kerning individually between each character pair, actually between all 9 variants of it, which means that there is quite a bit more kerning info in the font than usual. (The Node renderer of LuaLaTeX fails to get the kerning right, or rather gets it right in only maybe 95% of cases, I have not investigated further there.) Added same day in evening: I noticed that what I wrote about the discrete jump for FakeBold with XeLaTeX is not true, was an "illusion", where I viewed it (TexShop on Mac) at lower magnification the fake bold shows more strongly than at higher magnification. Here is a comparison for the following source (plus use corresponding renderers when using LuaLaTeX) \documentclass{article} \usepackage{fontspec} \begin{document} \Huge \setmainfont{Jackwrite.ttf} XeLaTeX\par \setmainfont{Jackwrite.ttf} yyyyyyyyy\par \setmainfont{Jackwrite.ttf}[FakeBold=0.001] yyyyyyyyy 0.001\par \setmainfont{Jackwrite.ttf}[FakeBold=1] yyyyyyyyy 1\par \setmainfont{Jackwrite.ttf}[FakeBold=2] yyyyyyyyy 2\par \setmainfont{Jackwrite.ttf}[FakeBold=3] yyyyyyyyy 3\par \setmainfont{Jackwrite.ttf}[FakeBold=4] yyyyyyyyy 4\par \setmainfont{Jackwrite.ttf}[FakeBold=5] yyyyyyyyy 5\par \setmainfont{Jackwrite.ttf}[FakeBold=10] yyyyyyyyy 10\par \setmainfont{Jackwrite.ttf}[FakeBold=20] yyyyyyyyy 20\par \end{document} Thus except for the difference for 0.001, pretty much the same result. (The difference for the "10" with XeLaTeX is presumably because, due to some different internas, it chose another one of the 9 glyphs for "1" than with LuaLaTeX.) And, I presume some tiny "spikes" the glyphs are amplified a lot when using large values for FakeBold. That is OK for my use case, and probably better fixed if needed in the font itself, while a more robust algorithm for FakeBold would, of course, in principle be desirable. Leaves the issue with different spacing and paragraph widths...

  • TQFT non-usual cobordism drawing
    by MATIAS EZEQUIEL STICCA GONZLEZ on November 19, 2025 at 12:43 am

    I'm currently trying to recreate something like this: Using of course the tikz tqft library. So, I first tried to do the "easiest" part, that is the drawing alone of every cobordism used in the relation. So, here's my attempt for that: \documentclass[10pt,border=3mm,tikz]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric,tqft} \usepackage{tqft} \tikzset{tqft/use nodes=true} \begin{document} \begin{tikzpicture}[ tqft, mycobordism/.style={ draw, boundary lower style={draw}, boundary upper style={draw}, circle width=0.4cm, circle depth=0.15cm, } ] \node[ tqft cap, mycobordism, cobordism height=2cm, flow=east, anchor=center ] (a) at (-0.7,0) {}; \node at (0, -0.8) {$\epsilon$}; \node at (0, -1.1) {counit}; \end{tikzpicture} \begin{tikzpicture} \tikzset{ tqft/use nodes=false, } \pic[ tqft, incoming boundary components=0, outgoing boundary components=2, genus=0, every lower boundary component/.style={draw}, every outgoing boundary component/.style={draw}, cobordism edge/.style={draw}, ]; \end{tikzpicture} \end{document} Aaaaand, as you may see, the problems begins. First, it seems that if you use a cobordism that is not the "primary ones" (I mean, pair of pants, cup, etc) then you have to add the command node=false, and then I'm unable to do two things: labelling the cobordism and rotating it so it's not looking down. Well, I can worry about the equalities later, but I'd appreciate if someone has some idea of how to "glue" cobordisms in general, so I can try it on my own and learn how to do it, because these ones are the simplest ones that I need to do. Anyways, thank you!

  • Correct section numbering in header using LaTeX
    by marcelgoh on November 18, 2025 at 11:35 pm

    I have mostly been a Plain TeX user, but for collaboration purposes find myself having to use LaTeX. In the LaTeXed book I am working on, I would like to have headers as described in the fourth paragraph of page 260 of the TeXbook: "On left-hand pages, the section number in the headline is supposed to reflect the situation at the top of the page, as we have discussed, but on right-hand pages it is supposed to refer to the bottom of the page." Knuth then goes on to give the Plain TeX solution to this problem: \def\beginsection #1. #2. {\mark{\currentsection \noexpand\else #1} \sectionbreak \leftline{\sectionfont #1. #2} \mark{#1\noexpand\else #1} \def\currentsection{#1} \nobreak\smallskip\noindent} \def\currentsection{} % the current section number The \rightheadline macro can then use \iftrue\botmark\fi, and the \leftheadline macro can say \expandafter\iffalse\topmark\fi. I won't claim to fully understand how everything works here, but I successfully adapted this code before for my Master's thesis that I wrote in Plain TeX several years ago. (EDIT. I looked through the code for my thesis again, and found that I only used one mark, ignoring Knuth's warning, and sure enough there is a mistake in the header numbering in my thesis. But I do trust that this code in the TeXbook works, and of course TAOCP doesn't have any header numbering issues that I know of.) My question is, what is the best way to get this same behaviour in LaTeX using the fancyhdr package? I have the following MWE (it feels wrong to use \rightmark on a left-hand page, but if I use \leftmark I get the a blank, presumably because I haven't defined a chapter title yet). \documentclass[10pt]{book} \usepackage{fancyhdr, lipsum, extramarks} \pagestyle{fancy} \fancyhf{} \fancyhead[LE]{\thepage} \fancyhead[RE]{\rightmark} \fancyhead[LO]{\rightmark} \fancyhead[RO]{\thepage} \begin{document} \section{First section} \lipsum[1-7] \section{Second section} \lipsum[1-5] \section{Third section} \lipsum[1-2] \goodbreak \section{Fourth section} \lipsum[1-2] \end{document} It produces the following four pages, which I believe should illustrate the full complexity of the problem. Page 1 is correct since the section at the bottom of the page is still 0.1. Page 2 is incorrect because the section at the top of the page is still 0.1, but it says 0.2 Page 3 is correct since the section at the bottom of the page is 0.3. Page 4 is correct since section 0.4 starts at the top of the page, (but it's correct by accident, since there is no section 0.5). How would one fix this MWE to get the headers to say 0.1, 0.1, 0.3, and 0.4? I am not above janky things like redefining LaTeX primitives, but I'd prefer the least invasive solution. I thought the extramarks package might be what I need, but I wasn't able to figure out how to make it work. Thanks in advance! EDIT. It seems, following @cfr's comments, that out of the box package solutions might not be good enough to solve this issue. I suspect that one might have to redefine LaTeX's \beginsection code (or whatever its analogue is) to emit two marks as in the TeXbook example. I'll look into this myself once I have some free time tomorrow or later in the week, but if anyone beats me to it I'd gladly accept the answer, of course!

  • interaction between command \IfNoValueTF and baseline in TikZ
    by Léo S. on November 18, 2025 at 10:12 pm

    I am trying to define a command that draw TikZ pictures whose baseline is centered, with an optional argument to modify the y-coordinate of the baseline. I came up with the following code. When the optional parameter is provided, it behaves as expected. However, when no parameter is provided, it doesn't do what I expected: instead, it seems to pick the top as the baseline. If I manually replace the parameters, it behaves as expected. What is it that I am missing? \documentclass{article} \usepackage{tikz} \NewDocumentCommand{\tikzpic}{mO{}}{ \begin{tikzpicture}[ baseline=(base), ] #1 \IfNoValueTF{#2} {\coordinate (base) at (current bounding box.center);} {\coordinate (base) at (0,#2);} \end{tikzpicture} } \begin{document} command \tikzpic{ \draw (0,0) rectangle (1,1); } \medbreak expected behaviour \begin{tikzpicture}[ baseline=(base), ] \draw (0,0) rectangle (1,1); \coordinate (base) at (current bounding box.center); \end{tikzpicture} \end{document}

  • Line wrapping in forest labels
    by Mate de Vita on November 18, 2025 at 9:25 pm

    I have the following forest setup that allows me to add citations to the bottom of each leaf node of my taxonomical diagram: \documentclass[twocolumn]{article} \usepackage{array} \usepackage{tikz} \usepackage{forest} % tikz setup \newcolumntype{C}[1]{>{\centering}p{#1}} \forestset{% cite/.style={label=below:{\cite{#1}}}, concept/.style={% anchor=center, rounded corners, draw=black, fill=blue!20, l sep'=20pt, s sep'=2.5pt, align={C{2cm}}, font=\small, }, } \begin{document} \begin{figure*} \centering \begin{forest} for tree={concept}, [Segmentation [Classical [Colour \& intensity, cite={entry01}] [Clustering, cite={entry02}] ] [Deep [Downstream CNN, cite={entry03}] [CED, cite={entry04}] [GAN, cite={entry05}] [Transformers, cite={entry06}] ] ] \end{forest} \end{figure*} \bibliographystyle{unsrt} \bibliography{Literature} \end{document} This works fine (aside from some vertical alignment issues), as seen in the above picture. However, if I include several references, the picture becomes unreadable: \begin{figure*} \centering \begin{forest} for tree={concept}, [Segmentation [Classical [Colour \& intensity, cite={entry01,entry07,entry08,entry09,entry10,entry11,entry12,entry13,entry14,entry15,entry16,entry17,entry18}] [Clustering, cite={entry02,entry19,entry20,entry21,entry22,entry23,entry24,entry25,entry26,entry27,entry28,entry29,entry30}] ] [Deep [Downstream CNN, cite={entry03}] [CED, cite={entry04}] [GAN, cite={entry05}] [Transformers, cite={entry06}] ] ] \end{forest} \end{figure*} In this specific case, this would be solvable using citation ranges (like [1-4] instead of [1],[2],[3],[4]), but this isn't always possible in general. Is there a way to make forest automatically wrap the citation text into multiple lines so each label fits within the width of its leaf node? ChatGPT-generated fake .bib file included below for easier testing: @article{entry01, author={Ima N. Ventor}, title={Applications of Imaginary Coefficients in Everyday Life}, year={2024}, journal={Journal of Hypothetical Mathematics} } @article{entry02, author={Fae K. Titious}, title={A Survey of Nonexistent Marine Species}, year={2023}, journal={Aquatic Fiction Review} } @article{entry03, author={Nulla Fictor and Max U. Lation}, title={Stability Analysis of Impossible Equilibria}, year={2022}, journal={Unreal Dynamics Letters} } @article{entry04, author={Veris I. Militude}, title={Cartographic Techniques for Mapping Uncharted Dimensions}, year={2025}, journal={Atlas of Imagined Worlds} } @article{entry05, author={Anne Thropic}, title={Entropy in Alternate Reality Thermodynamics}, year={2021}, journal={Speculative Physics Quarterly} } @article{entry06, author={Hugh M. Or}, title={On the Predictability of Completely Random Events}, year={2020}, journal={Journal of Impossible Statistics} } @article{entry07, author={Sara N. Dippity}, title={Causality Reversal in Hypothetical Timelines}, year={2024}, journal={Temporal Studies Review} } @article{entry08, author={U. N. Known}, title={An Overview of Anonymous Particles in Theoretical Physics}, year={2022}, journal={Particles of Mystery} } @article{entry09, author={Eve N. Tual}, title={Evaluating the Ethics of Fictional AI}, year={2023}, journal={Synthetic Minds Journal} } @article{entry10, author={Doug M. Atic}, title={Acoustic Properties of Silent Materials}, year={2022}, journal={Journal of Hypersilent Engineering} } @book{entry11, author={Paige Turner}, title={A Complete History of Books That Were Never Written}, year={2020}, publisher={Phantom Press} } @book{entry12, author={Wyn D. Ows}, title={Wind Patterns in Empty Universes}, year={2024}, publisher={Imaginary Atmospheres Publishing} } @book{entry13, author={A. Bridge}, title={Crossing Conceptual Gaps: A Study}, year={2021}, publisher={Metaphorical Structures Press} } @inproceedings{entry14, author={Meta Phar and Ali Gory}, title={Symbolism in Objects That Do Not Exist}, booktitle={11th Conference on Abstract Semantics}, year={2023} } @inproceedings{entry15, author={Nora Tion}, title={Notions of Nothingness in Pre-Theoretical Cosmology}, booktitle={Symposium on Vacuous Phenomena}, year={2022} } @article{entry16, author={Ella Vate}, title={Elevated Thinking: Airborne Philosophies}, year={2021}, journal={Journal of High-Altitude Thought} } @article{entry17, author={Cy R. Cling}, title={Cycling Through Recursive Metaphors}, year={2025}, journal={Recursive Discourse Review} } @article{entry18, author={Alf A. Numeric}, title={Counting the Uncountable: A Formal Study}, year={2024}, journal={Mathematics of Paradox} } @article{entry19, author={Lois Tick}, title={Temporal Loops in Fictional Biographies}, year={2023}, journal={Chronological Imaginarium} } @article{entry20, author={Gene Erration}, title={Genetic Drift in Pretend Organisms}, year={2021}, journal={Imaginary Genetics Bulletin} } @article{entry21, author={Art I. Ficial}, title={Artificial Creativity and Imagined Innovation}, year={2022}, journal={Invented Ideas Review} } @article{entry22, author={Ray F. Erence}, title={Optical Behavior of Nonexistent Light}, year={2025}, journal={Invisible Optics Letters} } @article{entry23, author={Quinn Tess}, title={Questioning Questions That Cannot Be Asked}, year={2021}, journal={Philosophy of the Unaskable} } @article{entry24, author={Clara Fication}, title={Clarifying Ambiguously Clear Concepts}, year={2022}, journal={Journal of Semantic Precision} } @inproceedings{entry25, author={Otto Nomous}, title={Autonomous Systems with No Defined Purpose}, booktitle={Workshop on Aimless Engineering}, year={2024} } @article{entry26, author={Mira Ge}, title={Mirages as Data Sources in Hypothetical Scenarios}, year={2021}, journal={Illusionary Data Reports} } @article{entry27, author={Theo Retical}, title={Theoretical Approaches to Pure Abstraction}, year={2023}, journal={Conceptual Mechanics} } @article{entry28, author={Penny Tration}, title={Penetrating Layers of Conceptual Density}, year={2020}, journal={Dense Ideas Journal} } @article{entry29, author={Bea Yond}, title={Going Beyond the Limits of Imagined Space}, year={2024}, journal={Frontiers of Fictional Cosmology} } @article{entry30, author={Wanda R. Ing}, title={Wandering Through Indeterminate Models}, year={2023}, journal={Models of Uncertainty Review} }

  • 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}

  • Remove "middle quotes" on line breaks with the verse environment
    by ronno on November 18, 2025 at 5:35 am

    I'm using the \enquote command from csquotes to automatically produce appropriate quotation marks. I have also specifically enabled the "middle quotes" so that if there's a paragraph break inside a quotation then the new paragraph starts with an extra opening quote. But this is producing unwanted middle quotes in the verse environment. Here is an example: \documentclass{book} \usepackage[english=american]{csquotes} \DeclareQuoteStyle[american]{english} {\textquotedblleft} [\textquotedblleft] {\textquotedblright} {\textquoteleft} [\textquoteleft] % this is redundant for the example but I kept it for symmetry {\textquoteright} \begin{document} \enquote{Voila!\\ In view, a humble vaudevillian veteran, cast vicariously as both victim and villain in the vicissitudes of fate. This visage, no mere veneer of vanity, is but a vestige of the \enquote{vox populi} now vacant, vanished.} \begin{verse} \enquote{Mary had a little lamb,\\ Its fleece was white as snow\\ And everywhere that Mary went\\ The lamb was sure to go. It followed her to school one day,\\ That was against the rule;\\ It made the children laugh and play,\\ To see a lamb at school.} \end{verse} \end{document} I only want the first line of each stanza to start with opening quotes, just like the prose, but as it stands every line gets one. So in the output as follows, I don't want the highlighted quotation marks to appear: In case it matters, I would like the solution to also work with the more advanced verse environment from the memoir class. Tangential issue: I want to also be able to use just one \enquote in case the same quotation changes from prose to verse (or vice versa), but I don't see how to nest the \enquote and verse appropriately for that (unless there is prose both before and after the verse).