• Is there a way to write a Lua function to be compatible with both LaTeX and ConTeXt key interfaces?
    by Jasper on December 5, 2025 at 8:33 am

    I have a lua function which does a specific task. The task is the same for both LaTeX and ConTeXt. Of course, to output, I need a specialized command for both formats. I would like to write these functions all in one file, so I only have one file to update. How can I properly interface these files, so that they don't interfere with each other, but can be run from exactly one Lua file? Is there a way to write the function to be compatible with both key interfaces? LaTeX setup \documentclass[tikz,border=1cm]{standalone} \usepackage{latex-keys} \begin{document} \begin{tikzpicture} \appendcurve[ ustart = {0} ,ustop = {1} ,usamples = {20} ,x = {u} ,y = {u^2} ,draw options = {draw} ] \displaysegments \end{tikzpicture} \end{document} % latex-keys.sty \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesExplPackage{latex-keys}{2025/12/05}{v1.0.0}{% Minimal LuaLaTeX package for 2D parametric curves in TikZ. } \RequirePackage{tikz} \tikzset{ /lua-tikztdtools/.is~family ,/lua-tikztdtools/.cd ,/lua-tikztdtools/parametric/.cd ,/lua-tikztdtools/parametric/curve/.cd ,ustart/.estore~in = \luatikztdtools@p@c@ustart ,ustop/.estore~in = \luatikztdtools@p@c@ustop ,usamples/.estore~in = \luatikztdtools@p@c@usamples ,x/.code = {\protected@edef\luatikztdtools@p@c@x{#1}} ,y/.code = {\protected@edef\luatikztdtools@p@c@y{#1}} ,draw~options/.estore~in = \luatikztdtools@p@c@drawoptions ,ustart = {0} ,ustop = {6.28318} ,usamples = {100} ,x = {cos(u)} ,y = {sin(u)} ,draw~options = {thick,red} } \lua_load_module:n { lua-backend } \NewDocumentCommand { \appendcurve } {o} { \group_begin: \tikzset{ /lua-tikztdtools/parametric/curve/.search~also = {/tikz} ,/lua-tikztdtools/parametric/curve/.cd ,#1 } \__lua_tikztdtools_appendcurve: \group_end: } \NewDocumentCommand { \displaysegments } {} { \group_begin: \__lua_tikztdtools_displaysegments: \group_end: } -- Minimal 2D Curve Generator (MWE) local segments = {} -- Evaluate a string as a Lua expression in a math environment local function single_string_expression(str) local func = load("return " .. str, "expression", "t", math)() return func end local function single_string_function(str) return load("return function(u) return " .. str .. " end", "expression", "t", math)() end -- Register a TeX command to call a Lua function local function register_tex_cmd(name, func, args) name = "__lua_tikztdtools_" .. name .. ":" .. ("n"):rep(#args) local scanners = {} for _, arg in ipairs(args) do scanners[#scanners+1] = token['scan_' .. arg] end local scanning_func = function() local values = {} for _, scanner in ipairs(scanners) do values[#values+1] = scanner() end func(table.unpack(values)) end local index = luatexbase.new_luafunction(name) lua.get_functions_table()[index] = scanning_func token.set_lua(name, index) end -- 2D parametric curve generator local function append_curve(hash) local ustart = single_string_expression(hash.ustart) local ustop = single_string_expression(hash.ustop) local usamples = single_string_expression(hash.usamples) local x = single_string_function(hash.x) local y = single_string_function(hash.y) local drawoptions = hash.drawoptions local ustep = (ustop - ustart) / (usamples - 1) for i = 0, usamples - 2 do local u = ustart + i * ustep local A = { x(u), y(u) } local B = { x(u + ustep), y(u + ustep) } table.insert(segments, { segment = {A, B}, drawoptions = drawoptions, type = "line segment" }) end end register_tex_cmd( "appendcurve", function() append_curve{ ustart = token.get_macro("luatikztdtools@p@c@ustart"), ustop = token.get_macro("luatikztdtools@p@c@ustop"), usamples = token.get_macro("luatikztdtools@p@c@usamples"), x = token.get_macro("luatikztdtools@p@c@x"), y = token.get_macro("luatikztdtools@p@c@y"), drawoptions = token.get_macro("luatikztdtools@p@c@drawoptions"), } end, { } ) -- Display all segments as TikZ paths local function display_segments() for _, segment in ipairs(segments) do if segment.type == "line segment" then local S, E = segment.segment[1], segment.segment[2] tex.sprint(string.format( "\\path[%s] (%f,%f) -- (%f,%f);", segment.drawoptions or "", S[1], S[2], E[1], E[2] )) end end segments = {} end register_tex_cmd("displaysegments", function() display_segments() end, { }) ConTeXt setup \ctxloadluafile{lua-backend-context.lua} \processMPfigurefile{context-keys.mp} \starttext \startMPpage append_curve [ ustart = "0", ustop = "6.28318", usamples = "100", fx = "cos(u)", fy = "sin(u)", specifications = "withcolor red" ] ; display_segments ; \stopMPpage \stoptext presetparameters "jasper_append_curve" [ ustart = "0", ustop = "6.28318", usamples = "100", fx = "cos(u)", fy = "sin(u)", specifications = "withcolor red" ] ; def append_curve = applyparameters "jasper_append_curve" "jasper_do_append_curve" enddef ; vardef jasper_do_append_curve = pushparameters "jasper_append_curve" ; lua.mp.jasper_append_curve_generate() ; popparameters ; enddef ; presetparameters "jasper_display_segments" [ ] ; def display_segments = applyparameters "jasper_display_segments" "jasper_do_display_segments" enddef ; vardef jasper_do_display_segments = pushparameters "jasper_display_segments" ; lua.mp.jasper_display_segments_generate() ; popparameters ; enddef ; -- lua-backend-context.lua -- MWE: Only 2D parametric curves as line segments local segments = {} -- Math environment for user expressions local backend_math = {} for k, v in pairs(_G) do backend_math[k] = v end for k, v in pairs(math) do backend_math[k] = v end -- Parameter extraction helpers local function MG(key) return metapost.getparameterset(key) end local function sse(key) local str = metapost.getparameterset(key) local chunk, err = load("return " .. str, "expr", "t", backend_math) if not chunk then error("Failed to parse expression: " .. tostring(str) .. "\nError: " .. tostring(err)) end local ok, result = pcall(chunk) if not ok then error("Error evaluating expression: " .. tostring(result)) end return result end local function ssf(key) local expr = metapost.getparameterset(key) local func = load("return function(u) return " .. expr .. " end", "func", "t", backend_math) if not func then error("Failed to parse function: " .. expr) end local ok, result = pcall(func) if not ok then error("Error evaluating function: " .. tostring(result)) end return result end -- Only 2D parametric curves as line segments function mp.jasper_append_curve_generate() local ustart = sse("ustart") local ustop = sse("ustop") local usamples = sse("usamples") local x = ssf("fx") local y = ssf("fy") local drawoptions = MG("specifications") local ustep = (ustop - ustart) / (usamples - 1) for i = 0, usamples - 2 do local u = ustart + i * ustep local A = { x(u), y(u) } local B = { x(u + ustep), y(u + ustep) } table.insert(segments, { segment = { A, B }, drawoptions = drawoptions, }) end end function mp.jasper_display_segments_generate() for _, segment in ipairs(segments) do local S, E = segment.segment[1], segment.segment[2] mp.print(string.format( [[path jasper_tmp ; jasper_tmp := (%f,%f) -- (%f,%f) ; draw jasper_tmp scaled 1cm %s ;]], S[1], S[2], E[1], E[2], segment.drawoptions or "" )) end segments = {} end

  • Tagging Math in Tabular Environment
    by John W on December 5, 2025 at 3:47 am

    hope you are well. Currently I am attempting to write mathematics in tabular format with tagging on. Here is a sample: along with its code: \DocumentMetadata{ lang = en-US, pdfstandard = ua-2, pdfstandard = a-4f, tagging=on, } \documentclass[12pt]{article} \UseName{sys_if_engine_opentype:TF} {\usepackage{unicode-math}} {\usepackage{amsmath}} \begin{document} \tagpdfsetup{table/header-rows={1}} \begin{tabular}{|c|c|}\hline \textbf{Guidelines} & \textbf{Example}\\\hline Assume $A$. & Assume $n$, $m$, and $\ell$ are three consecutive integers.\\\hline \end{tabular} \end{document} On NVDA+MathCat the table reads as the following with cues for header labels and row/column numbers removed. Guidelines Example Assume ... Assume .., .., and .. are three consecutive integers. Does the tagging project not yet support tagging in-line mathematics in tabular-like environments, or am I missing something? Thanks in advance.

  • Problem with tagging non-floating lstlisting
    by user2609605 on December 4, 2025 at 11:07 pm

    This is related with another question about tagging floating lstlisting environment. The example file is the following: \DocumentMetadata{lang=en-US,tagging=on} \documentclass{article} \usepackage{unicode-math} \usepackage{listings} \title{listings always problems} \author{E. Lister} \date{\today} \begin{document} \maketitle some text \begin{lstlisting}[language=tex, basicstyle=\small] \RequirePackage[l2tabu, orthodox]{nag} % optional \documentclass{...} \begin{document} ... \end{document} \end{lstlisting} \end{document} The result is as follows: Package tagpdf Warning: Parent-Child 'pdf:StructTreeRoot' --> 'pdf2:Part'. (tagpdf) Relation is not allowed! on line 27 (tagpdf) struct 1, StructTreeRoot --> struct 24, text-unit Package tagpdf Warning: Parent-Child 'pdf:StructTreeRoot' --> 'pdf2:P'. (tagpdf) Relation is not allowed! on line 27 (tagpdf) struct 24, text-unit --> struct 25, text Package tagpdf Warning: Parent-Child 'pdf:StructTreeRoot' --> 'pdf2:P'. (tagpdf) Relation is not allowed! on line 27 (tagpdf) struct 24, text-unit --> struct 26, text Package tagpdf Warning: Parent-Child 'pdf:StructTreeRoot' --> 'pdf2:Part'. (tagpdf) Relation is not allowed! on line 27 (tagpdf) struct 1, StructTreeRoot --> struct 28, text-unit Package tagpdf Warning: Parent-Child 'pdf:StructTreeRoot' --> 'pdf2:P'. (tagpdf) Relation is not allowed! on line 27 (tagpdf) struct 28, text-unit --> struct 29, text [2]<<latex-list-css.html>><<latex-align-css.html>> (./test2.aux) ! Package tagpdf Error: The number of automatic begin (10) and end (11) (tagpdf) text-unit para hooks differ! For immediate help type H <return>. ... l.27 \end{document} ? so does not even compile any more.. What happened?? Note that Understanding and avoiding tagpdf warning caused by floating lstlisting environment is a solution if lstlisting is floating. The solution is to insert after loading listings \usepackage{unicode-math} \usepackage{listings} \ExplSyntaxOn % Internal variable, temporary work-around! \prop_gput:Nnn\g__tag_float_sect_prop{lstlisting-struct}{\tag_get:n{current_Sect}} \ExplSyntaxOff Then the result is better but not good at all: al/texlive/2025/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]<<latex-list-css. html>><<latex-align-css.html>> (./test2.aux) ! Package tagpdf Error: The number of automatic begin (8) and end (9) (tagpdf) text-unit para hooks differ! For immediate help type H <return>. ... l.33 \end{document} I would also like to know the meaning of the errors.

  • Tagging seems to have wrong text
    by user2609605 on December 4, 2025 at 10:42 pm

    Short document: \DocumentMetadata{lang=en-US,tagging=on,pdfversion=2.0,pdfstandard={a-4f,UA-2}} \documentclass[a4paper]{article} \usepackage{graphicx} \usepackage{color} \usepackage{unicode-math} \NewTaggingSocket{extFigAlt}{2} \NewTaggingSocketPlug{extFigAlt}{default} {% \par \tagstructbegin{tag=Figure,alt={#1}}% \tagmcbegin{}% \SuspendTagging{}% #2% \par \ResumeTagging{}% \tagmcend \tagstructend } \AssignTaggingSocketPlug{extFigAlt}{default} \title{On Tagging created pictures} \author{E. dos Santos} \date{\today} \begin{document} \maketitle \section{Introduction} Some text. \UseTaggingSocket{extFigAlt}% {Transformation of pics from fig format to TEX picture including a PDF.}% {\input{thePic}} \UseTaggingSocket{extFigAlt}% {Transformation of pics from gnuplot format to TEX picture including a PDF.}% {\input{F4_02gp2pdf.ptx}} {\setkeys{Gin}{alt={foo bar}}\input{thePic}} \end{document} compiles with lualatex without a warning. Verification with verapdf shows all standards claimed are reached. Also pdfinfo shows that the PDF created is tagged (clear for UA-2). BUT: pdfinfo -struct-text test.pdf unveils: Document <ID.002> Part <ID.005> P <ID.006> (block) P <ID.007> (block): /TextAlign /Center "On Tagging created pictures" P <ID.008> (block): /TextAlign /Center " E. Reißner" P <ID.009> (block): /TextAlign /Center "December 4, 2025" Sect <ID.010> H1 <ID.011> "��" (block) Span <ID.012> (inline) "1 " "Introduction" Part <ID.013> P <ID.014> (block): /TextAlign /Justify "Some text." Figure <ID.015> "postscriptxxx.figxxx.pdfxxx.ptxxxx.epsfig2dev -L pdftex_tfig2dev -L pstex_tfig2dev -L pdftexfig2dev -L pstex\includegraphics{xxx}\includegraphics{xxx}" Figure <ID.016> "xxx.gpxxx.pdfxxx.ptxxxx.epsgnuplot pdfgnuplot eps\includegraphics{xxx}\includegraphics{xxx}" Part <ID.017> P <ID.018> (block): /TextAlign /Justify Figure <ID.019>: /BBox [139.746 564.995 139.746 564.995] "postscript" Figure <ID.020>: /BBox [139.746 564.995 407.228 716.092] "xxx.figxxx.pdfxxx.ptxxxx.epsfig2dev -L pdftex_tfig2dev -L pstex_tfig2dev -L pdftexfig2dev -L pstex\includegraphics{xxx}\includegraphics{xxx}" Whereas I recognize the headline, the tagging of the figures seems heavily wrong. I would expect the alt text to occur somewhere. Instead some random labels from the figures, essentially picture environment seems to be in place. Note that the figures are created by fig2dev and so there is not alt text. If I modify inserting alt by hand, \begin{picture}[alt=some pdf](0,0) \includegraphics{thePic}% \end{picture}% % % Conversion of xxx.fig into xxx.ptx, xxx.pdf and xxx.eps % \setlength{\unitlength}{2072sp}% \begin{picture}[alt=some picture env](8492,4797)(1114,-4621) ... then pdfinfo returns something different, but alt text does not appear either. Maybe my expectations are wrong???

  • Vertical alignment of equations inside tabularx
    by Andi Bauer on December 4, 2025 at 8:34 pm

    I'm trying to put multiple numbered equations into one line to save space. One way to do this is to put the equations inside a tabularx table. However, when I try to put an equation environment inside a tabularx the vertical alignment is off: \documentclass{article} \usepackage{tabularx,amsmath} \begin{document} \begin{equation*} \begin{tabularx}{\textwidth}{m{0.4\textwidth}m{0.4\textwidth}} \begin{equation} \begin{pmatrix}1\\2\\3\end{pmatrix} \end{equation} & \begin{equation} x \end{equation} \end{tabularx} \end{equation*} \end{document} produces As you can see, the vertical alignment between the two labels (1) and (2) is slightly off. I've not been able to figure out what latex aligns in this case, it seems erratic to me. Changing the column type from m to p or b didn't fix the problem.

  • TikZ word search diagram v2
    by yannis on December 4, 2025 at 7:16 pm

    As a continuation of TikZ word search diagram here is the problem I'm facing. I did what Explorer suggested and it worked fine except that my rounded rectangles look like sausages or like Hieroglyphic cartouches because at their narrow ends they have lines on the secondary axis: Here is the code: \documentclass{article} \usepackage[cmyk]{xcolor} \definecolor{myPB}{cmyk}{0.85,0.75,0,0} \definecolor{myLB}{cmyk}{0.1,0.06,0,0} \usepackage{tikz} \usetikzlibrary{matrix,backgrounds} \newlength{\mydrawlinewidth} \setlength{\mydrawlinewidth}{1pt} \NewDocumentCommand{\markA}{ O{red} m m }{% \draw[rounded corners=6mm,opacity=.5, line width=2pt,myPB,fill=myLB] ([xshift=5pt,yshift=-5pt]yannis-#2.north west) rectangle ([xshift=-5pt,yshift=5pt]yannis-#3.south east); } \NewDocumentCommand{\markB}{ O{red} m m }{% \draw[rounded corners=6mm,opacity=.5,line width=2pt,myPB,fill=myLB] ([yshift=2pt]yannis-#2.north) -- ([xshift=2pt]yannis-#3.east) -- ([yshift=-2pt]yannis-#3.south) -- ([xshift=-2pt]yannis-#2.west) -- cycle; } \NewDocumentCommand{\markC}{ O{red} m m }{% \draw[rounded corners=6mm,opacity=.5,line width=2pt,myPB,fill=myLB] ([xshift=2pt]yannis-#2.east) -- ([yshift=-2pt]yannis-#3.south) -- ([xshift=-2pt]yannis-#3.west) -- ([yshift=2pt]yannis-#2.north) -- cycle; } \begin{document} \begin{tikzpicture} \matrix (yannis) [% matrix of nodes,% column sep=0mm,% row sep=0mm, nodes={ % draw, rectangle,anchor=center, line width=0.5pt, inner sep=2pt,outer sep=0pt, %font=\bfseries\huge, minimum size=1.1cm, } ] { S & G & A & Q & Q & T & C & E & F & R & E & P & Y & W & R \\ W & L & Q & E & L & B & A & R & A & P & M & O & C & E & L \\ Y & I & T & S & X & E & L & I & Y & A & H & U & W & R & A \\ B & K & E & E & Y & C & W & L & J & T & M & A & K & B & F \\ J & E & R & I & O & R & T & M & K & E & R & L & Q & E & T \\ P & N & P & L & S & B & R & W & H & D & U & U & E & H & E \\ E & E & R & R & E & W & V & S & S & M & L & N & K & E & R \\ H & S & E & E & H & T & A & P & H & Y & S & I & C & A & L \\ S & S & T & D & S & H & E & U & Q & V & L & V & R & Z & I \\ O & R & N & N & I & F & L & L & A & S & N & E & E & K & F \\ M & T & I & U & N & L & G & E & P & H & U & R & A & S & E \\ W & K & O & Q & U & P & U & H & A & M & G & S & T & M & I \\ A & F & A & R & P & J & M & S & L & R & O & E & E & H & C \\ B & X & H & C & A & I & H & S & A & M & S & C & D & F & G \\ I & P & R & O & P & H & E & T & S & N & S & I & F & X & Q \\ }; \begin{scope}[on background layer] \markA{1-6}{1-12} \markA{1-14}{6-14} \markC{1-15}{7-9} \markA{2-2}{9-2} \markA{2-4}{2-13} \markA{3-3}{11-3} \markA{3-4}{11-4} \markA{3-6}{3-12} \markA{3-15}{11-15} \markC{4-11}{9-6} \markA{6-5}{13-5} \markA{6-12}{13-12} \markA{7-1}{11-1} \markB{7-5}{14-12} \markA{8-8}{8-15} \markA{8-13}{14-13} \markB{10-7}{15-12} \markB{11-2}{15-6} \markA{14-3}{14-10} \markA{15-2}{15-9} \end{scope} \end{tikzpicture} \end{document} How can I fix this? @mickep I replaced the snippets by a complete minimal example.

  • In `zref-clever` global options ovverride local ones
    by Máté Wierdl on December 4, 2025 at 4:43 pm

    Some global options to zref-clever override a local one. This seems to contradict the documentation which says "zcsetup has local effects, so it can be issued inside the respective environments for the purpose." Here is an example for the options cap and abbrev \documentclass{article} \usepackage{zref-clever} \zcsetup{nocap,noabbrev,reftype=lemma} % \AddToHook{env/theorem/begin} % {\zcsetup{cap,abbrev,reftype=equation}} \newtheorem{theorem}{Theorem} \begin{document} \begin{theorem} \zcsetup{cap,abbrev,reftype=equation} \label{thm:1} We have $a=b$ \end{theorem} Setting \verb!cap! and \verb!abbrev! as direct options to \verb!\zcref! works: \zcref[cap,abbrev]{thm:1}, but otherwise it has no effect: \zcref{thm:1}. On the other hand, \verb!reftype! does work locally. \end{document} I remark that what I originally wanted to do was setting cap=true globally but nocap,abbrev for all equation and similar environments. I still don't know how to do that. If I set nocap,abbrev globally then figure is also affected.

  • Using acronyms in longtable causes a warning
    by jonnybolton16 on December 4, 2025 at 4:36 pm

    When using acronym commands inside a longtable alongside cleveref , I get the warning Label(s) may have changed. Rerun to get cross-references right., however clearing the cache / rerunning the compile doesn't fix it. It appears the problem is caused by a repeated use of the acronym inside the table, when it hasn't been used before the table but is subsequently used after it. Is there any way to fix this? \documentclass{article} \usepackage[parfill]{parskip} \usepackage{acronym} \usepackage{hyperref,cleveref} \usepackage{longtable} \usepackage{booktabs} \makeatletter \newcommand*{\org@overidelabel}{} \let\org@overridelabel\AC@verridelabel \renewcommand*{\AC@verridelabel}[1]{% \@bsphack \protected@write\@auxout{}{\string\AC@undonewlabel{#1@cref}}% \org@overridelabel{#1}% \@esphack }% \makeatother \begin{document} \section*{List of Abbreviations} \begin{acronym} \acro{ABC}{Australian Broadcasting Corporation} \acro{BBC}{British Broadcasting Corporation} \acro{CBC}{Canadian Broadcasting Corporation} \end{acronym} \section{Latex warning} The presence of acronyms in \Cref{tab:mylabel} causes Latex to produce the following warning: \textit{Label(s) may have changed. Rerun to get cross-references right.} Clearing the cache and rerunning has no effect. % In the table below, there is a repeated use of the \ac{BBC} acronym, % but there is only one use of the \ac{ABC} acronym; with both % acronyms in use here. There are also two uses of the CBC acronym in % the table, but that hasn't been used here. The problem is the % combination of the use of \ac{BBC} outside of the table, together % with two uses of it inside the table. Because \ac{ABC} is only used % once in the table, there is no warning. Similarly, because CBC is % not used outside the table, there is no warning. However, note that % because this paragraph comes before the table, the use of \ac{BBC} % before the table removes the warning. Commenting out this paragraph % causes the warning to appear. \begin{longtable}{ll} \caption{My caption.} \label{tab:mylabel}\\ Acronym & Meaning\\ \midrule \endfirsthead \multicolumn{2}{@{}l}{\small{Table \thetable{} (continued)}}\\ Acronym & Meaning\\ \midrule \endhead \multicolumn{2}{r@{}}{\footnotesize{(continued on next page)}}\\ \endfoot \endlastfoot \acs{ABC} & Australian Broadcasting Corporation\\ \acs{BBC} & \acl{BBC}\\ \acs{CBC} & \acl{CBC} \\ \end{longtable} In the table above, there is a repeated use of the \ac{BBC} acronym, but there is only one use of the \ac{ABC} acronym; with both acronyms in use here. There are also two uses of the CBC acronym in the table, but that hasn't been used here. The problem is the combination of the use of \ac{BBC} outside of the table, together with two uses of it inside the table. Because \ac{ABC} is only used once in the table, there is no warning. Similarly, because CBC is not used outside the table, there is no warning. (commenting out the \ac{BBC} line of the table proves this). \end{document}

  • During (expl3) *-map_inline, get the index of the considered item without any auxiliary integer
    by Denis Bitouzé on December 4, 2025 at 3:29 pm

    In the following MCE, I apply to every item stored within the \l_tmpa_clist clist an inline function that displays this item preceded by its index (its position in the list). For this index, an auxiliary integer is manually incremented at each item considered: \documentclass{article} \begin{document} \ExplSyntaxOn \clist_set:Nn \l_tmpa_clist {Foo,Bar,Baz} The~ \verb|\l_tmpa_clist|~ list~ has,~ as: \begin{itemize} \clist_map_inline:Nn \l_tmpa_clist { \int_incr:N \l_tmpa_int \item element~ \# \int_use:N\l_tmpa_int :~ #1 } \end{itemize} \ExplSyntaxOff \end{document} My question, not restricted to clists' mapping, is as follows: during *-map_inline, is it possible to access to the index of the considered item without the need to resort an auxiliary integer?

  • is it possible to keep the space when using url in latex
    by Dolphin on December 4, 2025 at 2:10 pm

    when facing the text in latex: Receiver class org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient does not define or inherit an implementation of the resolved method 'abstract org.springframework.cloud.client.ServiceInstance choose(java.lang.String, org.springframework.cloud.client.loadbalancer.Request)' of interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser it could not wrap properly, so I tried to put the text with \url like this: \url{Receiver class org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient does not define or inherit an implementation of the resolved method 'abstract org.springframework.cloud.client.ServiceInstance choose(java.lang.String, org.springframework.cloud.client.loadbalancer.Request)' of interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser} but the space was moved automatically. is it possible to keep the space? this is the full reproduce demo: \documentclass{article} \usepackage{xurl} \usepackage{hyperref} \usepackage{path} \begin{document} hello world!12\url{Receiver class org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient does not define or inherit an implementation of the resolved method 'abstract org.springframework.cloud.client.ServiceInstance choose(java.lang.String, org.springframework.cloud.client.loadbalancer.Request)' of interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser} \end{document} this is the result has no space: I also tried to use \href command, still did not work.

  • Float too large with minipage of \textheight
    by schtandard on December 4, 2025 at 12:38 pm

    I sometimes want to put the content of a float on a page by itself and control the alignment in the usual type area. To do this, I use a minipage that has exactly the size \textwidth x \textheight. However, depending on the content (and the packages loaded), I get Float too large warnings. In the following example, both figures contain only a minipage with some text in them, the second one additionally has a footnote. For the first one I get a warning about the float being too large by 1.94397pt, for the second one by 2.85002pt. If I remove \usepackage[T1]{fontenc}, the first warning goes away, but the second stays. If I switch to LuaLaTeX, the first warning is back, this time about 2.06pt. Why does the minipage not perfectly fit the type area and how can I fix this? Why does it even depend on the minipage's content? I would have thought the whole point of a fixed-height minipage is that the height is, well, fixed. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lipsum} \begin{document} Hello World! \begin{figure}[p] \begin{minipage}[b][\textheight]{\textwidth} \lipsum[1] \end{minipage} \end{figure} \begin{figure}[p] \begin{minipage}[b][\textheight]{\textwidth} \lipsum[1]\footnote{test} \end{minipage} \end{figure} \end{document}

  • Using beamer notes near a minted block makes font color white [duplicate]
    by bobismijnnaam on December 4, 2025 at 12:38 pm

    As the title says. I've got the following repro: \documentclass{beamer} \usepackage{minted} \setbeameroption{show notes on second screen=right} \begin{document} \frame{} \begin{frame}[fragile] \begin{minted}{c} char XXXX; \end{minted} \end{frame} \end{document} Output 1 with pdflatex --shell-escape: Output 2 with xelatex --shell-escape: I expect output 1 to be the "right" one, but maybe I'm wrong and the standard settings should cause "XXXX" to be colored white. If I remove the first empty frame, the text becomes regular grey. Is this something I can (should?) resolve with configuration, or might it be a subtle bug? I tested this with Overleaf's 2025 pdflatex and xelatex runners.

  • How to both use and pass on an option in a package
    by dedded on December 4, 2025 at 12:11 pm

    I can't figure out how to both use an option in a package and pass it to a second package. This will store to \cmdA in mwe_pkgA, but will not pass to mwe_pkgB: % -------------------------------- % mwe_pkgA.sty \ProvidesPackage{mwe_pkgA} \providecommand\cmdA{default-A} \DeclareKeys{ optA.store = \cmdA, } \PassOptionsToPackage{optA}{mwe_pkgB} \ProcessKeyOptions \RequirePackage{mwe_pkgB} \endinput This will pass optA to mwe_pkgB, but how can I also store to \cmdA in mwe_pkgA?: % -------------------------------- % mwe_pkgA.sty \ProvidesPackage{mwe_pkgA} \providecommand\cmdA{default-A} \DeclareKeys{ optA.code = \PassOptionsToPackage{\CurrentOption}{mwe_pkgB} } \ProcessKeyOptions \RequirePackage{mwe_pkgB} \endinput The mwe_pkgB.sty: % -------------------------------- % mwe_pkgB.sty \ProvidesPackage{mwe_pkgB} \providecommand\cmdB{default-B} \DeclareKeys{ optA.store = \cmdB, } \ProcessKeyOptions \endinput The document loading mwe_pkgA.sty: % -------------------------------- % mydoc.tex \documentclass{article} \usepackage[optA=newA]{mwe_pkgA} \begin{document} cmdA: \cmdA cmdB: \cmdB \end{document}

  • Embedding Arabic using polyglossia and lualatex
    by MJM on December 4, 2025 at 11:19 am

    I am trying to make a document with English and Arabic letters. Due to package support, I need to use PDFLaTeX or LuaLaTex. I have Amiri and Noto Sans Arabic installed, but when I use the \begin{arabic} command I get an error about a missing number. Here's a minimum (non)working document: \documentclass[10pt, twocolumn]{article} \usepackage{polyglossia} \setmainlanguage[variant=us]{english} \setotherlanguage{arabic} \newfontfamily\arabicfont[Script=Arabic]{Amiri} \title{Arabic} \author{} \date{} \begin{document} \maketitle Hello world \begin{arabic}عائشة\end{arabic} \end{document} I get the following error: ! Missing number, treated as zero. <to be read again> \c@ع l.18 \begin{arabic}ع ائشة\end{arabic} ? S OK, entering \scrollmode... Missing character: There is no ا (U+0627) in font [lmroman10-regular]:+tlig;! The errors continue that the characters aren't found. What number is missing? Why are the characters not showing?

  • Diagonal Arrows Under an Equation
    by Lucy on December 4, 2025 at 10:13 am

    I need to put diagonal arrows under an equation (the red ones in the picture). I tried using \swarrow \qquad \searrow, but they are not positioned where I need them. I would prefer not to use tikzmark. Is there another way to achieve this? Thanks for your help. \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[czech]{babel} \usepackage[T1]{fontenc} \usepackage{pgfplots} \usepackage{multicol,array,tabularx,xcolor,enumitem} \usepackage{amsmath,amsfonts,amssymb,mathrsfs} \pagestyle{empty} % % % % \definecolor{modra}{cmyk}{1,0,0,0} %%%%DEFINCIE%%%%%BARVY \definecolor{cerna}{cmyk}{0,0,0,1} \definecolor{bila}{cmyk}{0,0,0,0} % %\color{modra} % \begin{document} \begin{align*} S & = \rho \cdot \dfrac{a + b +c}{2} & S & = \dfrac{a \cdot b}{2} \\ \rho \cdot \dfrac{a + b +c}{2} & = \dfrac{a \cdot b}{2} \qquad | \cdot 2 & & \\ 18 (a +b+ c ) & = a \cdot b & a & = b \\ 18 (a + a + c ) & = a \cdot a & c^2 & = a^2 + b^2 \\ 18 (2a + c ) & = a^2 & c^2 & = a^2 + a^2 = 2a^2 \\ 36 a + 18 c & = a^2 & c & = \sqrt{2a^2} = a \sqrt{2} \\ 36 a + 18 a \sqrt{2} & = a^2 & & \\ a^2 - 36 a - 18 a \sqrt{2} & = 0 & & \\ a \left( a - 36 - 18 \sqrt{2} \right) & = 0 & & \\ \Large \swarrow \qquad \searrow \end{align*} % % \end{document}

  • Is that possible to tweak the related location and scale in the nested integral formula?
    by Explorer on December 4, 2025 at 10:02 am

    My previous question's actual case is as below: In this YouTube link, it introduced a following nested integral question: Or the simpler the SAME one: The most important patterns, here, is described as below, the Recursive Formula: Now I have the following code: \documentclass[border=5pt]{standalone} \usepackage{amsmath} \usepackage{fourier} \usepackage{cmupint} \usepackage{fixdif} \parindent=0pt % \DeclareMathOperator{\myint}{\int\nolimits} \DeclareRobustCommand{\myint}{\int\nolimits} \newcommand{\basicint}{\myint_0^1xdx} \newcommand{\basicintt}{\myint_{\basicint}^{\basicint}xdx} % https://tex.stackexchange.com/a/5192/322482 \makeatletter \newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}} \newcommand{\raisem@th}[3]{\raisebox{#1}{$#2#3$}} \makeatother \newcommand{\originintunit}{% \displaystyle\myint_{ \textstyle\myint^{0}_{\basicintt} }^{ \textstyle\myint_{1}^{\basicintt} } }% \newcommand{\intunit}[2]{% \myint_{ \myint^{0}_{\myint_{#1}^{\basicint}xdx} }^{ \myint_{1}^{\myint_{\basicint}^{#2}xdx} } } \ExplSyntaxOn % \cs_generate_variant:Nn \tl_use:N {V} \tl_new:N \l_explorer_base_tl \tl_new:N \l_explorer_tmp_tl \tl_new:N \l_explorer_script_tl \tl_new:N \g_explorer_tmp_tl \cs_new_protected:Npn \typeset_integral_recursive:Nn #1#2 { % #1:tl to store % #2:depth \group_begin: \tl_set_eq:NN \l_explorer_tmp_tl #1 \int_compare:nNnTF { #2 } = { 1 } { \tl_put_right:Ne \l_explorer_tmp_tl { \intunit{\basicint}{\basicint} } } { \tl_clear:N \l_explorer_script_tl \typeset_integral_recursive:Nn \l_explorer_script_tl { \int_eval:n { #2 - 1 } } \tl_put_right:Ne \l_explorer_tmp_tl { \intunit{\l_explorer_script_tl}{\l_explorer_script_tl} } } \tl_put_right:Nn \l_explorer_tmp_tl { xdx } \tl_gset_eq:NN \g_explorer_tmp_tl \l_explorer_tmp_tl \group_end: \tl_set_eq:NN #1 \g_explorer_tmp_tl } % \typeset_integral_recursive:Nn \l_explorer_base_tl { 4 } \NewDocumentCommand{\explorerint}{ m }{ \begingroup \typeset_integral_recursive:Nn \l_explorer_base_tl { #1 } $\l_explorer_base_tl$ \endgroup } \ExplSyntaxOff \begin{document} \explorerint{3} \end{document} But it gives the following, with no tweak of the location of subscript and superscript. I don't think in this case, l3coffin could handle better than just recursion with l3tl, but it's not easy for me, now, to tweak the sub/superscript's position, and the \int's scale, to make the final result looks more like an \int "tower". Any suggestions or perspectives would be welcome! And IMO, this question, deserved my bounty😀. I would start one in three days.

  • I would like to discretize the "tiles" into rectangular prismatic groups, sort each group, then sort the groups by each other or be shown a better way
    by Jasper on December 4, 2025 at 7:58 am

    I have built a comparator which can determine the occlusive relationship between two 0--2-dimensioal affine tiles (using their simplicial representations). In English, if I have two tiles (a tile is a point, line segment, or triangle), I can determining which one occludes the other, or if there is no occlusion (the inconclusive case). Currently, this requires an extremely expensive SCC topological sort (quadratic based on the number of tiles). I have the idea that I would like to speed this up, and I have a proposal for doing so (though, I am all ears to alternative ideas too). Basically, my idea is to partition the scene into rectangular prismatic regions (possibly with some overlap), sorting each one individually. Then, each rectangular prismatic region could use a waaay simpler sorting method on the set of rectangular prismatic region, once their constituent parts are sorted. This is my AI generated SCC topological sort routine, which has been working for ages. I am confident in it, based on it having not failed yet. How could I go about implementing this without visual artefacts from tiles which cross the boundary of two or more prisms? Alternatively, what better methods might I consider which I haven't yet? -- occlusion graph + SCC topo sort (bboxes computed on Cartesian coords) local n = #items local bboxes, graph = {}, {} for i = 1, n do bboxes[i] = { get_bbox2(items[i]) }; graph[i] = {} end for i = 1, n - 1 do for j = i + 1, n do if bboxes_overlap2(bboxes[i], bboxes[j]) then local r = cmp(items[i], items[j]) if r == true then table.insert(graph[i], j) elseif r == false then table.insert(graph[j], i) end end end end local index, stack, indices, lowlink, onstack, sccs = 0, {}, {}, {}, {}, {} for i = 1, n do indices[i], lowlink[i] = -1, -1 end local function dfs(v) indices[v], lowlink[v] = index, index; index = index + 1 stack[#stack+1] = v; onstack[v] = true for _, w in ipairs(graph[v]) do if indices[w] == -1 then dfs(w); lowlink[v] = math.min(lowlink[v], lowlink[w]) elseif onstack[w] then lowlink[v] = math.min(lowlink[v], indices[w]) end end if lowlink[v] == indices[v] then local scc = {} while true do local w = table.remove(stack); onstack[w] = false scc[#scc+1] = w if w == v then break end end sccs[#sccs+1] = scc end end for v = 1, n do if indices[v] == -1 then dfs(v) end end local scc_index, scc_graph, indeg = {}, {}, {} for i, comp in ipairs(sccs) do for _, v in ipairs(comp) do scc_index[v] = i end scc_graph[i], indeg[i] = {}, 0 end for v = 1, n do for _, w in ipairs(graph[v]) do local si, sj = scc_index[v], scc_index[w] if si ~= sj then table.insert(scc_graph[si], sj); indeg[sj] = indeg[sj] + 1 end end end local queue, sorted = {}, {} for i = 1, #sccs do if indeg[i] == 0 then queue[#queue+1] = i end end while #queue > 0 do local i = table.remove(queue, 1) for _, v in ipairs(sccs[i]) do sorted[#sorted+1] = items[v] end for _, j in ipairs(scc_graph[i]) do indeg[j] = indeg[j] - 1 if indeg[j] == 0 then queue[#queue+1] = j end end end In fact, I would also like to employ a similar strategy for partitioning, since it is also quadratic, but I think that if I saw it for occlusion, that it would be simple to re-implement for partitioning. This MWE, for example, takes ages to compile, and I believe it should be speed-up-able. This version is currently on TeXLive and MikTeX (and on CTAN), so there is no need to use the GitHub version. \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \begin{luatikztdtoolspicture}[ C1 = { {{-3,-3,0,1}} } ,C2 = { {{3,3,-10,1}} } ,light = { {{0,0,-2,1}} } ] \pgfmathsetmacro{\param}{0} \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,-5) ) ,matrix_multiply( { {1,0,0,0} ,{0,1,0,0} ,{0,0,1,0} ,{0,0,0,1} } ,matrix_multiply(xscale(1/2),yscale(1/2)) ) ) } ] \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 } ] \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 } } ] \end{luatikztdtoolspicture} \end{document}

  • The defined date command doesn't work before \today when invoking babel
    by M. Logic on December 4, 2025 at 4:41 am

    A MWS is as follows. \documentclass{ctexart} \usepackage[main=chinese, provide=*]{babel}% \babelprovide{greek} \babelfont[greek]{rm}[Scale=MatchUppercase, ItalicFont={GFSArtemisiaIt.otf}, BoldFont={GFSArtemisiaBold.otf}, BoldItalicFont={GFSArtemisiaBoldIt.otf}]{GFSArtemisia.otf} \usepackage{datetime}%after babel package \newdateformat{eightdate}{\THEYEAR\twodigit{\THEMONTH}\twodigit{\THEDAY}} \title{测试} \author{佚名} \date{} \begin{document} \maketitle \verb|\today| works fine, i.e., it produces \today. While \verb|\eightdate| doesn't work before \verb|\today|, i.e., \verb|\eightdate\today| also produces \today, but I'd like \verb|\eightdate\today| to produce 20251204. \end{document} \today works fine, i.e., it produces 2025年12月4日. While \eightdate doesn't work before \today, i.e., \eightdate\today also produces 2025年12月4日, but I'd like \eightdate\today to produce 20251204. Then how to make both \today and \eightdate\today work as desired when invoking babel and datetime? Note that \usepackage[main=chinese, provide=*]{babel} is for special use.

  • Why `\raisemath` doesn't work if there exists some barriers to raise the math symbols?
    by Explorer on December 4, 2025 at 4:15 am

    I want to typeset the following formula: Now consider that TWO red boxes are in proper location towards TWO blue boxes \int. With the following code, learning \raisemath from here: \documentclass[a4paper]{article} \usepackage{amsmath} \usepackage{fourier} \usepackage{cmupint} \usepackage{fixdif} \parindent=0pt % \DeclareMathOperator{\myint}{\int\nolimits} \DeclareRobustCommand{\myint}{\int\nolimits} \newcommand{\basicint}{\myint_0^1x \d x} \newcommand{\basicintt}{\myint_{\basicint}^{\basicint} x\d x} % https://tex.stackexchange.com/a/5192/322482 \makeatletter \newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}} \newcommand{\raisem@th}[3]{\raisebox{#1}{$#2#3$}} \makeatother \begin{document} $\basicint$ $\basicintt$ \bigskip $ \displaystyle\myint_{ \textstyle\myint^{0}_{\basicintt} }^{ \textstyle\myint_{1}^{\basicintt} }x\d x $ \bigskip Shift to another direction, it works: $ \displaystyle\myint_{ \textstyle\myint^{0}_{\raisemath{-20pt}{\basicintt}} }^{ \textstyle\myint_{1}^{\raisemath{20pt}{\basicintt}} }x\d x $ However, look like \texttt{1} obstructs \texttt{basicintt}'s shift down, another direction's shift failed. $ \displaystyle\myint_{ \textstyle\myint^{0}_{\raisemath{20pt}{\basicintt}} }^{ \textstyle\myint_{1}^{\raisemath{-20pt}{\basicintt}} }x\d x $ \end{document} How to tune the location of \int here, to better mimic the hand-written image shown above?

  • Why is stretch glue ignored on pages with top or bottom floats?
    by Bastien on December 3, 2025 at 7:51 pm

    I am experimenting with custom page-building logic by redefining \@texttop and \@textbottom (which determine the behavior of \flushbottom and \raggedbottom), and I need to access the value of \pagestretch once LaTeX has finished assembling the page. In many cases, it work and LaTeX gives me the expected result. However, I discovered that it fails when a page contains a top float and/or a bottom float. In such pages, \pagestretch is always 0pt, even though the page contains at least one occurrence of \textfloatsep, which I set for this test to \textfloatsep = 10pt plus 100pt. Therefore I would expect a total finite stretch of at least 100 pt. The log confirms the issue. For the first page of the following MWE (which contains both a top and a bottom float), we get: ... % t=334.0 g=365.76004 b=10000 p=0 c=100000# % t=382.0 g=365.76004 b=* p=0 c=* Page 1 - page stretch: 0.0pt Page 1 - page shrink: 0.0pt Page 1 - content natural height: 526.66096pt Page 1 - page height: 556.47656pt ... The same MWE also contains h-floats and commands with positive stretch, and these do correctly contribute to \pagestretch. The issue seems specific to pages with top and/or bottom floats. My questions are: Why does \pagestretch remain zero on a page containing both a top and a bottom float? Is LaTeX using some glue other than \textfloatsep in this situation? If so, what glue is being inserted, and why does it contribute no finite stretch to \pagestretch? The MWE: \documentclass{book} \usepackage{lipsum, babel} \usepackage[showframe]{geometry} \def\myrule{\rule{\linewidth}{3cm}} \def\testA{\vspace{10pt plus 100pt} TEST A \vspace{10pt plus 100pt}} \def\testB{\vspace{10pt plus 5pt} TEST B \vspace{10pt plus 5pt}} \setlength{\floatsep}{10pt plus 100pt} \setlength{\textfloatsep}{\floatsep} \setlength{\intextsep}{\floatsep} \setlength{\parskip}{0pt} \widowpenalties 4 10000 10000 10000 0% Value for testing \clubpenalties 4 10000 10000 10000 0 \makeatletter \newbox\@currentColumnBox \def\mypagebottom{% \def\@texttop{% \setbox\@currentColumnBox = \vbox{\unvcopy\@outputbox}% \typeout{Page \the\c@page\space - page stretch: \the\pagestretch}% \typeout{Page \the\c@page\space - page shrink: \the\pageshrink}% \typeout{Page \the\c@page\space - content natural heigth: \the\ht\@currentColumnBox}% \typeout{Page \the\c@page\space - page heigth: \the\@colht}% %% TEST: % \ifdim\dimexpr \@colht - \ht\@currentColumnBox - \pagestretch > \z@\relax% % \typeout{Raggedbottom on page \the\c@page. \the\dimexpr\ht\@currentColumnBox + \pagestretch\relax\space < \the\@colht.}% % \def\@textbottom{\vskip \z@ \@plus 0.0001 fil}% % \else% % \typeout{Flushbottom on page \the\c@page. \the\dimexpr\ht\@currentColumnBox + \pagestretch\relax\space >= \the\@colht.}% % \def\@textbottom{}% % \fi% }% \def\@textbottom{}% } \makeatother \tracingpages=1 \mypagebottom \begin{document} \begin{figure}[t] \myrule \end{figure} \lipsum[1-4] \begin{figure}[b] \myrule \end{figure} \lipsum[1-3] \begin{figure}[ht] \myrule \end{figure} \lipsum[1-3] \testA \lipsum[1-6] \testB \lipsum[1-9] \end{document}

  • Dynamic calculation of part number width in the memoir table of contents
    by nowox on December 3, 2025 at 6:07 pm

    In this simple example, I have a memoir document with eight parts. By default, LaTeX doesn’t know how wide the part number in the table of contents will be. Since \cftpartnumwidth requires a fixed width, it has to be adjusted manually for every document, and updated every time I add a new part — which makes no sense. I understand the goal is to align titles, so a fixed width is reasonable, but alternatives like the tabbed environment can align entries without hard-coding lengths. Ideally, I’d like LaTeX to determine the correct width automatically, regardless of the document content. I love LaTeX, but sometimes it feels unnecessarily rigid… Here is the example: \documentclass{memoir} \begin{document} \tableofcontents* \part{First} \part{Second} \part{Third} \part{Fourth} \part{Fifth} \part{Sixth} \part{Seventh} \part{Eighth} \end{document} What currently works for me (since I generate the document programmatically) is something like: \newlength{\maxpartnumwidth} \newcounter{maxpart} \setcounter{maxpart}{8} \AtBeginDocument{% \settowidth{\maxpartnumwidth}{Part~\Roman{maxpart}} \addtolength{\maxpartnumwidth}{1em} \setlength{\cftpartnumwidth}{\maxpartnumwidth}% } But this approach is fragile: “Part” is hard-coded, and I don’t know the final font or font size, so the result may not be accurate. Is there a cleaner or more robust way to do this automatically?

  • How to reset poles of coffins with two attachment?
    by Explorer on December 3, 2025 at 5:07 pm

    I have the following code: \documentclass{article} \usepackage{cmupint} \usepackage{fixdif} \DeclareRobustCommand{\myint}{$\displaystyle\int\nolimits$} \begin{document} \ExplSyntaxOn \coffin_new:N \l_int_left_coffin \coffin_new:N \l_int_right_coffin \coffin_new:N \l_base_int_coffin \hcoffin_set:Nn \l_base_int_coffin { \myint } \coffin_new:N \l_dx_int_coffin \hcoffin_set:Nn \l_dx_int_coffin { $\d x$ } \coffin_new:N \l_tmp_coffin \coffin_set_eq:NN \l_tmp_coffin \l_base_int_coffin \coffin_scale:Nnn \l_tmp_coffin { .5 } { .5 } % first \coffin_attach:NnnNnnnn \l_base_int_coffin { r } { t } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } % second \coffin_join:NnnNnnnn \l_base_int_coffin { r } { b } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } \coffin_reset_poles:N \l_base_int_coffin \coffin_display_handles:Nn \l_base_int_coffin {magenta} \ExplSyntaxOff \end{document} Now the poles is as below: What I want, is the GREEN coffin's border. The key code here is: % first \coffin_attach:NnnNnnnn \l_base_int_coffin { r } { t } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } % second \coffin_join:NnnNnnnn \l_base_int_coffin { r } { b } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } If I use two join, two small \int is not vertical align. I also try to make the final \l_base_int_coffin into a \fbox, together with two attach, but also failed, the border is still not what I want: \documentclass{article} \usepackage{cmupint} \usepackage{fixdif} \DeclareRobustCommand{\myint}{$\displaystyle\int\nolimits$} \begin{document} \ExplSyntaxOn \coffin_new:N \l_int_left_coffin \coffin_new:N \l_int_right_coffin \coffin_new:N \l_base_int_coffin \hcoffin_set:Nn \l_base_int_coffin { \myint } \coffin_new:N \l_dx_int_coffin \hcoffin_set:Nn \l_dx_int_coffin { $\d x$ } \coffin_new:N \l_tmp_coffin \coffin_set_eq:NN \l_tmp_coffin \l_base_int_coffin \coffin_scale:Nnn \l_tmp_coffin { .5 } { .5 } % first \coffin_attach:NnnNnnnn \l_base_int_coffin { r } { t } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } % second \coffin_attach:NnnNnnnn \l_base_int_coffin { r } { b } \l_tmp_coffin { l } { vc } { 0pt } { 0pt } \coffin_reset_poles:N \l_base_int_coffin \hcoffin_set:Nn \l_tmpa_coffin { \fbox{\coffin_typeset:Nnnnn \l_base_int_coffin{l}{vc}{0pt}{0pt}} } \coffin_display_handles:Nn \l_tmpa_coffin {magenta} \ExplSyntaxOff \end{document} Is there elegant method to get my desired \l_base_int_coffin's border? Edit with more general case Since cfr has given a tricky r handles' solution to solve my original question, but my case has a more widely-extensive case(Let's consider that the TWO sub-coffins is not hold the some width): \documentclass{article} \usepackage{cmupint} \usepackage{fixdif} \DeclareRobustCommand{\myint}{$\displaystyle\int\nolimits$} \begin{document} \ExplSyntaxOn \coffin_new:N \l_explorer_int_left_coffin \coffin_new:N \l_explorer_int_right_coffin \coffin_new:N \l_explorer_base_int_coffin \coffin_new:N \l_explorer_dx_int_coffin \coffin_new:N \l_explorer_tmp_coffin \coffin_new:N \l_explorer_tmpA_coffin \coffin_new:N \l_explorer_tmpB_coffin \hcoffin_set:Nn \l_explorer_base_int_coffin { \myint } \hcoffin_set:Nn \l_explorer_dx_int_coffin { $\d x$ } \coffin_set_eq:NN \l_explorer_tmp_coffin \l_explorer_base_int_coffin \coffin_set_eq:NN \l_explorer_tmpA_coffin \l_explorer_base_int_coffin \coffin_set_eq:NN \l_explorer_tmpB_coffin \l_explorer_base_int_coffin \coffin_scale:Nnn \l_explorer_tmpA_coffin { .5 } { .5 } \coffin_scale:Nnn \l_explorer_tmpB_coffin { 1.5 } { .25 } % first \coffin_attach:NnnNnnnn \l_explorer_base_int_coffin { r } { t } \l_explorer_tmpA_coffin { l } { vc } { 0pt } { 0pt } % second \coffin_attach:NnnNnnnn \l_explorer_base_int_coffin { r } { b } \l_explorer_tmpB_coffin { l } { vc } { 0pt } { 0pt } % just use `r' would shift back too much, for not the same width of `\l_explorer_tmpA_coffin' and `\l_explorer_tmpB_coffin' % \coffin_join:NnnNnnnn \l_explorer_base_int_coffin { r } { b } \l_explorer_tmpB_coffin { r } { vc } { 0pt } { 0pt } \coffin_reset_poles:N \l_explorer_base_int_coffin \coffin_display_handles:Nn \l_explorer_base_int_coffin {magenta} \ExplSyntaxOff \end{document}

  • Why does forest baseline alignment seem to stop, once drawing circles around each node?
    by MS-SPO on December 3, 2025 at 10:05 am

    Situation While working on this forest-based solution I was puzzled by the vertical alignment, once I draw circles around the nodes. So for test purposes I copied said basic tree three times: left: without any forest preamble right: preamble only names nodes (for later use) middle: also draws a circle around each node Observations Comparing left and right all characters seem to align by their baselines (light-blue). For the middle one this is more puzzling: light-pink: b, c, d seem to match baselines, but this can be accidental e and f as well, while g and i clearly don't light-blue: k, l, m, y, z seem to "do what they want" orange: there seems to be a tendency to roughly align the circles south (with content dependent size variation from Tikz) Question Actually I have two questions, which are connected like face and back of a coin: how to understand the forest-way of these vertical alignments (middle)? how to obtain baseline alignments for the nodes content (characters, light-blue) instead of the shapes south? I see that this solution seems to solve a similar problem, but honestly I'm lost at the moment in identifying the relevant alignment statements introduced. Code \documentclass[10pt,border=3mm]{standalone} \usepackage{forest} \begin{document} % ~~~ correct baselining ~~~~~~~~~~~ \begin{forest} [a, label=north:baselined [b [e [k][l]] [f [m]]] [c [g [y][z]]] [d [i]] ] \end{forest} % ~~~ incorrect/unexpected ~~~~~~~~~~~~ \begin{forest} delay={ for tree={ name/.option=content,% now node name is same as content circle,draw, % nodes as circles, }, } [a, label=north:{well \dots} [b [e [k][l]] [f [m]]] [c [g [y][z]]] [d [i]] ] \end{forest} % ~~~ correct ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \begin{forest} delay={ for tree={ name/.option=content,% now node name is same as content % circle,draw, % nodes as circles, }, } [a, label=north:baselined [b [e [k][l]] [f [m]]] [c [g [y][z]]] [d [i]] ] \end{forest} \end{document}

  • How to tagging documents with figures mixed latex/pdf from fig
    by user2609605 on December 3, 2025 at 7:57 am

    I want tagged pdf from latex and for that specify tagging=on in \DocumentMetatdata. I know that if including PDF figures thePic with \includegraphics, an alt text must be given like so: \includegraphics[alt=whats on the pic]{thePic} Now my problem is that I have a lot of fig pictures consisting of a kind of graphs annotated with latex text. Thus I export with fig2dev in two parts: fig2dev -L pdftex thePic.fig thePic.pdf fig2dev -L pdftex_t -p xxx thePic.fig thePic.tex The result is some thePic.tex I can include with \input{thePic} which contains a picture environment which defines the latex text directly and includes the graphics via \includegraphics{thePic.pdf}. A short latex document could be the following: \DocumentMetadata{lang=en_US,tagging=on} \documentclass[a4paper]{article} \usepackage{graphicx} \usepackage{color} \usepackage{unicode-math} \title{On Tagging created pictures} \author{E. Reißner} \date{\today} \begin{document} \maketitle Some text. \input{thePic} \end{document} The FIG file I spare the reader, whereas thePic.tex created by fig2dev may be interesting: \begin{picture}[artifact](0,0) %\begin{picture}(0,0) \includegraphics{thePic}% \end{picture}% % % Conversion of xxx.fig into xxx.ptx, xxx.pdf and xxx.eps % \setlength{\unitlength}{2072sp}% \begin{picture}[alt=Transformation of pics from fig format to tex picture including a pdf.](8492,4797)(1114,-4621) %\put(1000,-4797){\includegraphics{thePic}} \put(1351,-2311){\makebox(0,0)[lb]{\smash{\fontsize{10}{12}\usefont{T1}{ptm}{m}{n}{\color[rgb]{0,0,0}\texttt{xxx.fig}}% }}} \put(6976,-286){\makebox(0,0)[lb]{\smash{\fontsize{10}{12}\usefont{T1}{ptm}{m}{n}{\color[rgb]{0,0,0}\texttt{xxx.pdf}}% }}} \put(6976,-2311){\makebox(0,0)[lb]{\smash{\fontsize{10}{12}\usefont{T1}{ptm}{m}{n}{\color[rgb]{0,0,0}\texttt{xxx.ptx}}% }}} ... \end{picture}% As i said, this is 'essentially' created by fig2dev which cannot know about the meaning of the pics. What I inserted by hand are [artifact] and alt=...]. I know, this is not really correct, because of course the pdf part is of course no pure artifact. I remember fig2dev once created a single picture environment, and I can imagine we could return to that. I showed with \put(1000,-4797){\includegraphics{thePic}} where the pdf could be included. That way, a single alt would remain. Still I have the problem, that creation of such a document is done automatically and I cannot just include alt or artifact in created sources. I found the accessibility package but unfortunately this seems to support pdflatex only and I have for good reasons lualatex. I also found package latex-lab-graphic but the status of this package is not clear. It is not very explicit about how to use it. Seemingly one can enclose pictures in a structure to tag them. This would be what I need. My feeling is, that I would prefer if the alt text would be included in the pic itself, but I think this is in general no option. I know there are many formats out there to be included in latex and even more techniques to do so. Why assigning alt to includegraphics and not to \caption of figures and tables? I imagine \caption[alt=desc, ...]{normal text}.

  • Inconsistent spacing behavior between `equation`s with `fleqn` option?
    by Explorer on December 3, 2025 at 6:38 am

    Let's see the following two codes: \documentclass[12pt,a4paper]{article} \usepackage{showframe} \usepackage{amsmath} \usepackage{lipsum} \begin{document} \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:1} \end{equation}% \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:2} \end{equation}% \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:3} \end{equation}% \lipsum[1][1-3] aa \eqref{eq:1} and \eqref{eq:2} and \eqref{eq:3} \end{document} It gives normally: While, when I add fleqn: \documentclass[12pt,a4paper,fleqn]{article} \usepackage{showframe} \usepackage{amsmath} \usepackage{lipsum} \begin{document} \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:1} \end{equation}% \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:2} \end{equation}% \lipsum[1][1-3] \begin{equation}% x^2+y^2=z^2 \label{eq:3} \end{equation}% \lipsum[1][1-3] aa \eqref{eq:1} and \eqref{eq:2} and \eqref{eq:3} \end{document} The spacing expand unexpectedly. IMHO, flqno.clo just move the formula left, without adding the spacing. I want to know how to keep the \above(below)display(short)skip the same as the reqno's case. I found two (maybe) relative links.... But not exactly the same, I think(they both relative with hyperref)... https://tex.stackexchange.com/a/235837/322482 https://tex.stackexchange.com/a/122358/322482

  • Shaded Tabular table not working as expected
    by Álvaro on December 3, 2025 at 4:27 am

    I have this code: \documentclass{article} \usepackage{array,multirow,xcolor,colortbl} \definecolor{tableheadercolor}{HTML}{FFCE63} % Orange from the Keams template \colorlet{tablerowcolor}{tableheadercolor!20} % 20% header color + 80% white \begin{document} \begin{table}[ht] \centering \caption{Opened and Closed JIRA Tickets for ED by Month} \begin{tabular}{| >{\centering\arraybackslash}m{0.1\textwidth}| >{\centering\arraybackslash}m{0.15\textwidth}| >{\centering\arraybackslash}m{0.15\textwidth}| >{\centering\arraybackslash}m{0.15\textwidth}|} \hline \rowcolor{tableheadercolor} \textbf{Year} & \textbf{Month} & \textbf{Opened JIRAs} & \textbf{Closed JIRAs} \\ \hline \multirow{1}{*}{\centering 2023} & December & 2 & 1 \\ \hline \multirow{12}{*}{\cellcolor{tablerowcolor}\centering 2024} & \cellcolor{tablerowcolor} January & \cellcolor{tablerowcolor} 1 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & February & 0 & 1 \\ \cline{2-4} & \cellcolor{tablerowcolor} March & \cellcolor{tablerowcolor} 0 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & April & 0 & 0 \\ \cline{2-4} & \cellcolor{tablerowcolor} May & \cellcolor{tablerowcolor} 3 & \cellcolor{tablerowcolor} 1 \\ \cline{2-4} & June & 0 & 0 \\ \cline{2-4} & \cellcolor{tablerowcolor} July & \cellcolor{tablerowcolor} 0 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & August & 2 & 2 \\ \cline{2-4} & \cellcolor{tablerowcolor} September & \cellcolor{tablerowcolor} 0 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & October & 1 & 0 \\ \cline{2-4} & \cellcolor{tablerowcolor} November & \cellcolor{tablerowcolor} 1 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & December & 2 & 1 \\ \hline \multirow{11}{*}{\centering 2025} & \cellcolor{tablerowcolor} January & \cellcolor{tablerowcolor} 2 & \cellcolor{tablerowcolor} 8 \\ \cline{2-4} & February & 4 & 2 \\ \cline{2-4} & \cellcolor{tablerowcolor} March & \cellcolor{tablerowcolor} 0 & \cellcolor{tablerowcolor} 3 \\ \cline{2-4} & April & 8 & 4 \\ \cline{2-4} & \cellcolor{tablerowcolor} May & \cellcolor{tablerowcolor} 2 & \cellcolor{tablerowcolor} 0 \\ \cline{2-4} & June & 2 & 4 \\ \cline{2-4} & \cellcolor{tablerowcolor} July & \cellcolor{tablerowcolor} 1 & \cellcolor{tablerowcolor} 4 \\ \cline{2-4} & August & 2 & 1 \\ \cline{2-4} & \cellcolor{tablerowcolor} September & \cellcolor{tablerowcolor} 1 & \cellcolor{tablerowcolor} 3 \\ \cline{2-4} & October & 2 & 0 \\ \cline{2-4} & \cellcolor{tablerowcolor} November & \cellcolor{tablerowcolor} 0 & \cellcolor{tablerowcolor} 1 \\ \hline \end{tabular} \end{table} \end{document} However, the row for year 2024 is not correctly shaded: What I want to achieve is rows with alternate shading.

  • Re-typesetting the result of \unvbox
    by Frisket on December 2, 2025 at 10:30 pm

    If I typeset some text into a \vbox narrower than the rest of the document, I can \vsplit some of it to use, but I then want the remainder re-typeset to the text width of the document. Here is an example of it not working (the \unvbox'd material is at the width it was set at and is not being reset to the main width): \documentclass{article} \usepackage{lipsum} \begin{document} \setbox0=\vbox{\divide\hsize by2\lipsum[2]} \vsplit0 to2cm \hrule % added to show where the split occurs \unvbox0 \end{document} In my innocence I understood from the TeXbook and elsewhere that the glue at the top level in the remainder of the box after \vsplitting would be unset, making the contents available for use (in my case, the contents will always be plain text with no macros). I see a number of specialist solutions (eg Centering contents after \unvbox) but they all involve taking special action on the \unvbox'd material, which contains all kinds of other stuff like alignments, whereas I need to have it treated as if it were fresh text.

  • Is there a way in TikZ or Lua to make a short function which converts letters to their corresponding alphabetical position (and vice versa)?
    by Jasper on December 2, 2025 at 5:38 pm

    Is there a way in TikZ or Lua to make a short function which converts letters to their corresponding alphabetical position (and vice versa)? The only way I can think of it so string check each letter, but that sounds too computationally expensive. M(non)WE: \documentclass[tikz,border=1cm]{standalone} \newcommand{\letterpos}[1]{ \pgfmathparse{#1 == a} \ifnum\pgfmathresult=1 1 \fi \pgfmathparse{#1 == ab} \ifnum\pgfmathresult=1 2 \fi \pgfmathparse{#1 == c} \ifnum\pgfmathresult=1 3 \fi \pgfmathparse{#1 == d} \ifnum\pgfmathresult=1 4 \fi \pgfmathparse{#1 == e} \ifnum\pgfmathresult=1 5 \fi } \begin{document} \begin{tikzpicture} \foreach \letter in {a,b,...,e} { \node at (\letterpos{\letter},0) {\letter}; } \end{tikzpicture} \end{document}

  • Section title with \star
    by Roberto Rastapopoulos on December 2, 2025 at 1:47 pm

    I am trying to get the following: But when I insert it in this way: \documentclass[a4paper,12pt]{amsart} \usepackage{hyperref} \begin{document} \tableofcontents \section{Introduction} \subsection{$\star$ N-Soliton solutions} Some text about N-soliton solutions... \end{document} I get the error "Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `math shift' [...]". When I write \subsection{\star N-Soliton solutions} I get How can I get the first one without the error? I have tried several things, but all come with another problem.

  • xcolor not fully colouring commutative diagrams drawn by tikzcd
    by Ishan Deo on December 2, 2025 at 3:12 am

    I'm using xcolor in a table whose cells contain commutative diagrams drawn by tikzcd. However, the colour from xcolor is not fully going through these commutative diagrams, as can be seen by the image below Here is a MWP for the code \documentclass[12pt]{article} \usepackage[svgnames,table]{xcolor} \usepackage{tikz-cd} \begin{document} \begin{table} \centering \rowcolors{1}{Gray!10}{} \begin{tabular}{c} $\displaystyle \begin{tikzcd}[column sep=huge, ampersand replacement=\&] * \arrow[r, bend left = 40, "\,", ""{name=U, inner sep=1pt, below}] \arrow[r, bend right = 40, "\,"{below}, ""{name=D, inner sep=1pt}] \& \arrow[Rightarrow, from=U, to=D, "\alpha"] * \end{tikzcd}$ \end{tabular} \end{table} \end{document} Why is this error happening? And how can I fix it?