• Can I force expansion in JSONParseArrayMapFunction?
    by Teepeemm on January 19, 2026 at 6:51 pm

    I have a JSON file that I would like to parse, for which I am using the package jsonparse. I would like to split some of the strings in an array and extract that information into separate variables. Unfortunately, it appears that the splitting needs to happen in an expandable context (this is similar to the way that \typeout needs to get an expandable value to . In my case, I was able to specify rescan=false so that the strings are now expandable. But I'm left wondering: would I have been able to split a string that needed rescanning? I had hoped that \exp_args or \use:e would work, but I think it stops at \tl_rescan:nn, which isn't expandable. (Related GitHub issue.) The following code: \documentclass{article} \usepackage{jsonparse} \JSONParse{\myJSONdata}{{"array":["a-b"]}} \typeout{Line 4: \JSONParseValue{\myJSONdata}{array[0]}} % not useful, needs to be expandable \typeout{Line 5: \JSONParseExpandableValue{\myJSONdata}{array[0]}} % useful \ExplSyntaxOn \newcommand{\splitValues}{\splitArg{\JSONParseArrayValue}} \newcommand{\splitArg}[1]{ \item original: ~ #1 \seq_set_split:Nne \l_tmpa_seq { - } { #1 } \item using~seq~items: ~ \seq_item:Nn \l_tmpa_seq {1} ~ and ~ \seq_item:Nn \l_tmpa_seq {2} \exp_args:NNe \str_set:Nn \l_tmpa_str { \seq_item:Nn \l_tmpa_seq {1} } \exp_args:NNe \str_set:Nn \l_tmpb_str { \seq_item:Nn \l_tmpa_seq {2} } \item using~tmp~variables: ~ \l_tmpa_str{} ~ and ~ \l_tmpb_str } \ExplSyntaxOff \begin{document} \begin{itemize} % \splitArg{\JSONParseValue{\myJSONdata}{array[0]}} % causes errors \splitArg{\JSONParseExpandableValue{\myJSONdata}{array[0]}} % good output for one array element \JSONParseArrayMapFunction{\myJSONdata}{array}{\splitValues} % bad output for all array elements \JSONParseArrayMapFunction[rescan=false]{\myJSONdata}{array}{\splitValues} % good output for all array elements \end{itemize} \end{document} has the output Is it possible to have the middle three entries created from \JSONParseArrayMapFunction[rescan=true] but match the first and last three entries?

  • Can't get the page dimensions right
    by Kristian Nordestgaard on January 19, 2026 at 6:29 pm

    I need to typeset a book and for some reason I can not get the dimensions right. I have to use lualatex because of a package that's loaded earlier, and I'm using memoir. It should be simple but it keeps acting up. The dimensions: Page size without bleed: 5.5" x 8.5" (13.97 x 21.59 cm) Page size with bleed: 5.626" x 8.75" (14.29 x 22.23 cm) Here's the MWE: \documentclass[12pt,openany,showtrims]{memoir} \usepackage{lipsum} %% The stock paper size \setstocksize{222.3mm}{142.9mm} %% The 'real' page size \settrimmedsize{139.7mm}{215.9mm}{*} %% The trims \settrims{3.2mm}{3.2mm} %% Spine and trim page margins from main typeblock \setlrmarginsandblock{15mm}{15mm}{*} %% Top and bottom page margins from main typeblock \setulmarginsandblock{15mm}{17mm}{*} \begin{document} \trimLmarks \lipsum[1-6] \lipsum[7-20] \end{document} It just looks wrong, as you can see: I have a feeling that it's something really simple that I'm doing wrong, but think I have started myself blind on this ...

  • How to convert LaTeX file to Markdown but have tables, figures, and formulas as images and citations as plain text?
    by Chad Chaddington on January 19, 2026 at 6:03 pm

    I'm writing my thesis in LaTeX (LaTeX Workshop + TeX Live + VSCode) and using GitLab for its version control. With GitLab (and GitHub, and the like), you can comment on individual lines on a file, and you can have this kind of back-and-forth about what to change and how. I'd like to be able to do that with my thesis advisor. However: PDF does not allow for that, since it's a binary file and treated as an image by the commenting feature; I don't know that my advisor is super familiar with LaTeX, so I don't want to give them a whole bunch of .tex files to parse through and try to figure out which one matches which section of the final .pdf; Even if they were okay with that, I don't want to ask them to do extra work (i.e.: install the editor and extension and TeX Live on their computer, plus keep git-pulling my things rather than comment on the file on GitLab) just so that reviewing my work is easier on me. So! I've been looking up ways to convert my LaTeX files into a single file of a types that can be rendered and commented on in platforms like GitLab (e.g.: .txt, .md, ...). So far I'm partial do markdown, since there's a built-in renderer for it on most git platforms and it works for both images and text. Unfortunately, pandoc, the most promising converter I found turns some of the code into html (e.g.: tables, citations, figures), which kind of cancels out the whole "no code for my adivsor to parse through" aspect. How can I convert a LaTeX file from .tex to .md, so that, simultaneously: Citations are shown in the markdown file as either their display text only, or as links to their matching bibliography entry? Tables, figures, formulas, etc, are displayed as images? I've been reading up here, and the tikz package might help convert a few sections to image files (seen here and here with equations), but all mentions I've found only apply this to the final .pdf, not to other file types, and even then they focus on equations, not tables. I assume I can convert from pdf with the tikz images to markdown, but my computer is slow enough I'd like to convert directly from LaTeX to markdown, just with the images rather than tables/figures/etc. I would like a way to make file names consistent, too, between images, if possible. Thank you for your time! Additional note(s): With pandoc, compilation was done as a recipe step/tool for LaTex Workshop. I used no additional flags for compilation beyond specifying I wanted to convert from latex to markdown. I tried to use different types of markdown to see if there was a difference: github-flavored markdown, and regular markdown. The entry on "latex-workshop.latex.tools" in my VSCode settings.json file is: {"name": "markdowntex", "command": "pandoc", "args": [ "%DOC_EXT%", "-f", "latex", "-t", "gfm", "-s", "-o", "%DOC%.md", ]} I do not wish to use Overleaf.

  • Missing definition of \smallsetminus with lua-unicode-math
    by murray on January 19, 2026 at 4:42 pm

    With the unicode-math package, this source gives the expected output, as shown: % !TEX program = lualatex \NeedsTeXFormat{LaTeX2e}[2025-11-01] \documentclass{article} \usepackage{mathtools} \usepackage{fontspec, unicode-math} % OK with this %\usepackage{fontspec, lua-unicode-math} % this gives undefined control sequence \setmainfont[Scale=1.0]{TeXGyreTermesX} \setmathfont{STIX Two Math}[Scale=MatchUppercase,math-style=ISO] \begin{document} $A \smallsetminus B$ \end{document} However, if lua-unicode-math is loaded instead of unicode-math, then an "undefined control sequence" error results. How fix this? Added: in unicode-math-luatex.sty, which is called by unicode-math when lualatex is used, the definition is given by: \cs_set_protected:Npn \smallsetminus { \mathbin{ \mathpalette \__um_smallsetminus: \relax} } \cs_set:Npn \__um_smallsetminus: #1 { \rotatebox{135}{ \smash{ \raisebox{-\height}{$#1\minus$} } }}

  • Adding a hyperlink to a tcolorbox title
    by mmjt on January 19, 2026 at 2:44 pm

    With help from stackexchange, I have been able to create attractive colorboxes for the exercise and problem sets in a class mathematical physics tutorial. The exercises have hints. I would like to modify the "Exercise" tcolorbox so that an optional clickable hint icon will appear in the title bar, containing a hyperlink to the hint. I cannot simply make the whole exercise box be the clickable area, because that will mask any links that may be in the Exercise text, such as a reference to a particular equation. I have tried using an overlay, as in my MWE, but the link is not working. In the MWE I have replaced the icon graphic file withe a text "?". The MWE is a bit lengthy (apologies), but I want to show that the other links are working – it is just the hint link that fails. The full document is over 600 pages! \documentclass{book} \usepackage{graphicx} \usepackage{tcolorbox} \tcbuselibrary{most} \usepackage{xparse} \usepackage{hyperref} % A simple hint environment \newcounter{hint} \newenvironment{hint} { \par\refstepcounter{hint}\medskip } { \par\medskip } % Key to store hint label \tcbset{ hint/.store in=\exercise@hintlabel, } % New exercise box, with a clickable hint box within \newtcolorbox[auto counter, number within=chapter]{exercise}[3][]{ #2, #3, enhanced, breakable, colback=white, colframe=blue!25!white, coltitle=black, boxrule=0.8pt, left=6pt, right=6pt, top=6pt, bottom=6pt, fonttitle=\bfseries, title={Exercise~\thetcbcounter\ifx#1\empty\else\ (#1)\fi}, overlay={ \ifx\exercise@hintlabel\empty\relax \else \node[ anchor=north east, xshift=0pt, yshift=0pt ] at (frame.north east) { \hyperlink{\exercise@hintlabel}{ \textbf{?} % \includegraphics[width=12pt]{hint-icon.eps} } }; \fi }, } \begin{document} \mainmatter \chapter{The Tutorial} \begin{equation} E = mc^{2} \label{eq_a} \end{equation} \vspace{10\baselineskip} \begin{exercise}[]{label={ex_1}}{hint={hint_ex_a}} Use Eqn.~\ref{eq_a} to find an expression for $m$. Click ``\textbf{?}'' for a hint. \end{exercise} \newpage {\textbf{Hints to Exercises}} \begin{hint} \label{hint_ex_a} \textbf{Exercise \ref{ex_1}} Try an algebraic manipulation. \end{hint} \end{document} How can I make the hint link work correctly?

  • Problem with multirow and booktabs in latex [duplicate]
    by Jane Roque on January 19, 2026 at 2:30 pm

    I think that the table is ok, but as you can see, the table is not complete. The first column is missing 2 titles: Alps and Iberian P., why do these not appear in the table? I thought that it was related to the rules (midrule), but that is not the issue. I am using the following: \documentclass[alpha-refs]{wiley-article} \begin{document} \usepackage{caption} \usepackage{graphicx} \usepackage{siunitx} \usepackage{subcaption} \usepackage{amsmath} \usepackage{booktabs} \usepackage{ragged2e} \usepackage{float} \usepackage{array} \usepackage{multirow} \begin{table}[h] \centering \begin{tabular}{ccccccc} \toprule \textbf{Region} & \textbf{Exp.} & \textbf{May} & \textbf{June} & \textbf{July} & \textbf{August} & \textbf{September} \\ \midrule \multirow{3}{*}{\textbf{Alps}} & CTRL & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & IRRI & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & ABS & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ %\cmidrule(l){2-7} \midrule \multirow{3}{*}{\textbf{Mediterranean}} & CTRL & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & IRRI & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & ABS & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ %\cmidrule(l){2-7} \midrule \multirow{3}{*}{\textbf{Iberian P.}} & CTRL & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & IRRI & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & ABS & 0.12* & 0.14* & 0.29* & 0.29* & 0.16* \\ %\cmidrule(l){2-7} \midrule \multirow{3}{*}{\textbf{Mid-Europe}} & CTRL & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & IRRI & -0.08 & 0.24* & -0.40* & -0.32* & -0.35* \\ & ABS & 0.01* & -0.13* & -0.18* & -0.02* & 0.04* \\ \bottomrule \end{tabular} \end{table} \end{document} What I am doing wrong?

  • How to make footnote rule appear later in the slide?
    by Arya1050 on January 19, 2026 at 2:16 pm

    I want to make the footnote rule to appear just as the marking text for the first footnote appears on the slide, along with the footnote. I saw this post, where the answer provided only works on a particular slide. But the poster also asked for an automatic solution, which isn't provided there. Essentially, I want a solution that can be written before the main document begins, that is, in the preamble. I could do it manually as in that post, but doesn't hurt to have a shorter, cleaner solution. Can someone provide the automatic solution, or there isn't any? The MWE is the same as the one in the post linked above. Sorry, if there are any mistakes while making this post. This is my first time.

  • qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" while trying to run `miktex-console`
    by lokit khemka on January 19, 2026 at 2:16 pm

    When I am trying to run miktex-console, I keep getting the following error: qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Aborted (core dumped) I tried running miktex packages update and then runnning miktex-console, however, it doesn't fix the issue. I tried uninstalling and reinstalling mixtex multiple times. I even removed the existing qt installation, however the error has not gone away. Please help how I can fix this? EDIT: I am trying to install it on Pop OS 22.04 and I followed the instructions for Ubuntu 22.04 from the MikTex website.

  • The entry References in TOC must be upper case (abntex2)
    by Arley Antes on January 19, 2026 at 1:46 pm

    \documentclass[chapter=TITLE, twoside]{abntex2} \usepackage{filecontents} \begin{filecontents*}{\jobname.bib} @ARTICLE{example, author = {Other, Anthony Norman}, title = {Some things I did}, year = {2014}, journal = {J.~Irrep. Res.}, volume = {1}, number = {1}, pages = {1-10} } \end{filecontents*} \usepackage{csquotes} \usepackage[backref=true, style=abnt]{biblatex} \addbibresource{\jobname.bib} \usepackage{blindtext} \begin{document} \tableofcontents* \chapter{Introdução} \blindtext[2] \cite[15]{example} \chapter{Desenvolvimento} \blindtext[2] \cite[30]{example} \chapter{Conclusão} \blindtext[2] \cite[45]{example} \printbibliography[] \end{document} The entry "Referências" should be upper case too. I've looked into the abntex2 documentation, but couldn't find anything that could help me.

  • Slide without overlays on notes [duplicate]
    by GrB on January 19, 2026 at 11:01 am

    I'm confused about how notes work in Beamer presentations. I would like my second screen (e.g. laptop) to display the full slide without overlays, while the main screen (projector) display the slide with overlays. Basically, I would like to achieve this: \documentclass[aspectratio = 169]{beamer} \setbeameroption{show notes on second screen=right} \begin{document} \begin{frame} \begin{itemize} \item<1-> Some text. \item<2-> More text. \item<3-> Final text. \end{itemize} \note{ \begin{itemize} \item Some text. \item More text. \item Final text. \end{itemize} } \end{frame} \end{document} But isn't there a simpler way to do this? I have not been able to find anything.

  • How to calculate the percentage of a filtered list using LaTeX3?
    by lukascbossert on January 19, 2026 at 9:50 am

    In continuation of How to add/calculate integers that are coming from a macro using LaTeX3? I’d like to go on an calculate the percentage of a given position and gender. The data is coming from a datatool-database and is processed using a combination of expl3-Syntax and e.g. \DTLforeach*. I get the total amount of positions but I am stuck when it comes to the point to get the percentage of e.g. f for PostDoc. My approach is to modify \dfgTotalPosition{<POSITION>} in that regard that by default it prints the result, when I add an optional argument it would store the result to a macro and not print it: \dfgTotalPosition{<POSITION>}[<MACRO>] \NewDocumentCommand{\dfgTotalPosition}{ O{mydb} m o} { % Reset the total \int_zero:N \l__dfg_total_int \clist_map_inline:nn {f,m,d} {\dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {##1} \int_add:Nn \l__dfg_total_int { \l__dfg_tmp_int }} \IfNoValueTF { #3 } % = the optional macro name { % no macro supplied → print the total \int_use:N \l__dfg_total_int } { % macro supplied → store the total in cs \int_set_eq:Nc { \l__dfg_total_int } #3 } } So, with this I was aiming that \dfgTotalPosition{PostDoc}[totalposPostDoc] would give me \totalposPostDoc that I can use anywhere in my text. But it results to ! Missing number, treated as zero. <to be read again> \global l.131 ...fgTotalPosition{PostDoc}[totalposPostDoc] Furthermore I want to calculate the percentage of a given position in relation to its gender. Since \int_set requires a non-expanable integer expression I would use the optional argument of the macro \dfgTotalPosition (If this is also not possible since it requires also "expansion" then the fallback would be hardcoding the positions to get for all positions a macro: \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] ) \NewDocumentCommand{\dfgGenderPercent}{ O{person} m m } { % #1: database % #2: position % #3: gender \dfgTotalPosition{#2}[l__tmp_percent_#2_int] % alternative: % \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] % \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] % --- total number of persons for this position ----------------- \int_set:Nn \l__dfg_total_int { \use:c {l__tmp_percent_ #2 _int} } % alternative: % \str_case_e:nn{#1}{ % {PhD} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PhD_int}} % {PostDoc} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PostDoc_int}} % } % --- number of the requested gender --------------------------- \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1}{#2}{#3} % --- avoid division by zero ---------------------------------- \int_compare:nNnTF { \l__dfg_total_int } = { 0 } { 0 } % nothing to divide { % --- integer percentage (rounded) ------------------------ \int_set:Nn \l__dfg_percent_int { \fp_eval:n {round( 100 * \l__dfg_tmp_int / \l__dfg_total_int )} } % print the integer together with the percent sign \int_use:N \l__dfg_percent_int } } Here is a complete MWE \documentclass{article} \usepackage{expl3} \usepackage{datatool} \ExplSyntaxOn \int_new:N \l__dfg_count_int \int_new:N \l__dfg_total_int \int_new:N \l__dfg_tmp_int % Internal "setter": % \dfg_count_position_set:Nnnn <int> {<db>} {<position>} {<gender>} % Computes the count and stores it in the integer variable <int>. \cs_new_protected:Npn \dfg_count_position_set:Nnnn #1#2#3#4 { % Reset the counter \int_zero:N \l__dfg_count_int % Loop over the database and apply the filters \DTLforeach* [ \DTLiseq{#3}{\pPosition} \and \DTLiseq{#4}{\pGender} \and \DTLisinlist{PI}{\pRole} ] {#2} { \pID=id, \pPosition=position, \pPeriod=period, \pGender=gender, \pRole=role } { % Increment for each matching record \int_incr:N \l__dfg_count_int } % Store the result in the requested integer variable \int_set_eq:NN #1 \l__dfg_count_int } % User-level command: prints the count \NewDocumentCommand{\dfgCountPosition}{ O{mydb} m m } { \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {#3} \int_use:N \l__dfg_tmp_int } % Total for the three genders (f + m + d) for a given position \NewDocumentCommand{\dfgTotalPosition}{ O{mydb} m o} { % Reset the total \int_zero:N \l__dfg_total_int \clist_map_inline:nn {f,m,d} {\dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1} {#2} {##1} \int_add:Nn \l__dfg_total_int { \l__dfg_tmp_int }} \IfNoValueTF { #3 } % #1 = the optional macro name { % no macro supplied → print the total \int_use:N \l__dfg_total_int } { % macro supplied → store the total in cs \int_set_eq:Nc { \l__dfg_total_int } #3 } } \NewDocumentCommand{\dfgGenderPercent}{ O{person} m m } { % #1: database % #2: position % #3: gender \dfgTotalPosition{#2}[l__tmp_percent_#2_int] % alternative: % \dfgTotalPosition{PostDoc}[l__tmp_percent_PostDoc_int] % \dfgTotalPosition{PhD}[l__tmp_percent_PhD_int] % --- total number of persons for this position ----------------- \int_set:Nn \l__dfg_total_int { \use:c {l__tmp_percent_ #2 _int} } % alternative: % \str_case_e:nn{#1}{ % {PhD} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PhD_int}} % {PostDoc} {\int_set:Nn \l__dfg_total_int {\l__tmp_percent_PostDoc_int}} % } % --- number of the requested gender --------------------------- \dfg_count_position_set:Nnnn \l__dfg_tmp_int {#1}{#2}{#3} % --- avoid division by zero ---------------------------------- \int_compare:nNnTF { \l__dfg_total_int } = { 0 } { 0 } % nothing to divide { % --- integer percentage (rounded) ------------------------ \int_set:Nn \l__dfg_percent_int { \fp_eval:n {round( 100 * \l__dfg_tmp_int / \l__dfg_total_int )} } % print the integer together with the percent sign \int_use:N \l__dfg_percent_int } } \ExplSyntaxOff \begin{filecontents*}[overwrite]{mydata.csv} id,position,period,gender,role 1,PostDoc,"2,3",f,PI 2,PostDoc,"1,2,3",m,PI 3,PostDoc,2,f,PI 4,PostDoc,3,d,PI 5,GroupLeader,3,m,PI 6,GroupLeader,2,f,PI 7,GroupLeader,3,m,PI 8,GroupLeader,2,d,PI 9,PhD,3,f,PI 10,PhD,2,m,PI 11,PostDoc,3,f,PI \end{filecontents*} % Load the CSV into a datatool database named "mydb" \DTLloaddb{mydb}{mydata.csv} \begin{document} Females among PostDocs: \dfgCountPosition{PostDoc}{f}\par Males among PostDocs: \dfgCountPosition{PostDoc}{m}\par Diverse among PostDocs: \dfgCountPosition{PostDoc}{d}\par All PostDocs (f/m/d): \dfgTotalPosition{PostDoc}\par All GroupLeaders (f/m/d): \dfgTotalPosition{GroupLeader}\par All PhDs (f/m/d): \dfgTotalPosition{PhD}\par Total Pos: \dfgTotalPosition{PostDoc}[totalposPostDoc] % not working \dfgGenderPercent{PostDoc}{f} % < requires the optional argument of `\dfgTotalPosition{}[]` \end{document}

  • ConTeXt: How to set different interlinespace for footnotes when serried and in paragraph form
    by Jeff Dodson on January 19, 2026 at 4:19 am

    I'm using footnotes in run-on paragraph form (i.e., alternative=serried, paragraph=yes, location=page), and I'd like to set a different interlinespace for my footnotes, compared to my main text. I saw the following MWE on this forum, which works for footnotes that are not in paragraph form: % Source - https://tex.stackexchange.com/a/398721 % Posted by Henri Menke % Retrieved 2026-01-18, License - CC BY-SA 3.0 \setuplayout[grid=yes] \setupinterlinespace[line=5ex] \startsetups[footnote:interlinespace] \setupinterlinespace[line=2.5ex] \stopsetups \setupnote [footnote] [ setups=footnote:interlinespace, alternative=serried, %paragraph=yes, %location=page ] \starttext \input knuth\footnote{\input knuth }\footnote{And another footnote.} \stoptext This produces the following output: This is exactly the type of effect I'd like to see in my run-on paragraph notes. However, if I modify that MWE to use paragraph notes (by just uncommenting the two commented lines), like this: \setuplayout[grid=yes] \setupinterlinespace[line=5ex] \startsetups[footnote:interlinespace] \setupinterlinespace[line=2.5ex] \stopsetups \setupnote [footnote] [ setups=footnote:interlinespace, alternative=serried, paragraph=yes, location=page ] \starttext \input knuth\footnote{\input knuth }\footnote{And another footnote.} \stoptext Then here's what I see instead: So I get my notes in true paragraph form, but the interlinespace returns to the same distance that's used in the main text. Is there a way to fix this so that I can have my footnotes in a run-on paragraph, and also set a custom interlinespace?

  • When last chapter ends on right-hand page, how to empty the final left-hand page?
    by Gary on January 19, 2026 at 3:24 am

    When the last chapter ends on a right-hand page, there is still a left-hand page printed with a header. How can this be changed to an empty page? Everything I find to try affects the pagebreak of starting a chapter but not how to end it. Thank you. The document structure is that the first chapter starts on the right-hand page using \startbodymatter[page=right] and subsequent chapters start on a new page, right or left using: \definepagebreak [ChapterPageBreak] [yes] \setuphead [chapter][ page=ChapterPageBreak, header=empty, footer=chapter, numbercommand=\sc, command=\MyChapter, after=\blank[0.5ex], conversion=romannumerals] Not finding a simple method, I tried to modify the Modifying the page before a chapter example at https://wiki.contextgarden.net/Command/setupsectionblock in the after option of the bodymatter to look back at the last chapter to determine what page it ended on. It changes the previous pages background color but I need to empty the current page of header/footers. In this example, the objective is to empty page six. Thank you. \startsetups [LastChapter] \doifoddpageelse {\pushbackground[page] \setupbackgrounds[page][background=color,backgroundcolor=gray] \page[left] \popbackground} {} \stopsetups \setuppagenumbering[alternative=doublesided,location=] \starttext \startbodymatter[page=right,after=\directsetup{LastChapter}] \definepagebreak [ChapterPageBreak] [yes] \setuphead [chapter][ page=ChapterPageBreak, header=empty, footer=chapter] \settextcontent[header][text] [middletext][chapter][chapter] \setuptexts [header][text] [Ch.\ \getmarking[chapternumber][first].][pagenumber][pagenumber][Ch.\ \getmarking[chapternumber][first].] \setupheader[text][ leftstyle=\sc, after={\hrule height 0.8pt} ] \startchapter [ title={First Chapter}, marking={First Chapter}, ] \dorecurse {15} { \samplefile{ward} } \stopchapter \startchapter [ title={Second Chapter}, marking={Second Chapter}, ] \dorecurse {25} { \samplefile{ward} } \stopchapter \stopbodymatter \stoptext I made this way too difficult. All the \startsetups and related can be deleted and add the following just before the \stopchapter of chapter 2. \doifoddpageelse { \page[left] \setupheader [state=stop] % or [state=high] } {} There may be a better way, of course. Thanks.

  • How to hide the word chapter [closed]
    by Éric F on January 19, 2026 at 1:21 am

    First install the titlesec package \usepackage{titlesec} Add this one line to the preamble \titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{}

  • How to deal with german umlauts and hyphenation in plain?
    by MBE on January 18, 2026 at 11:58 pm

    Has anyone an idea, how to solve this problem? I know, that plain is oldfashioned.. I will post my solution later, if it works. \parindent0pt % \hyphenation{ %Pro-blem % Mü-he %not working %Müh-sal %not working %öff-ent-lich %not working % } \hyphenation{ Pro-blem Mue-he %old fashioned Mueh-sal %old fashioned oeff-ent-lich %old fashioned } % \hyphenation{ % Pro-blem %M\"u-he %not working % M\"uh-sal %not working % \"off-ent-lich %not working %} \hbox{ \vtop{\hsize2cm Das Problem macht viel Mühe, aber muß die Mühsal sein? Plain ist veraltet, ich weiss, aber ich möchte es wissen. Man kann doch mal öffentlich fragen. } \hskip2cm \vtop{\hsize2cm Das Problem macht viel Muehe, aber muß die Muehsal sein? Plain ist veraltet, ich weiss, aber ich moechte es wissen. Man kann doch mal oeffentlich fragen. } \hskip2cm \vtop{ \hsize2cm Das Problem macht viel M\"u\-he, aber muß die M\"uh\-sal sein? Plain ist veraltet, ich weiss, aber ich m\"och\-te es wissen. Man kann doch mal \"off\-ent\-lich fragen. } } \bye

  • What is the meaning of lualatex returning 139 sporadically
    by user2609605 on January 18, 2026 at 11:10 pm

    In the last time i face return value 139 quite frequently. The log looks as if the process died without any warning. ... seems to have to do with fonts... It seems to occur only in conjunction with tagging. But as the problem is not reproducible, i am not really sure about that. It seems to occur on large files but also on small ones. End of some log file looks like that: Floatstructure:4383 (./F5_08depy2out.ptx <F5_08depy2out.pd seems to be about to write to a pdf. The ptx is a tex file covering some pdf. I try to collect further examples of log files. And I try to wait until the problem occurs again with a smaller tex file. Be patient and do not close please. Any idea even without MWE?

  • Define a font by file rather than by name?
    by Gary on January 18, 2026 at 10:13 pm

    I'm trying to follow pages 51-52 of the book Fonts out of ConTeXt to define a font by file: rather than name:; but I must be overlooking something. The path to the font file is /home/gary/programs/context/context-linux-64/tex/texmf/fonts/data/gust/tex-gyre/termes/texgyretermes-​regular.​otf By-name works as: \definefont[Times][name:texgyretermesregular*default at 11pt][line=2.8ex] But by-file does not load. \definefont[Times][file:texgyretermes-​regular.​otf*default at 11pt][line=2.8ex] I did not see an error in the CLI output but the font remains the body font when declared as \Times in an environment within the body. All I did was toggle between commenting the \definefont lines and did not change the body at all. One time the font loads, the other it does not. Thank you. Below is the result of mtxrun --script font --list --all termes and you have to scroll right to see the filename column. I guess I didn't read far enough to the next section that reads The first two columns mention the names that we can use to access a font. This explains why using only texgyretermes loads bold. But I do not understand the meaning of file versus name. identifier familyname fontname filename subfont instances texgyretermesbold texgyretermes texgyretermesbold texgyretermes-bold.otf texgyretermesbolditalic texgyretermes texgyretermesbolditalic texgyretermes-bolditalic.otf texgyretermesitalic texgyretermes texgyretermesitalic texgyretermes-italic.otf texgyretermesmath texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesmathcompanion texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathcompanionnormal texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathcompanionregular texgyretermesmathcompanion texgyretermesmathcompanionregular TeXGyreTermesMathCompanion-Regular.otf texgyretermesmathnormal texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesmathregular texgyretermesmath texgyretermesmathregular texgyretermes-math.otf texgyretermesnormal texgyretermes texgyretermesitalic texgyretermes-italic.otf texgyretermesregular texgyretermes texgyretermesregular texgyretermes-regular.otf

  • What's the purpose of p@question in the exam class?
    by Bananguin on January 18, 2026 at 9:52 pm

    I am looking to make more out of the exam class than ever before. Experimenting with it and reading its code, I have to admit that even after all these years, there is a lot about (la)tex that I do not understand. For instance, I found \def\thequestiontitle{\csname p@question\endcsname \csname thequestion\endcsname} The fine manual tells us what \thequestion is and does, but there isn't any information about \p@question. What does it do? I would guess it is for the inclined reader to \def p@question in order to add some formatting to \thequestiontitle. This does seem a bit redundant to \qformat. What is the purpose of \p@question?

  • Why is this legend incorrectly showing a marker which is disabled for this plot?
    by TobiBS on January 18, 2026 at 9:12 pm

    I have this simple plot, but the legend incorrectly shows the marker which I disabled with mark=none, why is that and how can I prevent it to be shown in the legend? \documentclass{standalone} \usepackage{pgfplots} \usepackage{filecontents} \begin{filecontents*}{data.csv} 0,100 100,0 \end{filecontents*} \begin{document} \begin{tikzpicture} \begin{axis} \addplot table [mark=none,color=blue,col sep=comma] {data.csv}; \addlegendentry{Why this marker?} \addplot[mark=x,color=red] coordinates {(0,0) (100,100)}; \addlegendentry{These marks are OK} \end{axis} \end{tikzpicture} \end{document}

  • Is there a "hook" to expand a macro after the end of a path in TikZ?
    by Rmano on January 18, 2026 at 7:33 pm

    I am adding a new feature to circuitikz to simplify the usage of "user-defined" voltages (and currents and "flow"s). The question is not specific to circuitikz, although the MWE is — sorry for the complication. If I manage a smaller MWE I'll post here. The basic question is: when a TikZ \path command is processed (and a \draw, etc., which are basically the same), is it possible to add a hook to be expanded at the end of it? I mean, after the final ; is found. In the following MWE, I would like to add some code to the addcall key so that I do not need to add the final \DoAdvVoltages. Ideally, the macro should be called after each path is finished, but calling it before the end of the environment would be acceptable. In order of preference, the solution should: call \DoAdvVoltages at every end of the path, when in the path the to[..., addcall=...] is used; if that's not possible, call \DoAdvVoltages at the end of the tikzpicture, in every tikzpicture where at least one path used the addcall key; if that's not possible, call the \DoAdvVolteges at the end of every tikzpicture. The solution should be engine-independent (well, it should work in the engines supported by TikZ, basically LaTeX and ConTeXt). Option 3 is easy in LaTeX, I do not know if it's as easy in ConTeXt. Option 2 could be achievable in LaTeX: add a one-shot hook at env/tikzpicture/end the first time it's called, protected by an if, from the .code itself — I'm not sure if this is a use-case possible in the current hook code, I'll dig into it when I have time, but it would be an acceptable answer (Is \AddToHookNext what I'm looking for here?). \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[RPvoltages]{circuitikz} % just an example \ctikzset{voltage=raised, !v sym/.style={no v symbols}} \newcommand{\placesigns}[2]{% place the +- signs at a fixed distance \path (#1voltage.center) ++(-\ctikzgetdirection{#1}:0.5cm) node[]{$+$}; \path (#1voltage.center) ++(180-\ctikzgetdirection{#1}:0.5cm) node[]{$-$}; } % add a command queue to circuitikz \makeatletter \gdef\local@voltages{} \def\addcommand#1#2{%add to \commands the macro \#1{nodename}{#2} \begingroup \edef\@@name{\ctikzvalof{bipole/name}} \edef\@@temp{% \noexpand\pgfutil@g@addto@macro\noexpand\local@voltages{% \expandafter\noexpand\csname #1\endcsname {\@@name}{#2}% }% }% \@@temp \endgroup } \def\DoAdvVoltages{\local@voltages\relax\gdef\local@voltages{}\ctikz@hook@setfalse} \makeatother % This works, but just for LaTeX (or not?) % Moreover, I'd like to add this from the addcall keys, so that % I don't call it for *every* tikzpicture! % \AddToHook{env/tikzpicture/end}{\DoAdvVoltages} \ctikzset{addmyv/.style = {v={#1}, !v sym, addcall={#1}}} \ctikzset{addcall/.code ={\addcommand{placesigns}{#1}}} \begin{document} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \DoAdvVoltages \end{tikzpicture} \end{document} A partial solution (the option 2 above) could be something like this, that seems to work: \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[RPvoltages]{circuitikz} % just an example \ctikzset{voltage=raised, !v sym/.style={no v symbols}} \newcommand{\placesigns}[2]{% place the +- signs at a fixed distance \path (#1voltage.center) ++(-\ctikzgetdirection{#1}:0.5cm) node[]{$+$}; \path (#1voltage.center) ++(180-\ctikzgetdirection{#1}:0.5cm) node[]{$-$}; } % add a command queue to circuitikz \makeatletter \newif\ifctikz@hook@set\ctikz@hook@setfalse \gdef\local@voltages{} \def\addcommand#1#2{%add to \commands the macro \#1{nodename}{#2} \begingroup \edef\@@name{\ctikzvalof{bipole/name}} \edef\@@temp{% \noexpand\pgfutil@g@addto@macro\noexpand\local@voltages{% \expandafter\noexpand\csname #1\endcsname {\@@name}{#2}% }% }% \@@temp \endgroup } \def\DoAdvVoltages{\local@voltages\relax\gdef\local@voltages{}% \typeout{EXECUTE DoAdv} \global\ctikz@hook@setfalse } \def\ctikz@set@hook{% \ifctikz@hook@set \else \global\ctikz@hook@settrue % I have no idea if I can do this in context/plain... \ifpgfutil@format@is@latex \typeout{EXECUTE AddToHookNext} \AddToHookNext{env/tikzpicture/end}{\DoAdvVoltages}% \fi \fi } \ctikzset{addcall/.code ={\addcommand{placesigns}{#1}\ctikz@set@hook}} \makeatother % This works, but just for LaTeX (or not?) % \AddToHook{env/tikzpicture/end}{\DoAdvVoltages} \ctikzset{addmyv/.style = {v={#1}, !v sym, addcall={#1}}} \begin{document} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \end{tikzpicture} \begin{tikzpicture} \draw (3,0) -- ++(1,0) coordinate(Rbot) to[R=R, name=vR, addmyv={$u_R$}] ++(0,+3) -- ++(-1,0); \draw (Rbot) -- ++(2,0) coordinate(Cbot) to[C=C, name=vC, addmyv={$u_C$}] ++(0,+3) -- ++(-2,0); \draw(Cbot) to [L=L, name=vL, addmyv={$u_L$}] ++(2,0); \end{tikzpicture} \end{document} But clearly, this is not valid (I think) for ConTeXt at all.

  • "Not in outer par mode" errors on intermediate compilations that resolve on later passes
    by RLH on January 18, 2026 at 7:07 pm

    I have a long document (600+ pages) that has been using \clearpage and \afterpage to force some page breaks and figure placement, and breakable tcolorboxes as example environments. This document occasionally gets into states where a fresh compile of the document completes without errors, the second compilation fails with ! LaTeX Error: Not in outer par mode. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.128 \clearpage and the third and subsequent compilations succeed. Based on comments on my closed question \clearpage causes "not in outer par mode error" on second pass, I've found ways to reduce the use of \afterpage and to use non-float objects that otherwise behave like figures when I do need \afterpage, and have also tracked down my specific problem to an interaction between Floats in afterpage. Special footnote handling that uses shipout to move the footnote outside of the box. The presence of a long table of contents. (see demonstration code below) -- While I now understand more about what source-code patterns can produce these errors, I would stil like to better understand how the processing of the document leads to the specific error behavior. The error message (and other documentation of when the error is expected to appear) seems to indicate that the compiler is reading a \clearpage command at a point in the document which some internal state variable registers as being inside of a float. Combined with this error appearing on the second pass (when the TOC moves pages around) and its absence if the \tableofcontents call is removed, a parsimonious interpretation would be that either the location of the page breaks forced by \clearpage or the page numbers on which the floats appear are being retained from the previous pass, and so are triggering the error, even though \clearpage command does not appear inside float environment in the source code. Once the page locations have stabilized, the error goes away. Comments on my previous question suggested that this is not the correct model for how the error plays out at compilation time. What is a better way to understand the behavior of these kinds of errors that show up on intermediate compilations, but go away if I compile enough times? -- Code for generating the kind of errors that I'm encountering. This document should compile successfully on the first pass, error three times on the second and third passes, and then compile correctly on subsequent passes. \documentclass[11pt]{book} \usepackage{afterpage} \usepackage[many]{tcolorbox} \tcbuselibrary{magazine} % Not directly relevant here, but gets me a foreach function for the examples %%%%%%%% %%%%%%%% % Code for typesetting footnotes from tcolorboxes outside of the box, and in the main footnote sequence \newif\iffootaux \newcounter{footaux}% for \csname \newcounter{auxpage}% to handle frontmatter etc. \setcounter{auxpage}{1} \makeatletter \def\footnoteaux{\@ifnextchar[\@xfootnoteaux{\stepcounter{footnote}% \footnotemark[\thefootnote]\@footaux[\thefootnote]}} \def\@xfootnoteaux[#1]{\footnotemark[#1]\@footaux[#1]} \def\footaux{\@ifnextchar[\@footaux{\@footaux[\thefootnote]}} \def\@footaux[#1]#2{\protected@write{\@auxout}{\let\theauxpage\relax}{\string\newfootnote{\theauxpage}{#1}{#2}}} \newcommand{\newfootnote}[3]{% #1 = \theauxpage, #2 = \thefoontnote, #3 = text \ifnum#1=1\relax \footnotetext[#2]{#3}% \else \stepcounter{footaux}% \expandafter\xdef\csname footauxpage\thefootaux\endcsname{#1}% \expandafter\xdef\csname footauxnumber\thefootaux\endcsname{#2}% \expandafter\protected@xdef\csname footauxtext\thefootaux\endcsname{#3}% \fi} % to run at the end of every page (debug version) \newcommand{\addfootaux}{\loop \@ifundefined{footauxpage\thefootaux}{\footauxfalse}{% \count1=\csname footauxpage\thefootaux\endcsname\relax \advance\count1 by -1 \ifnum\count1=\value{auxpage}% \expandafter\let\expandafter\footauxnumber\csname footauxnumber\thefootaux\endcsname \expandafter\let\expandafter\footauxtext\csname footauxtext\thefootaux\endcsname \footnotetext[\footauxnumber]{\footauxtext}% \footauxtrue \else \footauxfalse \fi} \iffootaux \global\expandafter\let\csname footauxpage\thefootaux\endcsname\relax \global\expandafter\let\csname footauxnumber\thefootaux\endcsname\relax \global\expandafter\let\csname footauxtext\thefootaux\endcsname\relax \stepcounter{footaux}% \repeat \stepcounter{auxpage}} \makeatother \AtBeginDocument{\setcounter{footaux}{1}}% reset counter after \newfootnote \AddToHook{shipout/after}{\addfootaux} %%%%%%%% %%%%%%%% \newtcbtheorem[number within=section, number freestyle={\noexpand\thesection.\noexpand\arabic{\tcbcounter}}]{example}{Example}{ detach title, before upper={\tcbtitle.\quad \let\footnotetext=\footaux \let\footnote=\footnoteaux }, enhanced jigsaw, sharp corners, frame hidden, lines before break=4, borderline west={.5pt}{3pt}{black}, right=0pt, toprule=0pt, rightrule=0pt, bottomrule=0pt, leftrule=.5pt, colback=white, colframe=black, breakable=true, opacityback=0, colbacktitle=white, opacitybacktitle=0, coltitle=black, titlerule=0pt, fonttitle=\bfseries, parbox=false, label type=example, }{exp} % Demonstration text \usepackage{lipsum} % Credit to musarithmia for Sator square % https://tex.stackexchange.com/a/208857 % Retrieved 2026-01-17, License - CC BY-SA 3.0 \newcommand{\satorsquare}{ {\huge\bfseries%\hfil% \begin{tabular}{|c|c|c|c|c|} \hline S & A & T & O & R\\ \hline A & R & E & P & O\\ \hline T & E & N & E & T\\ \hline O & P & E & R & A\\ \hline R & O & T & A & S\\ \hline \end{tabular}}} \begin{document} \title{Afterpage hammering to cause crash} \maketitle \tableofcontents % Generate enough text that the table of contents moves things across pages \foreach \n in {1,...,35} { \section{C} \lipsum[\n]%\footnote{This is a footnote from outside an example} } % Generate progressively longer examples with afterpaged figures \foreach \n in {1,...,3} { \typeout{On Example \n} % Put a float into an afterpage \afterpage{ \begin{figure} {\centering \satorsquare{} \caption{figure}{This is a Sator square} \label{fig:onesatorsquare\n} } \end{figure} } % Force a clearpage \clearpage % Typeset text in a breakable tcolorbox \begin{example}{Example}{exp\n} \lipsum[1-3] \lipsum[\n-\n+\n] \end{example} } % Generate progressively longer examples with afterpaged figures and footnotes handled with shipout \foreach \n in {1,...,3} { \typeout{On Example 3+\n} % Put a float into an afterpage \afterpage{ \begin{figure} {\centering \satorsquare{} \caption{figure}{This is a Sator square} \label{fig:onesatorsquare\n} } \end{figure}} % Force a clearpage \clearpage % Typeset text in a breakable tcolorbox with a footnote that is placed outside the box \begin{example}{Example}{exp\n} \lipsum[1-3]\footnote{This is a footnote from inside an example} \lipsum[\n-\n+\n] \end{example} } \end{document}

  • Inconsistent line thickness of \frac and \overline in PDF [closed]
    by The Little Blue Man on January 18, 2026 at 5:11 pm

    My problem Some of the lines in the PDF of my LaTeX document are different thicknesses. This applies to lines generated using the commands frac, \overline and underline (I'm not sure about the latter). Sometimes the thickness is correct, and sometimes it is much too thick. The thickness varies throughout the document and depending on the zoom level. My main issue is that it persists after printing the document. This problem don't affect lines generated by \rule or \hline. Here is an example: Some details I use LuaLaTeX. I use TexLive on Linux. Here are the packages I use: % Mandatory: \usepackage[french]{babel} \usepackage{graphicx} % — Maths — \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{stmaryrd} % - Addition of the mathscr font \usepackage[scr]{rsfso} \usepackage{fontspec} \usepackage{unicode-math} % Misc \usepackage{comment} \usepackage{geometry} \usepackage{titlesec} \usepackage[shortlabels]{enumitem} \usepackage{calc} \usepackage{lipsum} I use Latin Modern Math as my math font. What I have tried I tried several things that did not solve the issue: redefining \frac with \genfrac{}{}{0.4pt}{} I also tried adding the line '\fontdimen3\textfont3=0.4pt' (on the order of ChatGPT). I tried changing the maths font. Code that generate the problem \documentclass[12pt]{article} \title{Test} % --- Mandatory --- \usepackage[french]{babel} % --- Maths --- \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{stmaryrd} \usepackage[scr]{rsfso} \usepackage{fontspec} \usepackage{unicode-math} % ---- Fonts --- \setmathfont{Latin Modern Math} \setmathfont{STIX Two Math}[ % Utilisation de STIX Two uniquement pour mathbb range=bb, Scale=MatchUppercase ] \setmathfont{STIX Two Math}[ % Utilisation de STIX Two uniquement pour \varnothing range={\varnothing}, Scale=MatchUppercase ] \setmathfont{rsfso10}[ % Utilisation de rsfso10 uniquement pour mathscr range=scr, Scale=MatchUppercase ] \begin{document} \begin{align*} \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \frac{a}{b} & & \overline{A} \\ \end{align*} \end{document}

  • Reproducing figures with shaded half-planes in a gray square box
    by Sebastiano on January 18, 2026 at 4:43 pm

    I am trying to reproduce some images from old lecture notes, in particular notes by Prof. Gorni dating back to the 1993/94 academic year (pag. 4), or in other notes, like this picture At that time I had no knowledge of LaTeX at all. I do not know whether those figures were produced using PSTricks or with XFig/WinFig via psfrag, but my goal is to reproduce them in TikZ, correctly coloring the relevant half-planes. I am not completely sure whether it is possible (or appropriate) to modify the domain by introducing a square with a gray background or a path, but I have nevertheless quickly put together a minimal working example. \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{arrows.meta,decorations.markings,backgrounds} \usepackage{geometry} \geometry{margin=2.5cm} \begin{document} \begin{center} \begin{tikzpicture}[scale=1.5] \draw[->] (-0.2,0) -- (2,0) node[right] {$x$}; \draw[->] (0,-0.2) -- (0,2) node[above] {$y$}; \def\a{1.75} \begin{scope}[on background layer] \fill[gray!25] (-\a,\a) -- (\a,\a) -- (\a,-\a) -- (-\a,\a) -- cycle; \end{scope} \draw[thick,white] (-\a,-\a) rectangle (\a,\a); \draw[thick] (-1.5,1.5) -- (1.5,-1.5); \node at (-1.25,0.55) {$y=-x$}; \draw[thick] ({sqrt(2)},0) arc (0:90:{sqrt(2)}); \fill (0,{sqrt(2)}) circle (0.6pt); \fill ({sqrt(2)},0) circle (0.6pt); \node[left] at (0,{sqrt(2)}) {$\left(0,\sqrt{2}\right)$}; \node[below] at ({sqrt(2)},0) {$\left(\sqrt{2},0\right)$}; \end{tikzpicture} \end{center} \end{document} The problems I am facing (also because I have never attempted anything like this before) are the red rectangles (I wonder if there is a simple option to place the arc vector in a central position):

  • For a simple math book, is it acceptable for the document background to be a color? [closed]
    by raulevm on January 18, 2026 at 2:01 pm

    \documentclass[twoside]{book} \usepackage[spanish]{babel} %----------------------------------------------------------------------------------------------------------------------- \usepackage[outer=0.625in, inner=0.875in, top=0.625in, bottom=0.75in]{geometry} %----------------------------------------------------------------------------------------------------------------------- \usepackage{tcolorbox} % %\definecolor{bg}{HTML}{E7E7E7} \definecolor{bg}{HTML}{E7E2DD} \definecolor{pbg}{HTML}{D4C3BB} \pagecolor{bg} %----------------------------------------------------------------------------------------------------------------------- \usepackage{titlesec} %\usepackage{titletoc} % \titleformat{\part}[display] {\sffamily\Huge\bfseries\centering} {\titleline{\titlerule}\vspace{1ex}\MakeUppercase{\partname\ \Roman{part}}} {1.5em} {\LARGE} [\vspace{1ex}\titleline{\titlerule}\clearpage] \titlespacing*{\part}{0pt}{4cm}{3cm} % \titleformat{\chapter}[display] {\sffamily\huge\bfseries\centering} {\chaptertitlename\ \Roman{chapter}} {2em} {\Huge} [\vfill\clearpage] % \titleformat{\section} {\sffamily\Large\bfseries}{\thesection}{1em}{} % \titleformat{\subsection} {\sffamily\large\bfseries}{\thesubsection}{1em}{} % \titleformat{\subsubsection} {\sffamily\normalsize\bfseries}{\thesubsubsection}{1em}{} %----------------------------------------------------------------------------------------------------------------------- \usepackage{tocloft} % \renewcommand{\cftchapfont}{\sffamily\bfseries} \renewcommand{\cftsecfont}{\sffamily} \renewcommand{\cftsubsecfont}{\sffamily} % \renewcommand{\cftsecaftersnum}{)} \renewcommand{\cftsubsecaftersnum}{)} \renewcommand{\cftsubsubsecaftersnum}{)} \renewcommand{\cftparaaftersnum}{)} \renewcommand{\cftsubparaaftersnum}{)} % \setlength{\cftsecnumwidth}{2.5em} \setlength{\cftsubsecnumwidth}{3.5em} \setlength{\cftsubsubsecnumwidth}{4.5em} %----------------------------------------------------------------------------------------------------------------------- \usepackage{unicode-math} % \setmainfont{texgyreadventor}[ UprightFont=*-regular, ItalicFont=*-italic, BoldFont=*-bold, BoldItalicFont=*-bolditalic ] % \setsansfont{Palmont-Regular}[ Path=../Fonts/, Extension=.otf, Scale=MatchUppercase ] % \setmonofont{BodoniC}[ Path=../Fonts/, Extension=.otf, UprightFont=*-Regular, ItalicFont=*-Italic, BoldFont=*-Bold, BoldItalicFont=*-BoldItalic, Scale=MatchLowercase ] % \setmathfont{OldStandard-Math} \setmathfont{texgyreschola-math}[range={\lgroup,\rgroup}] \setmathfont{texgyretermes-math}[range={\in,\notin,\forall,\exists}] \setmathfont{KpMath-Sans}[range=bb] \setmathfont{BodoniC-Regular}[Path=../Fonts/,Extension=.otf,range=up/num] \setmathfont{BodoniC-Italic}[Path=../Fonts/,Extension=.otf,range=it/{latin,Latin}] \setmathfont{OldStandard-Math}[range={}] % %----------------------------------------------------------------------------------------------------------------------- \usepackage{amsthm} \usepackage{thmtools} % \declaretheoremstyle[ headfont=\small\sffamily, headpunct={\hrulefill\\[1ex]}, headformat={% \tcbox[arc=1pt,sharp corners,rounded corners=west,boxsep=2pt,top=0.4pt,bottom=0.4pt,left=2pt,right=0pt,boxrule=0.4pt,colback=pbg,colframe=pbg,colupper=black]{\NAME}% \tcbox[arc=1pt,sharp corners,rounded corners=northeast,boxsep=2pt,top=0.4pt,bottom=0.4pt,left=0pt,right=0pt,boxrule=0.4pt,colback=black,colframe=black,colupper=bg]{\NUMBER}% } ]{problem-style} % \declaretheorem[ numberwithin=section, name=PROBLEMA, style=problem-style ]{problem} %----------------------------------------------------------------------------------------------------------------------- \AtBeginDocument{ \let\Rightarrow\implies \let\Leftrightarrow\iff \let\xland\wedge \renewcommand{\land}{\;\xland\;} \let\wedge\land \let\xlor\vee \renewcommand{\lor}{\;\xlor\;} \let\vee\lor } %----------------------------------------------------------------------------------------------------------------------- \renewcommand{\sin}{\operatorname{\symit{sen}}} \renewcommand{\cos}{\operatorname{\symit{cos}}} \renewcommand{\tan}{\operatorname{\symit{tg}}} \renewcommand{\arcsin}{\operatorname{\symit{arcsen}}} \renewcommand{\arccos}{\operatorname{\symit{arccos}}} \renewcommand{\arctan}{\operatorname{\symit{arctg}}} \renewcommand{\sinh}{\operatorname{\symit{senh}}} \renewcommand{\cosh}{\operatorname{\symit{cosh}}} \renewcommand{\tanh}{\operatorname{\symit{tgh}}} \renewcommand{\ln}{\operatorname{\symit{ln}}} \renewcommand{\log}{\operatorname{\symit{log}}} %----------------------------------------------------------------------------------------------------------------------- \usepackage{booktabs} \usepackage{caption} %----------------------------------------------------------------------------------------------------------------------- \usepackage{enumitem} %----------------------------------------------------------------------------------------------------------------------- \usepackage{multicol} % \setlength{\columnseprule}{.4pt} %----------------------------------------------------------------------------------------------------------------------- \usepackage{fancyhdr} % \pagestyle{fancy} \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} \renewcommand{\subsectionmark}[1]{\markright{\thesubsection\ #1}} \fancyhf{} \fancyhead[LE,RO]{\sffamily\thepage} \fancyhead[LO]{\sffamily\rightmark} \fancyhead[RE]{\sffamily\leftmark} \renewcommand{\headrulewidth}{0.8pt} \renewcommand{\footrulewidth}{0pt} \addtolength{\headheight}{0.8pt} \setlength{\footskip}{0in} \renewcommand{\footruleskip}{0pt} \fancypagestyle{plain}{% \fancyhead{} \renewcommand{\headrulewidth}{0pt} } %----------------------------------------------------------------------------------------------------------------------- \begin{document} \part{EL SISTEMA DE LOS NÚMEROS REALES} \chapter{RELACION DE IGUALDAD} \section{PROBLEMAS RESUELTOS} \begin{problem}Demuestre las siguientes propiedades algebraicas. \begin{multicols}{2} \begin{enumerate}[itemsep=1em,label=\bfseries\arabic*.] \item $\forall a \in \mathbb{R} \quad : \quad a0 = 0$ \item $\forall a \in \mathbb{R} \quad : \quad ( - 1)a = - a$ \item $\forall a,b \in \mathbb{R} \quad : \quad a( - b) = - (ab) = ( - a)b$ \item $\forall a \in \mathbb{R} \quad : \quad - ( - a) = a$ \item $\forall a,b \in \mathbb{R} \quad : \quad ( - a)( - b) = ab$ \item $...$ \item $...$ \item $...$ \item $...$ \item $...$ \end{enumerate} \end{multicols} \end{problem} \end{document}

  • chemnum: How to create an alias compound label so two IDs print the same number (without breaking numbering)?
    by taiwan12 on January 18, 2026 at 1:10 pm

    This \newcommand only works in the simplest cases and breaks as soon as multiple aliases are defined or new compounds are introduced later. \documentclass{article} \usepackage{chemnum} \newcommand\makecmpdalias[2]{% % ensure target exists (without printing) \cmpd*{#1}% % define alias label (without printing) \cmpd*{#2}% % copy printed representation from #1 to #2 \setcmpdlabel{#2}{\cmpdproperty{#1}{counter-representation}}% % undo the counter step caused by defining #2 \addtocounter{cmpdmain}{-1}% } \begin{document} \makecmpdalias{A}{B} \makecmpdalias{D}{E} \makecmpdalias{F}{H} \cmpd{A} \cmpd{B} \cmpd{A,B} \cmpd{C} \cmpd{D} \cmpd{E} \cmpd{F} \cmpd{G} \cmpd{H} \cmpd{I} \end{document} I am using chemnum and referencing compounds via \cmpd{...}. What I want is a simple alias mechanism: \cmpd{A} should define/print compound 1 after \makecmpdalias{A}{B}, \cmpd{B} should also print 1 (B is an alias for A) importantly, the next new compound should continue numbering normally, so \cmpd{C} should print 2 (not 3) similarly D and E should share one number. Expected output: 1 1 1 and 1 2 3 3 4 5 4 6 Actual output with my attempt: So the numbering becomes out of order (C becomes 3, then D/E become 2)....

  • Alternative symbol (curlyvee) with arrow
    by Lukas Grätz on January 18, 2026 at 10:21 am

    I was looking for a symbol to display the alternative like || or \vee but with some kind of pointer to the choice. I thank that \curlyvee with a left/right arrow would be perfect: Can someone help me how to typeset these two symbols? Thank you in advance! \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \begin{align*} a &\curlyvee b \\ a &\curlyvee b = a % \curlyveeleft \\ a &\curlyvee b = b % \curlyveeright \end{align*} \end{document}

  • How to return array from a command?
    by karu on January 18, 2026 at 10:07 am

    How to return an array from a command? or rather How to expand a command to some generated array? The code below generates the correct array into \OutArray inside \Transmogrifier, but I don't know how to return it to calling \ResultArray. I know one option to access the values is to define an empty array, give the array as an argument to the command, have the command generate the elements to that array and access them when the command is finished. This is not what I am looking for. My question is more to expand my understanding and increase the tools I have in my disposal. \documentclass[tikz]{standalone} \begin{document} \newcommand*{\SomeOperation}[2]{% \fpeval{#1*#2}% }% \newcommand*{\Transmogrifier}[2]{% \pgfmathparse{dim(#1)}% or \pgfmathdim{#1}% \edef\ArrayLength{\pgfmathresult}% \xdef\OutArray{{}}% \foreach \i in {0,...,\fpeval{\ArrayLength-1}}% {% \pgfmathparse{array({#1},\i)}% or \pgfmatharray{{#1}}{\i}% \ifnum \i=0% \xdef\OutArray{\SomeOperation{\pgfmathresult}{#2}}% \else% \xdef\OutArray{\OutArray,\SomeOperation{\pgfmathresult}{#2}}% \fi% }% \xdef\OutArray{{\OutArray}}% How to "return" \OutArray? %\typeout{OutArray: \OutArray}% }% \begin{tikzpicture} \def\TestArray{{1,2,3}}% \typeout{TestArray: \TestArray}% \newcommand*{\ResultArray}{% \Transmogrifier{\TestArray}{2}% }% %\ResultArray% Temp for testing \typeout{ResultArray: \ResultArray}% \end{tikzpicture} \end{document} Desired outcome in the log file: TestArray: {1,2,3} ResultArray: {2,4,6}

  • Indifference and budget curve
    by henry on January 18, 2026 at 8:26 am

    I have a trouble to draw this diagram, could you guys help me please. This is my code: \begin{frame}{5.2.Child-care subsidy} \vspace{0.1cm} \centering \resizebox{0.95\textwidth}{!}{% \begin{tikzpicture}[scale=0.95, >=Stealth, font=\sffamily] % --- 1. HỆ TRỤC --- \draw[thick] (0,0) -- (0,6.5) node[above] {Income}; \draw[thick] (0,0) -- (6.5,0); \node[below left] at (0,0) {0}; \node[below] at (5.5,0) {$\longleftarrow$ Hours of Paid Work}; \coordinate (a) at (6.0, 0); \coordinate (c) at (6.0, 1.5); \coordinate (b) at (6.0, 3.0); \draw[thin, gray!30] (6.0, 0) -- (6.0, 3.2); \filldraw[black] (a) circle (1.5pt) node[right, font=\scriptsize] {$a$}; \filldraw[black] (c) circle (1.5pt) node[right, font=\scriptsize] {$c$}; \filldraw[black] (b) circle (1.5pt) node[right, font=\scriptsize] {$b$}; % Đường thấp d-c \coordinate (d) at (0, 4.0); \draw[thick, cyan!50] (d) node[left, black, font=\scriptsize] {$d$} -- (c); \coordinate (e) at (0, 5.5); \draw[thick, curveBlue] (e) node[left, black, font=\scriptsize] {$e$} -- (b); \coordinate (X) at (2.4, 3.0); \filldraw[black] (X) circle (2pt) node[below left] {$X$}; \coordinate (Y) at (3.6, 4.0); \filldraw[black] (Y) circle (2pt) node[above right] {$Y$}; \draw[thick, black] (0.6, 5.2) .. controls (1.2, 3.8) and (1.8, 2.9) .. (X) .. controls (3.2, 3.1) and (5.0, 2.5) .. (6.2, 4.0) node[right] {$U_1$}; \draw[thick, black] (1.5, 6.5) .. controls (2.2, 5.0) and (2.8, 3.9) .. (Y) .. controls (4.5, 4.1) and (5.5, 4.2) .. (6.2, 5.8) node[right] {$U_3$}; \draw[thick, black!70] (1.0, 6.0) .. controls (1.8, 4.5) and (2.5, 3.5) .. (3.1, 3.6) .. controls (4.0, 3.7) and (5.2, 3.5) .. (6.2, 5.0) node[right] {$U_2$}; \end{tikzpicture} } This is what i get:

  • Any possible method to handle for-loop more smartly in tikz?
    by Explorer on January 18, 2026 at 7:31 am

    I have the following codes to typeset following: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{decorations.pathreplacing} \ExplSyntaxOn \cs_new:Nn \__my_Aterm_tl:n { \tl_set:Nn \l_tmpa_tl { a \sb 1 } \int_step_inline:nnn {2} {#1} { \tl_put_right:Nn \l_tmpa_tl { + a \sb {##1} } } \tl_use:N \l_tmpa_tl } \NewDocumentCommand{\Aterm}{ m }{\__my_Aterm_tl:n{#1}} \ExplSyntaxOff \begin{document} \def\NN{5} \begin{tikzpicture} \foreach \i[evaluate=\i as \nexti using int(\i+1)] in {1,...,\NN}{ \draw (0,{-(\i-1)}) rectangle (\i,-\i); \ifnum\i<\NN\relax \draw[decorate,decoration={brace,amplitude=5pt}] (\i,{-(\i-1)}) -- node[midway,right=3pt] {$b_{\i}-b_{\nexti}$} (\i,-\i); \else \draw[decorate,decoration={brace,amplitude=5pt}] (\i,{-(\i-1)}) -- node[midway,right=3pt] {$b_{\i}$} (\i,-\i); \fi \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (0,{-(\i-1)}) -- node[midway,below=3pt] { % $a_{\i}$ $\Aterm{\i}$ } (\i,{-(\i-1)}); } \end{tikzpicture} \end{document} It works! But the code looks not elegant, for the abrupt \ifnum and expl3-syntex(I have heard from that may cause unexpected result to mix tikz and expl3), is that possible to make good use of evaluate=<variable> as <macro> using <formula> or /remember=<variable> as <macro> (initially <value>)?

  • How to add/calculate integers that are coming from a macro using LaTeX3?
    by lukascbossert on January 17, 2026 at 11:23 pm

    In my example I want to calculate integers / getting the sum of entries based on various filtering options. Instead of using datatools macros, I’d like to get it done with LaTeX3/expl3-commands. The problem is the part: \int_set:Nn \l_tmpb_int { \dfgCountPosition[#1]{#2}{f} } which tells me in the log: ! Missing number, treated as zero. <to be read again> \xparse function is not expandable l.94 .../d): \dfgTotalPosition{PostDoc} but as far as I can see there is no \int_set:Nx for using an expansion therefor this is not the solution. So, how can I calculate the sum of entries based on the filter criteria? Here is my MWE \documentclass{article} \usepackage{expl3} % expl3 kernel \usepackage{datatool} % CSV handling \newcommand{\theFundingPeriodNumeral}{3} \ExplSyntaxOn %------------------------------------------------- % 1. Counting routine (optional DB argument) % \dfgCountPosition[<db>]{<position>}{<gender>} % → plain integer %------------------------------------------------- \NewDocumentCommand{\dfgCountPosition}{ O{mydb} m m } { % #1 = database name (default = mydb) % #2 = position (e.g. PostDoc) % #3 = gender (f / m / d) \group_begin: \def\dfgLocalDB{#1} \clist_clear:N \l_tmpa_clist \seq_clear:N \l_tmpb_seq \DTLforeach* [ \DTLiseq{#2}{\pPosition} \and \DTLiseq{#3}{\pGender} \and \DTLisinlist{PI}{\pRole} ] {\dfgLocalDB}{% \pID=id, \pPosition=position,% \pPeriod=period,% \pGender=gender,% \pRole=role }{ % using ID here because this is always one element \clist_put_right:NV \l_tmpa_clist {\pID} } \clist_count:N \l_tmpa_clist \group_end: } %------------------------------------------------- % 2. Total of the three genders for a given position % \dfgTotalPosition[<db>]{<position>} % → plain integer (f+m+d) %------------------------------------------------- \NewDocumentCommand{\dfgTotalPosition}{ O{mydb} m } { % start with the female count \int_set:Nn \l_tmpb_int { \dfgCountPosition[#1]{#2}{f} } % add the male count \int_add:Nn \l_tmpb_int { \dfgCountPosition[#1]{#2}{m} } % add the “diverse” count \int_add:Nn \l_tmpb_int { \dfgCountPosition[#1]{#2}{d} } % finally output the total \int_use:N \l_tmpb_int } \ExplSyntaxOff %------------------------------------------------- %------------------------------------------------- % Create a tiny CSV file that the example can read % ------------------------------------------------- \begin{filecontents*}{mydata.csv} id,position,period,gender,role 1,PostDoc,"2,3",f,PI 2,PostDoc,"1,2,3",m,PI 3,PostDoc,2,f,PI 4,PostDoc,3,d,PI 5,GroupLeader,3,m,PI 6,GroupLeader,2,f,PI 7,GroupLeader,3,m,PI 8,GroupLeader,2,d,PI 9,PhD,3,f,PI 10,PhD,2,m,PI \end{filecontents*} % Load the CSV into a datatool table called “mydb” \DTLloaddb{mydb}{mydata.csv} \begin{document} \section*{Demo of the two macros} \textbf{Counts for a single gender / position}\\[2mm] Females among PostDocs: \dfgCountPosition{PostDoc}{f}\\ Males among PostDocs: \dfgCountPosition{PostDoc}{m}\\ Diverse among PostDocs: \dfgCountPosition{PostDoc}{d}\\[2mm] \textbf{Total number of persons for a position}\\[2mm] All PostDocs (f/m/d): \dfgTotalPosition{PostDoc}\\ All GroupLeaders (f/m/d): \dfgTotalPosition{GroupLeader}\\ All PhDs (f/m/d): \dfgTotalPosition{PhD}\\[2mm] \textbf{Using a non‑default database (just to show the syntax)}\\[2mm] Females in the table “mydb” (same table here): \dfgCountPosition[mydb]{PhD}{f} \end{document}