Hot
- How to use a GPU to run Lua math faster?by Jasper on November 23, 2025 at 12:37 am
I've heard that I can hook up a GPU to handle my matrix multiplications significantly faster. I want to do this locally, so I can make gifs faster. E.g., I have a lua-based animation, and it still takes ages to compile. I heard a GPU can do it orders of magnitude faster. That makes a 10 minute video compile in about 6 seconds, assuming as least two orders. MWE: \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \pgfmathsetmacro{\startparam}{0} \pgfmathsetmacro{\stopparam}{2*pi} \pgfmathsetmacro{\samplesparam}{40} \pgfmathsetmacro{\stepparam}{(\stopparam-\startparam)/(\samplesparam-1)} \foreach \param[parse=true] in {\startparam,\startparam+\stepparam,...,\stopparam-\stepparam } { \begin{tikzpicture} \useasboundingbox[scale=6] (-1,-1) rectangle (1,1); \setobject[ name = {T} ,object = { matrix_multiply( matrix_multiply( euler(pi/2,pi/4+pi/4*sin(\param),5.25*pi/6+\param) ,translate(0,0,-10) ) ,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) } ] \appendsurface[ ustart = {-2} ,ustop = {2} ,usamples = {20} ,vstart = {-2} ,vstop = {2} ,vsamples = {20} ,transformation = {T} ,x = {u} ,y = {v} ,z = {u^4 + v^4 - 4*u*v + 1} ,fill options = { preaction = { fill = green ,fill opacity = 0.2 } ,postaction = { draw = blue ,ultra thin ,line join = round } } ,filter = { abs(matrix_multiply(A,I)[1][3])<2.01 and abs(matrix_multiply(B,I)[1][3])<2.01 and abs(matrix_multiply(C,I)[1][3])<2.01 and abs(matrix_multiply(A,I)[1][2])<2.01 and abs(matrix_multiply(B,I)[1][2])<2.01 and abs(matrix_multiply(C,I)[1][2])<2.01 and abs(matrix_multiply(A,I)[1][1])<2.01 and abs(matrix_multiply(B,I)[1][1])<2.01 and abs(matrix_multiply(C,I)[1][1])<2.01 } ] % I can't find these trajectories for the life of me! % \appendcurve[ % ustart = {-2} % ,ustop = {2} % ,usamples = {20} % ,transformation = {T} % ,x = {u*cos(pi/4)} % ,y = {u*sin(pi/4)} % ,z = {(u*cos(pi/4))^4 + (u*sin(pi/4))^4 - 4*(u*cos(pi/4))*(u*sin(pi/4)) + 1} % ,draw options = { % draw = blue % ,ultra thin % ,line join = round % } % ] % \appendcurve[ % ustart = {-2} % ,ustop = {2} % ,usamples = {20} % ,transformation = {T} % ,x = {u*cos(3*pi/4)} % ,y = {u*sin(3*pi/4)} % ,z = {(u*cos(3*pi/4))^4 + (u*sin(3*pi/4))^4 - 4*(u*cos(3*pi/4))*(u*sin(3*pi/4)) + 1} % ,draw options = { % draw = red % ,ultra thin % ,line join = round % } % ] \appendsolid[ ustart = {-2} ,ustop = {2} ,usamples = {2} ,vstart = {-2} ,vstop = {2} ,vsamples = {2} ,wstart = {-2} ,wstop = {2} ,wsamples = {2} ,transformation = {T} ,x = {u} ,y = {v} ,z = {w} ,fill options = { preaction = { fill = none ,fill opacity = 0.5 } ,postaction = { draw = none ,ultra thin ,line join = round ,line cap = round } } ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {0} ,y = {0} ,z = {u} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {0} ,y = {0} ,z = {4.3} ,transformation = {T} ,name = {\(z\)} ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {0} ,y = {u} ,z = {0} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {0} ,y = {4.3} ,z = {0} ,transformation = {T} ,name = {\(y\)} ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {u} ,y = {0} ,z = {0} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {4.3} ,y = {0} ,z = {0} ,transformation = {T} ,name = {\(x\)} ] \foreach \p in {-4,-3,...,4} { \appendcurve[ ustart = {-4} ,ustop = {4} ,usamples = {2} ,x = {u} ,y = {\p} ,z = {0} ,transformation = {T} ,draw options = { draw = black!70!white ,ultra thin ,line cap = round ,densely dashed } ] \appendcurve[ ustart = {-4} ,ustop = {4} ,usamples = {2} ,x = {\p} ,y = {u} ,z = {0} ,transformation = {T} ,draw options = { draw = black!90!white ,ultra thin ,line cap = round ,densely dashed } ] } \appendsurface[ ustart = {-4} ,ustop = {4} ,usamples = {2} ,vstart = {-4} ,vstop = {4} ,vsamples = {2} ,transformation = {T} ,x = {u} ,y = {v} ,z = {0} ,fill options = { preaction = { fill = gray!70!white ,fill opacity = 0.6 } ,postaction = { draw = none ,ultra thin ,line join = round } } ] \displaysegments \end{tikzpicture} } \end{document}
- [T1]{fontenc} changes "lightness" of fontby Allan Felipe on November 22, 2025 at 11:04 pm
I noticed that I need to comment the line \usepackage[T1]{fontenc} to get a normal font or else it becomes "light". Since I believe that's not a normal behavior, what could be the reason for that? I'll paste the packages in my preamble and two images with and without [T1]{fontenc}. Thanks % \usepackage[T1]{fontenc} \usepackage[ansinew]{inputenc} \usepackage[brazil]{babel} \usepackage{etoolbox} \usepackage{graphicx} \usepackage{array} \usepackage{caption} \usepackage{subcaption} % \usepackage{newtxtext,newtxmath} \usepackage{pifont} \usepackage[dvipsnames]{xcolor} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tikz} \usepackage{multirow} \usepackage{fancyhdr} \usepackage{indentfirst} \usepackage[a4paper, left=2.5cm, right=2.5cm, bottom=2.2cm, top=3.2cm]{geometry}
- Why doesn't Tcolorbox respect spacingby Dorian on November 22, 2025 at 10:41 pm
I am facing a problem with tcolorbox: the spacing between my paragraphs and my lists is not the same inside a tcolorbox, and I don’t know how to fix it (as you can see in the image, the blue arrow shows a much larger spacing than the purple arrow). Thank you in advance. MWE : \documentclass[11pt]{article} % Encodings and language \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \usepackage{lmodern} % ============================================================ % GLOBAL SPACING MANAGEMENT % ============================================================ % 1. Spacing between paragraphs \setlength{\parskip}{4pt} % space between paragraphs \setlength{\parindent}{0pt} % indentation of the first line % 2. Line spacing in the text \usepackage{setspace} \setstretch{1.15} % line spacing (1.0 = single, 1.3 = 1.5, 1.6 = double) % ============================================================ % LIST MANAGEMENT (itemize, enumerate, etc.) % ============================================================ \usepackage{enumitem} % Fine configuration: \setlist{ % itemsep=0pt, % space between items % parsep=4pt, % space between paragraphs inside an item topsep=0pt, % space before/after the list % partopsep=2pt, % additional space at the beginning of a list inside environments % left=1.5em % left margin } % ============================================================ % PARAMETERS FOR TCOLORBOX % ============================================================ \usepackage{tcolorbox} % Example of a tcolorbox style controlling spacing \tcbset{ myboxstyle/.style={ colback=white, colframe=black, boxsep=4pt, % internal space between the border and the text left=4pt, % internal left margin right=4pt, % internal right margin top=6pt, % internal top margin bottom=6pt, % internal bottom margin before skip=12pt, % space before the box after skip=12pt, % space after the box } } % ============================================================ \begin{document} \section*{Example with all spacing controlled} Here is a paragraph of text to illustrate spacing. % Outer list \begin{itemize} \item Outer item A \item Outer item B \item Outer item C \end{itemize} Here is the paragraph that follows the list. % tcolorbox with a list \begin{tcolorbox}[myboxstyle, title=Box with itemize] Example of text inside a tcolorbox. \begin{itemize} \item Inner item 1 \item Inner item 2 \item Inner item 3 \end{itemize} Middle of the box \begin{itemize} \item Inner item 4 \item Inner item 5 \item Inner item 6 \end{itemize} \end{tcolorbox} % List after the box \begin{itemize} \item Outer item D \item Outer item E \end{itemize} \end{document}
- Make tcblistof display tcolorboxes from the current chapter onlyby UnderscorePoY on November 22, 2025 at 9:41 pm
Setup: In a big document with several chapters, i generate several tcolorbox instances per chapter of the same tcbtheorem called "method", with an option list inside={methods}. Needed: At the start of each chapter, i want to display -- with a call to \tcblistof -- a list of all methods within that chapter. Issue: With this default implementation, the first call to \tcblistof outputs a single list containing all "method" boxes from all the chapters, and any subsequent call to \tcblistof produces an empty list. Question: What is the simplest way to achieve this ? An idea could be to edit the value inside the list inside option to change depending on the chapter count, but i don't know how to do this or even if this is the cleanest solution. MWE: \documentclass[a4paper, 11pt]{report} \usepackage[many]{tcolorbox} \newtcbtheorem[list inside={methods}]{method}{Method}{}{}% \begin{document} \chapter{My chapter 1} \tcblistof[\section*]{methods}{Methods Chapter 1}% Lists all methods, not only this chapter's \begin{method}{1}{} \end{method} \begin{method}{2}{} \end{method} \chapter{My chapter 2} \tcblistof[\section*]{methods}{Methods Chapter 2}% Lists nothing \begin{method}{3}{} \end{method} \begin{method}{4}{} \end{method} \end{document}
- Factorize a forest codeby projetmbc on November 22, 2025 at 9:40 pm
In the code below, there is too much copying and pasting of lines like the ones shown below. What is the best way to factorize 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}
- Using preview with glossaries?by nowox on November 22, 2025 at 8:28 pm
I notice the following do not build: \documentclass{article} \usepackage[active,tightpage]{preview} \setlength\PreviewBorder{0pt} \usepackage[acronym]{glossaries} \makeglossaries \newacronym{NASA}{NASA}{National Aeronautics and Space Administration} \begin{document} \begin{preview} The National Aeronautics and Space Administration \acrshort{NASA} is responsible for the civilian space program. \printglossary[type=\acronymtype, title=List of Acronyms] \end{preview} \end{document} There is a clash between the preview: \@istfilename found in 'test.aux'. It seems preview don't like the \write triggered by \acrshort and \printglossary. I notice I can tweak the .latexmkrc: $bibtex_use = 2; $biber = 'biber %O %B'; $root_filename = 'test'; $pdf_mode = 4; # Preview is enabled only after a successful glossaries run: we gate on a flag # file %R.preview.ready set by run_makeglossaries. $lualatex = qq{bash -lc 'TS_PREVIEW=\$( [ -f "%R.preview.ready" ] && echo 1 || echo 0 ); \ export TS_PREVIEW; lualatex --shell-escape %O %S'}; if (system("which texindy >/dev/null 2>&1") == 0) { $makeindex = 'texindy %O -o %D %S'; } else { $makeindex = 'makeindex %O -o %D %S'; } $clean_ext .= ' %R.run.xml %R.blg %R.preview.ready'; add_cus_dep('glo', 'gls', 0, 'run_makeglossaries'); add_cus_dep('acn', 'acr', 0, 'run_makeglossaries'); sub run_makeglossaries { my ($base) = @_; my $cmd = "makeglossaries \"$base\""; my $status = system($cmd); if ($status == 0) { system("touch \"$base.preview.ready\""); } return $status; } and modify my file to have: \documentclass{article} \newif\iftsPreview \tsPreviewfalse \ifdefined\directlua \directlua{ if os.getenv("TS_PREVIEW") == "1" then tex.print("\\global\\tsPreviewtrue") end } \fi \iftsPreview \usepackage[active,tightpage]{preview} \setlength\PreviewBorder{0pt} \fi \newenvironment{MaybePreview}{\iftsPreview\begin{preview}\fi}{\iftsPreview\end{preview}\fi} \usepackage[acronym]{glossaries} \makeglossaries \newacronym{NASA}{NASA}{National Aeronautics and Space Administration} \begin{document} \begin{MaybePreview} The National Aeronautics and Space Administration \acrshort{NASA} is responsible for the civilian space program. \printglossary[type=\acronymtype, title=List of Acronyms] \end{MaybePreview} \end{document} Is there a smarter way?
- how to shade an region bounded by curvesby 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.
- resume enumerate from previous environmentby stackoverflow21 on November 22, 2025 at 6:01 pm
I'd like to resume the enumeration from my defined exercise environment. However, the resume option of enumitem obviously only resumes the first level of the enumeration. Therefore, I tried to save and restore enumii, which unfortunately does not work this way. Is there any way to resume with the second level of the previous environment? Here is my MWE: \documentclass{article} \usepackage{enumitem} \newcounter{cntExercise} \newcounter{saveenumii} \newenvironment{Exercise}{ \refstepcounter{cntExercise} \subsubsection*{Exercise Number \thecntExercise} \begin{enumerate}[label={\thecntExercise.\arabic*}] } { \setcounter{saveenumii}{\value{enumii}} \end{enumerate} } \newenvironment{Exerciseresume}{ \setcounter{enumii}{\value{saveenumii}} \begin{enumerate}[resume, label={\thecntExercise.\arabic*}] } { \end{enumerate} } \begin{document} \begin{Exercise} \item problem 1.1 \end{Exercise} \begin{Exercise} \item problem 2.1 \item problem 2.2 \end{Exercise} \noindent some text... \begin{Exerciseresume} \item shoud be problem 2.3 \end{Exerciseresume} \end{document}
- How can I make sure characters 157 and 158 are populated with autoinst?by TobiBS on November 22, 2025 at 5:00 pm
I have some Corporate True Type Fonts and use autoinst to convert them. However even though unicode characters uni0130 and uni0111 are there, after using the converted fonts I get the issue: glyph `Idotaccent' not found and glyph `dcroat' not found So I had a look and thought I need to provide unicoding commands to otftotfm, so I added extra commands to autoinst and the log files confirm that they are used: extra: --no-truetype --unicoding=Idot=:uni0130 --unicoding=dmacron=:uni0111` But no matter if I use Idotaccent or Idot or dmacron or dcroat, pdfLatex gives me the same output. What I don't get in the first place is, why I should provide such a command anyway. The font gives when I call otfinfo -g the glyphs Idotaccent and dcroat and of course contains unicode characters uni0130 as well as uni0111. If I am calling otfinfo -u I even get: uni0111 278 dcroat uni0130 101 Idotaccent What am I missing and what do I need to change? Reacting to cfrs questions: Minimal example \documentclass[]{minimal} \pdfmapfile{+MyOwnSansFont.map} \usepackage{MyOwnSansFont} \usepackage[T1]{fontenc} \begin{document} \sffamily \.Iletişim İletişim Character 157: \char157 I with dot \end{document} The MyOwnSansFont is the auto generated style file from autoinst. This then gets me this error message: pdfTeX warning: pdflatex.exe (file MyOwnSansFont.ttf): glyph Idotaccent' not found` So I want T1 encoding and also told autoinst so, hence also in the style file it is available and from what I understand T1 should have them: % 0x90 /Rcaron /Sacute /Scaron /Scedilla /Tcaron /Tcedilla /Udblacute /Uring /Ydieresis /Zacute /Zcaron /Zdot /IJ /Idot /dmacron /section Further finding Thank you for the questions and reactions so far, I think I came closer to a solution, but it is still strange. So I started to read and then I traced down the encoding file that comes out of otftotfm, copied it to my working directory and manually changed from: %90 /Rcaron /Sacute /Scaron /Scedilla /Tcaron /Tcommaaccent /Uhungarumlaut /Uring /Ydieresis /Zacute /Zcaron /Zdotaccent /IJ /Idotaccent /dcroat /section to %90 /Rcaron /Sacute /Scaron /Scedilla /Tcaron /Tcommaaccent /Uhungarumlaut /Uring /Ydieresis /Zacute /Zcaron /Zdotaccent /IJ /Idot /dmacron /section and everything works as it should. So for whatever reason even though the glyph names are reported to be available by the ttf and are also properly mapped, pdftex can only access them under the other name. What could be the reason for this and how can I fix this in the creation process?
- latexmk failure with --shell-escapeby projetmbc on November 22, 2025 at 3:48 pm
The following TeX file is well managed when invoking latexmk -pdf -pdflatex="lualatex" main.tex, but latexmk fails when used with latexmk -pdf -pdflatex="lualatex --shell-escape" main.tex. First case needs at most 2 compilations Second case implies more than 5 compilations. Why? PS: luadraw is used. See https://github.com/pfradin/luadraw . % !TEX TS-program = lualatex \documentclass{standalone} \usepackage[svgnames]{xcolor} \usepackage[3d]{luadraw} \usepackage{animate} \begin{luacode*} nbimages = 35 name = "shadow" basename = cachedir .. name \end{luacode*} \begin{luadraw}{auto = false, exec = true} require 'luadraw_polyhedrons' local z0 = -3 local graphview = graph3d:new{ window3d = {-5, 8, -5, 8, z0, 5}, adjust2d = true, bbox = false, viewdir = perspective("yz", 0.35, 60), bg = "Beige", size = {10, 10} } local light = M(-5, -5, 3.5) local center = M(-1, -1, -1) local proj = function(A) return proj3dO( A, {z0*vecK, vecK}, A - light ) end local C = cube(center, M(-1, -1, z0)) -- TEMP: bug in version 2.3 local shadow, beam, beamVisible, beamHidden local theta = linspace(0, 360, nbimages + 1) for k = 1, nbimages do C_rotated = rotate3d( C, theta[k], {M(-1, -1, z0), vecK} ) shadow = cvx_hull3d( ftransform3d(C_rotated.vertices, proj) )[1] if not graphview:Isvisible(shadow) then shadow = reverse(shadow) end beam = pyramid(shadow, light, true) beamVisible, beamHidden = graphview:Classifyfacet(beam) graphview:Dfacet( graphview:Plane2facet({z0*vecK, vecK}), { color = "lightgray", contrast = 0 } ) graphview:Dseg3d({M(-5, -5, z0), light}) graphview:Dballdots3d(light, "Yellow", 2) graphview:Dpolyline3d( shadow, true, "draw = none, fill = DarkGray, fill opacity = 0.9" ) graphview:Dfacet( beamHidden, { color = "yellow", opacity = 0.4, mode = mShadedOnly } ) graphview:Dpoly( C_rotated, { color = "cyan", mode = mShadedHidden } ) graphview:Dfacet( beamVisible, { color = "yellow", opacity = 0.4, mode = mShadedOnly } ) graphview:Savetofile(basename .. k .. ".tkz") graphview:Cleargraph() end \end{luadraw} \def\nb{\directlua{tex.print(nbimages)}} \def\name{\directlua{tex.print(basename)}} \begin{document} \begin{animateinline}[ poster = first, controls, loop ]{6} \multiframe{\nb}{ik = 1+1}{% \input{\name\ik.tkz}% }% \end{animateinline} \end{document}
- circuitikz / pgfpicture: modify existing symbol to a new one and rename itby 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}
- How to recreate a DuPont schemeby Dorian on November 22, 2025 at 1:30 pm
I'd like to recreate a DuPont scheme as the image below. I’m not necessarily asking for the exact code used to recreate the graphic, but rather for the packages and commands that would allow me to do it myself. Is there anything more “accessible” than TikZ? Thank you in advance 😉
- What parameter(s) control the vertical spacing of adjacent equations?by keith77777 on November 22, 2025 at 12:58 pm
I cannot find a parameter - other than vspace{} that affects only the vertical spacing of adjacent equations. \documentclass[% openright, % doublepage cleaning ends up right side 11pt, % font size ]{book}% \usepackage[fleqn]{amsmath}% \usepackage{amssymb}% \usepackage{amsthm}% \usepackage[english]{babel}% \usepackage{enumitem}% \usepackage{fancyvrb} \usepackage[paperheight=240mm,paperwidth=175mm,bindingoffset=12.5mm,showcrop]{geometry} \usepackage{setspace} \usepackage{mathtools}% \usepackage{float} \usepackage{parskip} \usepackage{hyperref}% \usepackage{fancyhdr,lastpage,fancyref}% \usepackage{refcount}% \makeatletter \renewcommand{\small}{\@setfontsize\small{10.25}{15}}% \renewcommand{\normalsize}{\@setfontsize\normalsize{10.95}{15}}% 15 \renewcommand{\large}{\@setfontsize\large{11.5}{15}} \makeatother % \setlength{\topsep}{4pt} % above and below the completed lst \setlength{\itemsep}{3.4pt} % item separation \setlength{\parsep}{4.5pt} % paras and items within lists \setlength{\partopsep}{2.8pt}% top and bottom if preceeded by \par \setlength{\parskip}{6pt} \setlength{\abovedisplayskip}{6pt plus 1pt minus 1pt} % equ - using 6.8pt and 4.8pt \setlength{\abovedisplayshortskip}{4pt plus 1pt minus 1pt} % \setlength{\belowdisplayskip}{6pt plus 0pt minus 0pt} % active - using 2pt and 2pt \setlength{\belowdisplayshortskip}{4pt plus 0pt minus 0pt} % \begin{document} \section{The vertical spacing of equations} A first line to demonstrate the effect of the parameter parskip. This line is nicely positioned above equation (1), % \begin{equation} {\hspace{84pt}A\hspace{-0.6pt}=\hspace{-0.6pt}a\hspace{-0.6pt}+(\hspace{1.2pt}i\hspace{-0.6pt}-\hspace{-0.8pt}1\hspace{0.8pt})\hspace{1.4pt}d} \label{eqn:chap_01_conv_div_series_12} \end{equation} % and this line nicely positioned below the equation. But adjacent equations (2) and (3) below are massively spaced. % \begin{equation} \text{\hspace{8pt}this one \hspace{44pt}}2\hspace{1pt}B\hspace{-0.8pt}=\hspace{-0.8pt}2\times A \label{eqn:chap_01_conv_div_series_22} \end{equation} % \begin{equation} \text{\hspace{8pt}and this \hspace{18pt}}C\hspace{-1.0pt}=\hspace{-1.0pt}\dfrac{n}{2}\hspace{1.0pt}\big\{\hspace{1.4pt}2\hspace{1.5pt}a\hspace{-0.4pt}+(\hspace{1.2pt}n\hspace{-0.4pt}-\hspace{-0.4pt}1\hspace{0.8pt})\hspace{1.4pt}d\hspace{1.2pt}\big\} \label{eqn:chap_01_conv_div_series_24} \end{equation} % Another line nicely positioned below - except for the protrusion \\[1.8pt] of the fraction above. % \begin{equation} \hspace{92pt}D\hspace{-1.0pt}=\hspace{-1.0pt}4\times C \label{eqn:chap_01_conv_div_series_24} \end{equation} % A final line showing the desired spacing below the math. \end{document}
- How to configure language with DocumentMetadata and documentclassby user2609605 on November 22, 2025 at 12:11 pm
I started using \DocumentMetadata just to create PDF/A. If I don't specify lang in the metadata, I receive LaTeX DocumentMetadata Warning: The language has not been set in (DocumentMetadata) \DocumentMetadata. (DocumentMetadata) Setting it to 'en' as fallback. which I can avoid specifying lang=en. I a sense, I specify the language also in \documentclass as an option english. I also use babel package and I know this reads the option english. It feels like a duplicate so I would like to remove language specification from the document class. Is the metadata setting really a replacement? What about hyphenation? What about German language? In particular I wonder about the treatment of german vs ngerman. Can this be expressed in \DocumentMetadata??
- latex verapdf dictionary stream contains duplicated key /Groupby user2609605 on November 22, 2025 at 11:56 am
I know, I shall add a minimal working example, and i am willing to do so, but could you give me a first hint? I compile a quite complicated document with lualatex, texlive 2025 After I verify on PDF/A 2b with verapdf. The test passes but... warnings occur: Nov 22, 2025 12:17:49 PM org.verapdf.parser.COSParser getDictionary WARNING: Dictionary/Stream contains duplicated key /Group(object key = 1677 0 obj, offset = 297743) Nov 22, 2025 12:17:49 PM org.verapdf.parser.COSParser getDictionary WARNING: Dictionary/Stream contains duplicated key /Group(object key = 1522 0 obj, offset = 267511) PASS /home/ernst/OpenSource/LatexMavenPluginGit/latex-maven-plugin/maven-latex-plugin/src/site/tex/manualLMP.pdf 2b verapdf return value: 0 Before i strip down, to locate the problem, can anyone give me a hint?
- Integral symbolby 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?
- Key value option for enumerate definitionby azetina on November 22, 2025 at 5:44 am
Consider the following MWE: \documentclass{article} \usepackage{amsmath} \usepackage{xcolor} \usepackage{enumitem} \newlist{enumatlib}{enumerate}{2}% \setlist[enumatlib]{ label=\arabic*, font=\bfseries, align=left, leftmargin=*, labelsep=1em, labelwidth=*, itemsep=2.5ex, before=\setupmodenumerate } \setlist[enumatlib,2]{ label=\Alph*, font=\bfseries, leftmargin=*, itemsep=1ex, before=\setupmodenumerate} \newif\ifmoditem \newif\ifcitem \newcommand{\setupmodenumerate}{% \global\moditemfalse \global\citemfalse \let\origmakelabel\makelabel \def\moditem##1{\global\moditemtrue\def\mesymbol{\footnotesize\normalfont\color{red}\parbox[t]{10em}{\raggedleft##1}}\item}% \def\citem##1{\global\citemtrue\def\cecolor{##1}\item}% \def\makelabel##1{% \origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\else\ifcitem\color{\cecolor}\fi\fi##1}% \global\moditemfalse\global\citemfalse}% } %----------------- usage examples ----------------- \begin{document} Default behaviour (both features on): \begin{enumatlib} \moditem{M4.5 (KSC)} First question \begin{enumatlib} \citem{red} option 1 \item option 2 \item option 3 \item option 4 \end{enumatlib} \moditem{GT8.9 (KSC)} Second question \begin{enumatlib} \item option 1 \citem{red} option 2 \item option 3 \item option 4 \end{enumatlib} \end{enumatlib} \end{document} I would like assistance in creating a key-value that toggles off and on the entries for moditem and citem. See below. \begin{enumatlib}[mod=false,citem=false] \moditem{M4.5 (KSC)} First question \begin{enumatlib} \citem{red} option 1 \item option 2 \item option 3 \item option 4 \end{enumatlib} \moditem{GT8.9 (KSC)} Second question \begin{enumatlib} \item option 1 \citem{red} option 2 \item option 3 \item option 4 \end{enumatlib} \end{enumatlib} By default \citem will always have red as the color but having the option to choose the color is ideal.
- Row colour problem with longtable, multicolumn and makecellby Subhajit Paul on November 22, 2025 at 5:37 am
How do I get the rowcolor spanned for the entire first row? \documentclass{article} \usepackage{longtable, makecell, booktabs} \usepackage[table]{xcolor} \begin{document} \begin{longtable}{m{0.1\linewidth} m{0.88\linewidth}} \toprule\endhead \rowcolor{gray}\multicolumn{2}{c}{\makecell[cc]{Top line\\Bottom line}}\\\bottomrule a & b \end{longtable} \end{document}
- 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.
- saddle point trajectoriesby Jasper on November 22, 2025 at 4:41 am
I am trying to graph the intersecting trajectories for a saddle point of a surface. In particular, there are two curves which intersect this point. One is concave up, and one is concave down. My aim is to graph both trajectories on the surface. The saddle point is at (0,0). \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \pgfmathsetmacro{\startparam}{-pi/12} \pgfmathsetmacro{\stopparam}{pi/12} \pgfmathsetmacro{\samplesparam}{24} \pgfmathsetmacro{\stepparam}{(\stopparam-\startparam)/(\samplesparam-1)} \foreach \param[parse=true] in {\startparam} { \begin{tikzpicture} \useasboundingbox[scale=2] (-2,-2) rectangle (2,2); \setobject[ name = {T} ,object = { matrix_multiply( matrix_multiply( euler(pi/2,pi/3,5.25*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) } ] \appendsurface[ ustart = {-2} ,ustop = {2} ,usamples = {20} ,vstart = {-2} ,vstop = {2} ,vsamples = {20} ,transformation = {T} ,x = {u} ,y = {v} ,z = {u^4 + v^4 - 4*u*v + 1} ,fill options = { preaction = { fill = green ,fill opacity = 0.2 } ,postaction = { draw = blue ,ultra thin ,line join = round } } ,filter = { abs(matrix_multiply(A,I)[1][3])<2.01 and abs(matrix_multiply(B,I)[1][3])<2.01 and abs(matrix_multiply(C,I)[1][3])<2.01 and abs(matrix_multiply(A,I)[1][2])<2.01 and abs(matrix_multiply(B,I)[1][2])<2.01 and abs(matrix_multiply(C,I)[1][2])<2.01 and abs(matrix_multiply(A,I)[1][1])<2.01 and abs(matrix_multiply(B,I)[1][1])<2.01 and abs(matrix_multiply(C,I)[1][1])<2.01 } ] % I can't find these trajectories for the life of me! % \appendcurve[ % ustart = {-2} % ,ustop = {2} % ,usamples = {20} % ,transformation = {T} % ,x = {u*cos(pi/4)} % ,y = {u*sin(pi/4)} % ,z = {(u*cos(pi/4))^4 + (u*sin(pi/4))^4 - 4*(u*cos(pi/4))*(u*sin(pi/4)) + 1} % ,draw options = { % draw = blue % ,ultra thin % ,line join = round % } % ] % \appendcurve[ % ustart = {-2} % ,ustop = {2} % ,usamples = {20} % ,transformation = {T} % ,x = {u*cos(3*pi/4)} % ,y = {u*sin(3*pi/4)} % ,z = {(u*cos(3*pi/4))^4 + (u*sin(3*pi/4))^4 - 4*(u*cos(3*pi/4))*(u*sin(3*pi/4)) + 1} % ,draw options = { % draw = red % ,ultra thin % ,line join = round % } % ] \appendsolid[ ustart = {-2} ,ustop = {2} ,usamples = {2} ,vstart = {-2} ,vstop = {2} ,vsamples = {2} ,wstart = {-2} ,wstop = {2} ,wsamples = {2} ,transformation = {T} ,x = {u} ,y = {v} ,z = {w} ,fill options = { preaction = { fill = none ,fill opacity = 0.5 } ,postaction = { draw = none ,ultra thin ,line join = round ,line cap = round } } ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {0} ,y = {0} ,z = {u} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {0} ,y = {0} ,z = {4.3} ,transformation = {T} ,name = {\(z\)} ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {0} ,y = {u} ,z = {0} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {0} ,y = {4.3} ,z = {0} ,transformation = {T} ,name = {\(y\)} ] \appendcurve[ ustart = {0} ,ustop = {4} ,usamples = {2} ,x = {u} ,y = {0} ,z = {0} ,transformation = {T} ,arrow tip = {true} ,draw options = { draw ,ultra thin ,line cap = round } ] \appendlabel[ x = {4.3} ,y = {0} ,z = {0} ,transformation = {T} ,name = {\(x\)} ] \displaysegments \end{tikzpicture} } \end{document}
- How do I cancel the exponent in an equation?by user424920 on November 21, 2025 at 8:54 pm
I'm trying to achieve something like this I tried \cancelto but it doesn't look good. Is there a library for these kind of "special cancellations"? Thank you all.
- extract data from excell file [closed]by Serge75013 on November 21, 2025 at 8:43 pm
Well, I tried to understand your code or your code and I also consulted the tutorial indicated by cfr, and I admit that I don't understand anything and that it will take me a little time to master this language. Since you tell me that you have to ask the questions one by one, I would like to know how to retrieve the values of a line, for example the one obtained randomly, in nine respective variables varone, vartwo etc that I can then simply exploit in different calculations of the type (varone + vartwo) mod n or any other operation without having to continue in the same language? Because there, I have searched and I am unable to recover these values.
- Typesetting a more aesthetic continued fractionby 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}
- HowTo get standard paragraph indentation inside enumerate environment?by Steven Thomas Hatton on November 21, 2025 at 6:22 pm
In the original document enumerated paragraphs are indented on their labels an continue flush-left on the page. TeX indents everything by default. How can I modify the provided code to produce the format shown in the final screen-scrape? \documentclass[a4paper,10pt]{article} \usepackage{enumitem} \usepackage{amsmath} \begin{document} \begin{enumerate}[label=\arabic*$^{\circ}$),leftmargin=*,topsep=0pt,itemsep=0pt,parsep=0pt] \item Quando l'equazione\verb|~\eqref{eq:4}| è identica, l'equazione\verb|~\eqref{eq:3}| ha un integrale finito con una costante arbitraria, epperò le superfici ortogonali sono in numero infinito ; \item Quando l'equazione\verb|~\eqref{eq:4}| non è identica, ma stabilisce fra $t$, $u$, $v$ una relazione che sodisfa all'equazione differenziale\verb|~\eqref{eq:3}|, questa non possiede che una integrale particolare, che è la stessa equazione\verb|~\eqref{eq:4}|, epperò non esiste che una sola superficie ortogonale ; \item Finalmente, se non si verifica alcuno dei due casi precedenti, non esiste alcuna superficie ortogonale e quindi il problema non ammette soluzione. \end{enumerate} \end{document} Produces: The desired format is:
- Automatically update a field value when the value of another field changes. eforms JavaScriptby Nikulok on November 21, 2025 at 1:44 pm
I have some eForms fields and I want some calculation in there. For example, when entering a number, double its value in another field. The problem is that the fields don't update automatically. To update a value, you have to click on the field you want to update. How can I make the update automatic? \documentclass{book} \usepackage {eforms} \begin{document} \textField[\W1\BC{0 0 0}]{uni}{2cm}{12bp} \textField[\W1\BC{0 0 0}\A{\JS{% let f = this.getField("uni"); let e = this.getField("aaa"); e.value = 2 * f.value; }}]{aaa}{7cm}{12bp} \end{document}
- LaTeX: Matrix in Matrixby 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 argumentsby 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}
- Making sure that the figure is wrapped by the previously-written textby Georgian Ilie on November 21, 2025 at 8:26 am
My doubt deals with the wrapping of text around figures in LaTeX. When I place a wrapped figure at the bottom of a page—like in the case described by the following code: \documentclass[11pt]{article} \usepackage{wrapfig} \usepackage{graphicx} \usepackage{notomath} \usepackage{microtype} \begin{document} \section*{A section} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin dapibus, quam nec tempus feugiat, leo lorem sodales eros, pulvinar blandit nibh mi sit amet mi. Proin eleifend justo id libero rutrum pulvinar. Aenean sed velit dui. Phasellus vitae lacus nisi. Sed mauris metus, sagittis eget faucibus non, varius quis turpis. Nunc vel aliquam sapien. Sed sed mi pretium, dictum urna et, pharetra mi. Aliquam sit amet viverra tortor. Phasellus ullamcorper mi a risus dapibus, ut tincidunt lacus pretium. Praesent erat felis, varius sed metus sed, mollis auctor lectus. Nam nisl dui, semper vel finibus in, laoreet eget urna. Praesent rhoncus, metus at maximus dictum, erat sapien cursus magna, vel pharetra est sapien vitae lacus. Quisque quis nisi hendrerit, dictum turpis ac, dictum sapien. Duis vestibulum ullamcorper turpis non gravida. Vivamus vitae auctor nisl, et accumsan massa. Morbi pulvinar orci metus, sit amet vehicula nisi tincidunt quis. Vestibulum vel felis aliquet, vulputate neque in, fringilla nibh. Maecenas at luctus erat, ac sagittis lacus. Nunc gravida, ex et vulputate congue, felis lectus accumsan nisi, feugiat cursus massa tellus et purus. Fusce quis metus sed quam condimentum rutrum. Nunc consequat egestas eros, posuere aliquet orci ornare vel. Nam et lorem porttitor sem pulvinar vehicula. Morbi ullamcorper nulla posuere lorem gravida, ut placerat libero consequat. Nunc ornare pulvinar viverra. Proin sed bibendum magna, ut posuere magna. Suspendisse consequat elit commodo scelerisque rutrum. Suspendisse finibus porttitor nisl. Sed dolor augue, sollicitudin vitae dignissim ut, faucibus non lacus. Sed dignissim nisi velit, sed posuere arcu eleifend non. Donec vel lobortis purus. Maecenas eu tristique mauris. Duis turpis nisi, lacinia ut ipsum id, tincidunt mollis magna. Aenean non nunc mauris. Praesent non velit varius, aliquet est eu, viverra velit. Fusce aliquet pretium ex eget elementum. Etiam sagittis diam sollicitudin finibus dapibus. Aliquam porta ornare tempor. \section*{Another Section} \begin{wrapfigure}{r}{0.5\textwidth} \centering \includegraphics[width=0.45\textwidth]{example-image-a} \caption{Hello} \end{wrapfigure} Donec massa magna, iaculis faucibus ullamcorper nec, elementum ac neque. Nunc consequat odio et feugiat blandit. Quisque et elementum nisi. Nulla facilisi. Sed aliquet erat placerat, mollis arcu in, pulvinar nisi. Aenean efficitur ex turpis, at scelerisque quam congue ac. Donec pellentesque in sem interdum vestibulum. Fusce magna ex, fermentum id rutrum ac, mollis in dolor. Nulla rhoncus ligula et felis vehicula, quis volutpat tellus feugiat. Vivamus tempor a justo molestie mollis. Ut ornare nulla id nisi fringilla viverra. Vivamus facilisis quam vitae felis commodo, ut fermentum mauris malesuada. Nullam eu ligula sem. Vivamus lobortis felis sed nisl tristique feugiat. Suspendisse facilisis est vitae feugiat molestie. Integer ac dolor luctus, porta nulla quis, condimentum dolor. Morbi vehicula commodo leo, lobortis auctor elit pellentesque a. Aenean tincidunt orci vitae lectus egestas laoreet. Donec a sem quis libero dictum tempus in a mi. Cras id semper ipsum, eu mattis massa. Nunc non eros aliquet neque sollicitudin suscipit vel a lacus. Mauris vulputate dui diam, id tempor nulla feugiat eget. Vivamus faucibus neque urna, vel eleifend neque congue nec. Nullam vel magna at arcu facilisis porta. Curabitur vel tristique elit, sit amet varius neque. Etiam iaculis vel felis sit amet mollis. \end{document} I receive the following result upon compilation: What I would like to do is to slide the figure upwards, so that is stays in the right-bottom corner of page 1. I know that this can be achieved by moving the figure in a previous part of the code, but I would prefer to avoid this solution.
- Arrow Positioning in Tikzby itc on November 21, 2025 at 12:09 am
I am having problems with arrow positioning in my tikz diagram. Please see my MWE: \documentclass[11pt, a4paper]{article} \usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} \usepackage{fontspec} \setmainfont{Noto Sans} \usepackage{amsmath} \usepackage{amssymb} \usepackage{bm} \usepackage{tikz} \usepackage{caption} \usepackage{graphicx} \DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator{\prctile}{prctile} \usetikzlibrary{shapes, arrows.meta, positioning, fit, backgrounds, calc, shadows} \begin{document} \begin{figure}[htbp] \centering \resizebox{0.95\textwidth}{!}{% \begin{tikzpicture}[ node distance=1.5cm and 2cm, >={Latex[width=2mm,length=2mm]}, base/.style = {draw, align=center, minimum height=3em, rounded corners, drop shadow, font=\footnotesize}, input/.style = {base, trapezium, trapezium left angle=70, trapezium right angle=110, fill=blue!10, draw=blue!40!black, minimum width=2.5cm}, process/.style = {base, rectangle, fill=orange!10, draw=orange!40!black, minimum width=3cm}, simblock/.style = {base, rectangle, fill=green!10, draw=green!40!black, minimum width=2.5cm}, decision/.style = {base, diamond, aspect=2, fill=yellow!10, draw=yellow!40!black, inner sep=1pt}, output/.style = {base, ellipse, fill=red!10, draw=red!40!black, minimum width=2.5cm, font=\footnotesize\bfseries}, group/.style = {draw, dashed, inner sep=10pt, rounded corners, fill=gray!5}, line/.style = {draw, ->, thick, color=gray!70} ] \node[input] (inputs_data) {Ggdh Jjdhds: \newline $\mathbf{Z}, \mathbf{X}, \mathbf{B}, \mathbf{M}, \mathbf{Y}, \mathbf{E}, \mathbf{Q}$}; \node[input, right=1cm of inputs_data] (inputs_params) {Dgsgshwwdd: \newline $\mathbf{J}, sx, qw, \zeta$}; \node[process, below=1.5cm of inputs_data] (calc_lambda) {Dsrwrws $\bm{C} = \mathbf{A} \mathbin{/} \mathbf{C}$ \newline where $\mathbf{C} = \text{ffee}(\mathbf{U})$}; \node[process, right=1cm of calc_lambda] (calc_sorted) {Zeehwywye Eodhyeywup \newline $\mathbf{G} \to \mathbf{A_{fhfhr}}$}; \node[process, below=1cm of calc_lambda] (calc_pcdf) {Fswuwyhs Uhwbsgx ASX \newline $\mathbf{A_{rrfh}}$ using $\bm{D}$}; \node[simblock, below left=2cm and 0.5cm of calc_pcdf] (freq_sim) {\textbf{K. Feeeffd} \newline Jsggwywhs $\mathbf{O_{wsdfq}}$ \newline $\mathbf{K} = \operatorname{argmin}\lVert \mathbf{W_{OOO}} - \mathbf{F_{ttthq}}\rVert$}; \node[simblock, right=1.5cm of freq_sim] (sev_sim) {\textbf{j. Swwywywy} \newline Yhhdhdhdd $\mathbf{R_{ddddd}}$ \newline Lirurur $\mathbf{M} \to \mathbf{X_{ssssss}}$ \newline Oqqtqtq: $\mathbf{P}$ ($n \times j$)}; \node[simblock, below=1cm of freq_sim] (calc_gul) {\textbf{C. Xcbc HJH} \newline $\mathbf{M} = \text{gghhg}(\mathbf{L})$ \newline $\mathbf{R} = \mathbf{A} \cdot\ast \mathbf{B}$}; \node[simblock, below=1cm of calc_gul] (analysis) {\textbf{D. Adjfjfjfde} \newline KKK Fcc \& Capital \newline ($\prctile(\mathbf{Z}, f)$)}; \node[process, right=2cm of sev_sim, text width=3.5cm] (spatial) {\textbf{Trixx XI: Jpoaigk (a-OU)} \newline Hshhs shuw $\mathbf{Y}$ to Judu $\mathbf{M}$ \newline Aqqtwt $\mathbf{P_6}, \mathbf{Q_9}$}; \node[output, below=1.5cm of analysis] (out_gul) {Zvxhswuus gsgsgw \newline ($\mathbf{S}$)}; \node[output, below=1.5cm of spatial] (out_maps) {Jmetial Lagz \newline}; \draw[line] (inputs_params) -- (calc_lambda); \draw[line] (inputs_data) -- (calc_lambda); \draw[line] (inputs_data) -- (calc_sorted); %EDITS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{scope}[on background layer] \draw[-latex, line] (inputs_data) -| (spatial); \end{scope} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \draw[line] (calc_lambda) -- (calc_pcdf); \draw[line] (calc_pcdf) -- (freq_sim); \draw[line] (calc_sorted) -- (sev_sim); \draw[line] (freq_sim) -- (calc_gul); \draw[line] (sev_sim) |- (calc_gul); % T goes to calc R \draw[line] (calc_gul) -- (analysis); % Sim to Spatial \draw[line] (sev_sim) -- (spatial) node[midway, above] {$\mathbf{W}$}; % Sim to Output \draw[line] (analysis) -- (out_gul); % Spatial to Output \draw[line] (spatial) -- (out_maps); \begin{scope}[on background layer] \node[group, fit=(calc_lambda) (calc_sorted) (calc_pcdf), label=above:\textbf{Mnttigwiqagijj \& Grr-Huui}] {}; \node[group, fit=(freq_sim) (sev_sim) (calc_gul) (analysis), fill=green!5, label=above:\textbf{Mosne Zarlo Suup ($n$ ifiririririri)}] {}; \node[group, fit=(spatial), fill=orange!5, label=above:\textbf{Spatmmm Jfhfhfhfhf}] {}; \end{scope} \end{tikzpicture} } \caption{fhhhhhhhhhhhhhhhhhhhhff} \label{fig:ffhfjfjfjfjff} \end{figure} \end{document} The two problems are: Each time I try to adjust the positioning of my arrows, they end up crossing each other. Another arrow is passing through the purple shape, which is something I do not like. The arrow must be split. I have attached the output for reference. Edit Problem number 1 can be ignored. On problem 2, I have replaced the line \draw[line] (inputs_data) -| (spatial); with \begin{scope}[on background layer] \draw[-latex, line] (inputs_data) -| (spatial); \end{scope}. The remaining issue is as follows: The line will split as desired. However, the line will move from the right parallelogram to the outer dotted rectangle but the tip of the arrow (>) disappears. The arrow (->) should touch the inner solid rectangle. See the updated output.
- xelatex data from Excellby Serge75013 on November 20, 2025 at 11:56 pm
Hello I made a test file in xelatex to extract numbers from an excell file, but despite two days of effort I couldn't fix the bugs. Bug: For several orders, the last value of the extracted rows only shows the number of tens. Several other bugs must come from this first bug... I specify that I would actually like to work on a file of more than 500 lines and that the nine lines of data in my file were only for a test. I also want a command that looks for the lines where the X and Y values are simultaneously and that convert them to an usable integer. I thank in advance all those who would like to look into these problems Xelatex file : \documentclass{article} \usepackage{pgffor} \usepackage{fontspec} \usepackage{xstring} % Built-in test data (9x9) \def\mydata{ {1,2,3,4,5,6,7,8,9}, {10,11,12,13,14,15,16,17,18}, {19,20,21,22,23,24,25,26,27}, {28,29,30,31,32,33,34,35,36}, {37,38,39,40,41,42,43,44,45}, {46,47,48,49,50,51,52,53,54}, {55,56,57,58,59,60,61,62,63}, {64,65,66,67,68,69,70,71,72}, {73,74,75,76,77,78,79,80,81} } \newcounter{totalrows} \newcounter{currentindex} \newcounter{foundindex} \newcounter{startline} \newcounter{numlines} % Initialize variables \newcommand{\varone}{} \newcommand{\vartwo}{} \newcommand{\varthree}{} \newcommand{\varfour}{} \newcommand{\varfive}{} \newcommand{\varsix}{} \newcommand{\varseven}{} \newcommand{\vareight}{} \newcommand{\varnine}{} % Command to convert to number \newcommand{\ConvNb}[1]{\number\numexpr#1\relax} % Show lines from i to i+n \newcommand{\showlines}[2]{% \setcounter{startline}{#1}% \setcounter{numlines}{#2}% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \stepcounter{currentindex}% \ifnum\value{currentindex}<\value{startline}\else \ifnum\value{currentindex}>\numexpr\value{startline}+\value{numlines}-1\relax \breakforeach \else \noindent Ligne \thecurrentindex: \expandafter\processlinedata\line\par \fi \fi }% } \def\processlinedata#1,#2,#3,#4,#5,#6,#7,#8,#9{% \ConvNb{#1} \ConvNb{#2} \ConvNb{#3} \ConvNb{#4} \ConvNb{#5} \ConvNb{#6} \ConvNb{#7} \ConvNb{#8} \ConvNb{#9}% } % Find line with x \newcommand{\findlinewithx}[1]{% \setcounter{foundindex}{0}% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \stepcounter{currentindex}% \foreach \val in \line {% \ifnum\val=#1\relax% \setcounter{foundindex}{\thecurrentindex}% \expandafter\storevariables\line% \breakforeach% \fi% }% \ifnum\value{foundindex}>0\breakforeach\fi% }% \ifnum\value{foundindex}>0% Line \thefoundindex\ found with #1% \else% No lines found with #1% \fi% } %% % Displays all rows containing the number x but BUG if x not found or if all rows \newcommand{\findallwithx}[1]{% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \stepcounter{currentindex}% \foreach \val in \line {% \ifnum\val=#1\relax% \noindent Ligne \thecurrentindex\ contient #1: \expandafter\processlinedata\line\par% \breakforeach% \fi% }% }% } %% % Random Line Extract \newcommand{\randomline}{% \pgfmathsetmacro{\r}{int(random(0,8))}% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \ifnum\value{currentindex}=\r% \expandafter\storevariables\line% Random line \the\numexpr\r+1\relax% \breakforeach% \fi% \stepcounter{currentindex}% }% } %%%%%%%%%%%%%% % Find a random line containing x AND y \newcommand{\findrandomwithxy}[2]{% \def\xfound{0}% \def\yfound{0}% \pgfmathsetmacro{\r}{int(random(0,8))}% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \stepcounter{currentindex}% \ifnum\value{currentindex}=\r% \foreach \val in \line {% \ifnum\val=#1\relax\def\xfound{1}\fi% \ifnum\val=#2\relax\def\yfound{1}\fi% }% \ifnum\xfound=1\relax% \ifnum\yfound=1\relax% \expandafter\storevariables\line% Random line \the\numexpr\r+1\relax\ containing #1 AND #2: \expandafter\processlinedata\line\par% \breakforeach% \else% % Relaunch the search if not y \findrandomwithxy{#1}{#2}% \fi% \else% % Relaunch the search if not x \findrandomwithxy{#1}{#2}% \fi% \fi% }% } %%%%% % 1. Count the total number of rows containing x \newcounter{xcount} \newcommand{\countlineswithx}[1]{% \setcounter{xcount}{0}% \setcounter{currentindex}{0}% \foreach \line in \mydata {% \stepcounter{currentindex}% \edef\temp{\line}% \expandafter\checkforxcount\temp\relax{#1}% }% \noindent Total number of rows containing #1: \thexcount\par } %%%% % Command to store variables \def\storevariables#1,#2,#3,#4,#5,#6,#7,#8,#9{% \gdef\varone{#1}% \gdef\vartwo{#2}% \gdef\varthree{#3}% \gdef\varfour{#4}% \gdef\varfive{#5}% \gdef\varsix{#6}% \gdef\varseven{#7}% \gdef\vareight{#8}% \gdef\varnine{#9}% } % Control with number conversion \newcommand{\cmdbidon}[9]{% \textbf{\ConvNb{#1}} \textbf{\ConvNb{#2}} \textbf{\ConvNb{#3}} \textbf{\ConvNb{#4}} \textbf{\ConvNb{#5}} \textbf{\ConvNb{#6}} \textbf{\ConvNb{#7}} \textbf{\ConvNb{#8}} \textbf{\ConvNb{#9}}% } % Command to simulate encryption operations \newcommand{\cryptoperation}{% \def\a{\ConvNb{\varone}}% \def\b{\ConvNb{\vartwo}}% \def\c{\ConvNb{\varthree}}% \def\d{\ConvNb{\varfour}}% \def\e{\ConvNb{\varfive}}% \def\f{\ConvNb{\varsix}}% \def\g{\ConvNb{\varseven}}% \def\h{\ConvNb{\vareight}}% \def\i{\ConvNb{\varnine}}% % % Example of an encryption operation Résult: $\a + \b + \c + \d + \e + \f + \g + \h + \i = \number\numexpr\a+\b+\c+\d+\e+\f+\g+\h+\i\relax$% } \begin{document} \section*{Displaying Lines 1 to 9} \showlines{1}{9} \section*{Line with specific number} \findlinewithx{5} % Triggers bug for NB not found or if adding a line \noindent Variables: \cmdbidon{\varone}{\vartwo}{\varthree}{\varfour}{\varfive}{\varsix}{\varseven}{\vareight}{\varnine} \section*{Ligne aléatoire}%bug: for the last value only displays the number of tens \randomline \noindent Variables: \cmdbidon{\varone}{\vartwo}{\varthree}{\varfour}{\varfive}{\varsix}{\varseven}{\vareight}{\varnine} \section*{Encryption operation} \cryptoperation \section*{Number conversion test} Variable \texttt{\string\varone}: \varone → Conversion: Displaying Varone + Vartwo operation: $\ConvNb{\varone}+\ConvNb{\vartwo}$ varone + vartwo: avec number numexpr $\ConvNb{\number\numexpr\varone}+\ConvNb{\number\numexpr\vartwo}$ \def\mm{$\ConvNb{\number\numexpr\varsix}*\ConvNb{\vartwo}$} \mm \section*{All rows containing 5} \findallwithx{5} %BUG but still displays the result but for the last value only displays the number of tens \cryptoperation \texttt{\varfour} \section*{Random line with 42 AND 45} \findrandomwithxy{42}{45}% affichage rien \section*{Robust random line with 42 AND 45} \findrandomwithxyrobust{42}{45} % BUG \end{document}