• Improved alignment of molecules in a reaction suite
    by Nicolas on September 4, 2026 at 8:58 pm

    To show different possible mechanisms, I code this figure: \documentclass[border=3mm]{standalone} \usepackage{graphicx} % Required for inserting images \usepackage{chemfig} \usetikzlibrary{arrows,bending} % \tikzset {[foo /.tip = {Stealth[sep] Latex[sep]}} % \tikzset{ niv2/.tip = {Stealth[red, sep=5pt]_.} } % \tikzset{ niv1/.tip = {Stealth[red, sep=1pt]_.} } % \tikzset{ niv123/.tip = {Stealth[red, sep=1pt]_.} } \begin{document} \schemestart \chemfig{C(-[:120]H)(-[:240]H_3C)=[@{p1}]C(-[:60]H)(-[:300]H)} \+ \chemfig{@{p2}H-[@{p3}]@{p4}\charge{0=\|,90=\|,270=\|}{Cl}} \hspace{.3cm} \arrow(b--)[,1.3,,,draw=none] \subscheme{ \chemfig{CH_3-CH_2-\charge{90:4pt=$\oplus$}{CH_2}} \arrow(c--d){->}[-90,1.5,,,,draw=none] \chemfig[baseline=15pt]{CH_3-\charge{110:3pt=$\oplus$}{CH}-CH_3} } \subscheme{ \arrow(@c--e){->[\charge{0=\|,90=\|,180=\|,-90=\|,45:4pt=$\ominus$}{Br}]}[,1] \chemfig{CH_3-CH_2-CH_2-Br} \arrow(e--f){->}[-90,1.5,,,,draw=none] \chemfig{CH_3-CH(-[:-90]Br)-CH_3} \arrow(@d--@f){->[\charge{0=\|,90=\|,180=\|,-90=\|,45:4pt=$\ominus$}{Br}]}[,1] } \chemmove{ \draw[thick,shorten >=10pt] (b.east) -- ++(1,0) |- (c.west); \draw[thick,shorten >=10pt] (b.east) -- ++(1,0) |- (d.west); \draw[shorten <=1pt,shorten >=1pt](p1).. controls +(80:20mm) and +(100:10mm)..(p2); \draw[shorten <=1pt,shorten >=4pt](p3).. controls +(80:6mm) and +(100:6mm)..(p4); } \schemestop \end{document} Problem: the molecules are not well aligned which means that the arrows (especially the bottom for the bromide ion) are tilted. How can I align vertically?

  • Customized chapter TOC entries with modified roman numeral displays
    by Jethro on September 4, 2026 at 5:06 pm

    MWE: \documentclass[12pt,openany]{book} \usepackage{titlesec,tocloft} \renewcommand{\thechapter}{\Roman{chapter}} \renewcommand{\cftchapaftersnum}{.} % Add a period after each chapter number in the TOC. \usepackage{titlesec} \titleformat{\chapter}[display]{\Huge\centering\bfseries}{CHAPTER \thechapter.}{25pt}{}{} \makeatletter \def\l@chapter#1#2{% \pagebreak[3] \bfseries \vskip .75em plus 1pt \@tempdima 3em \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \advance\leftskip\@tempdima \hskip -\leftskip \leavevmode %\MakeUppercase {#1} \dotfill \hbox to\@pnumwidth{\hss #2} \par \endgroup } \makeatother \begin{document} \tableofcontents \chapter{This is the First Chapter Heading} \chapter{This is the Second Chapter Heading but It is Longer Than the First So That It Extends Over Multiple Lines in the TOC} \end{document} The output: I am trying to add a period after each roman numeral chapter entry. I figured that \renewcommand{\cftchapaftersnum}{.} should do the trick. It doesn't. How may I add a period after each roman numeral in the TOC?

  • Blockwise random order of questions using mcexam
    by Tripedior on September 4, 2026 at 1:14 pm

    I am aware of the "randomizequestions" setting of mcexam, which I would like to use. However, the plan is to ask questions about different fields. Therefore, I would like to randomize the order of questions of each field, but not shuffle questions of different fields together. Below is a MWE. The questions should be consecutively numbered (1,2,3,4 in the MWE). My actual application of course has more than two questions in each block, and also more than two blocks. Could someone please suggest a method for this? PS: I have tried defining two different mcquestions environments, but the second block starts its numbering from 1 again, which is not desired. I tried hacking the mcexam.sty (by trying to adapt Fix first (two) questions with McExam package), but was unsuccessful due to my insufficient LaTeX knowledge. \documentclass[a4paper]{article} \usepackage[ numberofversions=1, seed=11, randomizequestions=true, randomizeanswers=true, writeRfile=false, ]{mcexam} \mcexamoptions{output=exam} \begin{document} \begin{mcquestions} % First block of questions (1-2, random order) \question How much is $2+2$? \question How much is $3+1$? % \end{mcquestions} % -> ending the environment here and opening a new one after achieves the separation, but the question numbering starts from 1 again % \begin{mcquestions} % -> see above % Second block of questions (3-4, random order) \question Is John Doe alive? \question Is Jane Doe alive? \end{mcquestions} \end{document}

  • Problem of vertical placement of two molecules
    by Nicolas on September 4, 2026 at 12:57 pm

    I have the following chemical equation in Chemfigs: \documentclass[border=1mm]{standalone} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \usepackage{chemfig} \usepackage{chemmacros} \begin{document} \setchemfig{scheme debug=true} \schemestart \chemfig{*6(--=---)} \arrow{->[\ch{Br2}]} \chemname{\chemfig{*6(--(<Br)-(<:Br)---)}}{trans-1,2-dibromo\\cyclohexane} \schemestop \end{document} The problem is that vertical alignment is not correct between cyclohexene and dibromocyclohexane. I tried the trick to add\arrow{0}[,0] but it does not work. How to properly replace cycles vertically like this ?

  • Unwanted white gaps between \cmidrule lines in tabularray table – how to fill with background color? [duplicate]
    by Ernest on September 4, 2026 at 11:53 am

    I am using the tabularray package to create a table with multi-column headers. The table has three groups of columns (2–4, 5–6, and 7–9), each with its own sub-header. I am using \cmidrule to draw horizontal lines under each group, as shown in the MWE and Figure below. However, there are small white gaps between the \cmidrule segments (where the rules do not meet). These gaps appear as white lines against the colored background of the header cells, which looks visually distracting. MWE: \documentclass{article} \usepackage[margin=2.5cm]{geometry} \usepackage{booktabs} % for \cmidrule \usepackage{xcolor} % for colors \RequirePackage{tabularray} \UseTblrLibrary{siunitx} \UseTblrLibrary{booktabs} \NineColors{saturation=low} \begin{document} \begin{table}[t!h] \centering\vspace{-1pc} \caption{Major elements (wt.\%) of minerals in the studied rocks (Layer~1/1: analcime, Layer~1/2: smectite, Layer~1/3: Ca-Na zeolite). Analyses by SEM}\label{tab:02} \begin{tblr}{ colspec = { X[l,m] X[c,m] X[c,m] X[c,m] X[c,m] X[c,m] X[c,m] X[c,m] X[c,m] }, hline{1,Z} = {-}{0.08em}, hline{4} = {-}{0.03em}, row{even[4]} = {gray9}, row{1-3} = {c,m}{azure9}, rowsep = {1.6pt}, cell{1-3}{1-9} = {azure9}, } \SetCell[r=3]{c}{Major\\ Elements} & \SetCell[c=3]{c}{Sample of Layer 1/1} & & & \SetCell[c=2]{c}{Sample of Layer 1/2} & & \SetCell[c=3]{c}{Sample of Layer 1/3} & & \\ \cmidrule[r]{2-4} \cmidrule[lr]{5-6} \cmidrule[l]{7-9} & Analcime & Analcime & Analcime & Smectite & Smectite & Ca-Na Zeolite & Ca-Na Zeolite & Ca-Na Zeolite \\ \cmidrule{2-9} & \SetCell[c=8]{c}{Major Elements (wt.\%)} \\ % $\mathrm{SiO}_2$ & 57.99 & 59.01 & 59.54 & 45.52 & 47.94 & 64.38 & 64.67 & 66.48 \\ $\mathrm{TiO}_2$ & -- & -- & -- & 0.16 & 0.23 & -- & -- & -- \\ $\mathrm{Al}_2\mathrm{O}_3$ & 18.97 & 19.68 & 19.82 & 11.99 & 12.83 & 14.49 & 13.87 & 14.61 \\ $\mathrm{FeO}_{\mathrm{tot}}$ & -- & -- & -- & 3.73 & 3.91 & -- & -- & -- \\ $\mathrm{MgO}$ & -- & -- & -- & 3.70 & 3.78 & 0.13 & 0.11 & 0.16 \\ $\mathrm{CaO}$ & -- & -- & -- & 1.52 & 1.55 & 4.65 & 4.22 & 4.43 \\ $\mathrm{Na}_2\mathrm{O}$ & 10.43 & 10.55 & 9.35 & 0.09 & 0.18 & 2.96 & 2.40 & 2.87 \\ $\mathrm{K}_2\mathrm{O}$ & -- & -- & -- & 0.09 & 0.09 & 0.45 & 0.46 & 0.52 \\ $\Sigma$ & 87.39 & 89.24 & 88.71 & 66.80 & 70.51 & 87.06 & 85.73 & 89.07 \\ \end{tblr} \end{table} \end{document}

  • batch generate letters with variable content
    by underflow on September 3, 2026 at 10:45 pm

    I need to generate a batch of reports. Each report gives the pass/fail results of a series of labs, with data taken from a text file. Here is a minimal (almost) working example: \documentclass{letter} \begin{document} \newcommand{\lab}[7]{ \begin{letter}{} \signature{Lab director} \opening{Dear #1,} Here are the result of your lab report: \begin{tabular}{ll} {#2}: & {#3} \\ {#4}: & {#5} \\ {#6}: & {#7} \end{tabular} \closing{Sincerely yours,} \pagebreak \end{letter}} \input{mwe_list.tex} \end{document} and here's the data file ("mwe_list.tex"): % Format of the data file: % % \lab{the name of the place} % {name of lab #1} % {pass/fail} % {name of lab #2} % {pass/fail} % {name of lab #3} % {pass/fail} % % NOTE: The number of labs is fixed, but the labs for different people could be % different, and some people attempted fewer than three labs \lab{Alice} {heat fusion} {pass} {energy content} {pass} {acid dissociation} {pass} \lab{Bob} {energy content} {pass} {} {} {} {} As this example shows, some reports have fewer than 3 items. Question: How should I modify the tex code so it only prints the name of lab + results that's carried out? I have in mind something like "if {#3} is not {} then print {#3:}: {#4}", but I don't know how to do that in latex, and I don't know how to combine that with e.g. tabular. I do realize that my MWE is hacky, so I welcome suggestions on how to do this properly. Thanks!

  • How to refine the custom `\oplusarc` symbol with more consist looking with `\oplus`?
    by Explorer on September 3, 2026 at 2:39 pm

    With Marjin's hack, I borrowed egreg's code with picture mode to replicate the following symbol: which comes from the following context: Edit Thanks to jlab's suggestions, I have corrected my silly mistake. % https://tex.stackexchange.com/a/765922 % https://tex.stackexchange.com/a/766094 \documentclass{article} \usepackage{amsmath} \usepackage{etoolbox} \usepackage[pstarrows]{curve2e} % a general purpose macro https://tex.stackexchange.com/a/480801/4427 \newcommand{\xmathpalette}[2]{\mathchoice {#1\displaystyle\textfont{#2}}% {#1\textstyle\textfont{#2}}% {#1\scriptstyle\scriptfont{#2}}% {#1\scriptscriptstyle\scriptscriptfont{#2}}% } \let\origoplus\oplus % https://tex.stackexchange.com/a/766094/322482 \def\arrowshift{0} \makeatletter \patchcmd{\@VArc}{\vector(\@xnum,\@ynum){0}}{\vector(\@xnum,\@ynum){\arrowshift}}{}{} \newdimen\oplusarc@dim \newcommand{\oplusarc}{% \mathbin{% \mkern0.5mu \xmathpalette\newoplusarc@\origoplus \mkern0.5mu }% } \newcommand{\newoplusarc@}[3]{% \begingroup \sbox\z@{$#1\m@th#3$}% \oplusarc@dim=\dimeval{\ht\z@+\dp\z@}% \unitlength=0.065\oplusarc@dim% \def\pIIe@CAW{0.1\oplusarc@dim}% \vcenter{\hbox{% \begin{picture}(7,18)(0,-9)% \def\arrowshift{2}% \linethickness{0.7\fontdimen8#2 3}% \VectorArc(0,0)(45:7){260}%{270} % \Line(-3,0)(3,0)% \Line(0,-3)(0,3)% \end{picture}% }}% \endgroup } \makeatother \begin{document} $\origoplus \oplusarc$ $\scriptstyle\origoplus \oplusarc$ $\scriptscriptstyle\origoplus \oplusarc$ \fboxsep=0pt \fboxrule=0.1pt \fbox{$\origoplus$} \fbox{$\oplusarc$} $A \oplus B$, \quad $X_{i \oplusarc j}$ $A \oplusarc B$, \quad $X_{i \oplusarc j}$ \end{document} But the result was not so ideal, with not so consistent size and baseline with oplus(?), thus, I was still want to ask whether any suggestions on my code;-), Why I use curve2e instead of tikz, is that I want a less-dependent (and maybe faster) solution here... Since egreg's code was so sophisticated, I am sure that I was lack of ability to fully understand now...

  • How do you change the math font in ltx-talk?
    by David Purton on September 3, 2026 at 1:33 pm

    When I try to change the math font in ltx-talk it is only partly successful. Operators remain in the original New CM Sans Math font. What's going on and how to fix? \DocumentMetadata{} \documentclass{ltx-talk} \setmathfont{STIX Two Math} \begin{document} $x=\sin y$ \end{document}

  • Error in including tcolorbox library while creating class
    by Jolia on September 3, 2026 at 8:46 am

    I want to create a class to replace the default beamer class in my presentations. When I modify my beamer document to include all the packages I want no error to be signaled, but when I try to create the class: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{leçon} \LoadClass[aspectratio=169,10pt]{beamer} \RequirePackage{hyphenat} % Empêche la césure des mots \hyphenpenalty=5000 \RequirePackage{tkz-tab} \RequirePackage{tabularray} \RequirePackage{pifont} \RequirePackage{qrcode} \RequirePackage{makecell} \RequirePackage{mathrsfs} \setbeamertemplate{navigation symbols}{} \RequirePackage{ragged2e} \usetikzlibrary{matrix, arrows, positioning, tikzmark, shadows, shadings, lindenmayersystems} \tcbuselibrary{listings, breakable, skins} % Couleurs \definecolor{rose}{RGB}{216,0,111} \definecolor{vert}{RGB}{100,200,100} \definecolor{bleu}{RGB}{0,150,150} \definecolor{violet}{RGB}{180,100,200} \definecolor{orange}{RGB}{255,134,40} \newcommand{\hl}[2]{\tcbox[on line, highlight math style={enhanced},colback=#1!30,colframe=#1!30,boxsep=1pt,left=0pt,right=0pt,top=0pt,bottom=0pt]{#2}} \newcommand{\plus}{{\color{rose}\bm{+}}} \newcommand{\moins}{{\color{vert}\bm{-}}} \newcommand{\grasprop}[1]{{\color{rose}\textbf{#1}}} \newcommand{\grasdef}[1]{{\color{orange}\textbf{#1}}} \newcommand{\grassub}[1]{{\color{vert}\textbf{#1}}} \newcommand{\grasmeth}[1]{{\color{violet}\textbf{#1}}} \newcommand{\grasex}[1]{{\color{ex}\textbf{#1}}} \newcommand{\grasrmq}[1]{{\color{bleu}\textbf{#1}}} \newcommand{\N}{\mathbf{N}} \newcommand{\R}{\mathbf{R}} \newcommand{\Z}{\mathbf{Z}} \newcommand{\application}[5]{$\begin{array}{ccccc} #1 & : & #2 & \longrightarrow & #3 \\ & & #4 & \longmapsto & #5 \\ \end{array}$} \newcommand{\suiterec}[4]{$\left\{ \begin{array}{ll} #1 & = #2 \\ #3 & = #4 \end{array} \right.$} \newcommand{\vect}[1]{\overrightarrow{#1}} \newcommand{\coop}[2]{\begin{pmatrix}#1 \\ #2 \end{pmatrix}} \newcommand{\cooe}[3]{\begin{pmatrix}#1 \\ #2 \\ #3 \end{pmatrix}} I get an error on the line \tcbuselibrary{listings, breakable, skins} in Overleaf saying "Undefined control sequence". It does compile however (for now but might not if I use different functionalities in my beamer). Any idea what I could do?

  • Unexpected arrow position with `\VectorArc` in `curve2e` package?
    by Explorer on September 3, 2026 at 6:10 am

    Claim1: I know tikz could handle this issue Claim2: I just want to focus on the pict2e and curve2e case Here below is the code: \documentclass{article} \usepackage{curve2e} \begin{document} \begin{picture}(40,40) \put(5,20){\vector(1,0){30}} \end{picture} \begin{picture}(40,40) \VectorArc(20,20)(0:15){270} \end{picture} \linethickness{1pt} \begin{picture}(40,40) \put(5,20){\vector(1,0){30}} \end{picture} \begin{picture}(40,40) \VectorArc(20,20)(0:15){270} \end{picture} \end{document} The screenshot below was displayed with PDF-XChange and Adobe Acrobat Reader on my windows 11: I found little information on the site, is this a bug or known feature, any proposal to refine it? Edit The corresponding TikZ version(unrelated with the issue, but for comparsion): \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{bending}%<- \begin{document} \begin{tikzpicture} \draw[-latex,line width=1pt] (0,0) ++(0:15pt) arc[start angle=0, end angle=270, radius=15pt]; \draw[magenta] (0,0) ++(0:15pt) arc[start angle=0, end angle=270, radius=15pt]; \end{tikzpicture} \end{document}

  • Unicode-math based solution with bold math binary symbols?
    by Explorer on September 3, 2026 at 2:52 am

    The post comes from this classical one, but the unicode-math version, I want to bold some math binary symbols: \documentclass{article} \usepackage{bm} \begin{document} $a + b$ vs $a \bm{+} b$ $a - b$ vs $a \bm{-} b$ $a \times b$ vs $a \bm{\times} b$ $a \div b$ vs $a \bm{\div} b$ \end{document} However, as we all known, unicode-math was conflict with bm package, what I want was as below: The code with unicode-math.... \documentclass{article} \usepackage{unicode-math} \setmathfont{latinmodern-math.otf} \setmathfont[range={`+,\minus,\times,\div}]{STIX Two Math}% ? \begin{document} $a + b$ % vs $a + b$ $a - b$ ? % vs $a - b$ % ? $a \minus b$ % vs $a \minus b$ % ? $a \times b$ % vs $a \times b$ $a \div b$ % vs $a \div b$ \end{document} I found no solution with unicode-math (I only found that STIX Two Math's symbols are thicker, but not in matched style), any suggestions? Notes that other code in the reference link was not the same bahavior of \bm, I want a more Latin Modern Math-like style (it means the tip of + is rounded, but not butt, for example) here...

  • Math accent placement with LaTeX beamer, sans serif font and lmodern
    by Tripedior on September 2, 2026 at 5:36 pm

    I am using utf8 inputenc, T1 fontenc and lmodern as the font to create a presentation with LaTeX Beamer. However, this combination results in math accents (like tilde and hat) which are not correctly aligned above the italicized letters (variable names) in math mode. A MWE can be found below. When I remove lmodern from the loaded packages then the accents are aligned correctly, but the font itself looks very strange/rough/unpolished, which does not look satisfactory to me. Any advice? \documentclass[aspectratio=169]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{mathtools} \begin{document} \begin{frame} \frametitle{Misplaced accents} Polynomial $\tilde{p}$ of degree $n-1$ with \begin{align*} p(x) = (x - \hat{x}) \cdot \tilde{p}(x) \ \xLeftrightarrow{x \neq \hat{x}}\ p(x) : (x - \hat{x}) = \tilde{p}(x) \end{align*} \end{frame} \begin{frame} \centering\Huge Equations \end{frame} \end{document} Edit: added screenshots, please compare the headlines and the accents in the formula (first one without lmodern, second one with lmodern)

  • How to determine whether a call to \printbibliography will produce output or not?
    by lAtExFaN on September 2, 2026 at 2:52 pm

    I've no clue how to solve this. Although the question should be nearly self explanatory, here's some pseudo code that could be helpful, too: if(\printbibliography will produce output) { insert pagebreak in the document (not in bibliography) } The if-condition is the problem, I would like to get some hints for or even solved. Here's an MWE for experimentation: \documentclass{article} \usepackage{biblatex} \usepackage{filecontents} \begin{filecontents}{general.bib} @misc{A01, author = {Author, A.}, year = {2001}, title = {Alpha}, } @misc{B02, author = {Buthor, B.}, year = {2002}, title = {Bravo}, } \end{filecontents} \addbibresource{general.bib} \begin{document} %As Buthor said in \cite{B02}: \IfFileExists{\jobname.bbl}% {\textbackslash printbibliography expected to produce output}% {\textbackslash printbibliography not expected to produce output} \printbibliography \end{document}

  • Cleveref confused when environment name is different from associated alias?
    by Morgan Rogers on September 2, 2026 at 9:33 am

    Whenever I use the \newtheorem command but select an environment name (first argument) distinct from the alias which appears in the text (typically third argument), cleveref fails to display the name of the reference correctly. According to section 8 of the cleveref manual, If cleveref encounters a cross-reference to a type it does not know, it will produce a "reference type undefined" warning, ?? \ref{<label>}... so that must be what's happening, but I don't know why. I can already see a few fixes for this: make aliases consistent with environment names, or separately provide label names to cleveref with the other commands the package provides. However, I have not encountered this problem before now; I want to know if something changed that broke cleveref, and if so whether there is a more convenient adaptation I can make to fix it. MWE: \documentclass{article} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{thm}{Theorem}[section] \newtheorem{lemma}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} \begin{document} \begin{lemma} \label{lem:1} This is a lemma. \end{lemma} \begin{prop} \label{prop:2} This is a proposition. \end{prop} I can reference \Cref{lem:1} but not \Cref{prop:2}? \end{document} Output: I am using the current version of Overleaf.

  • Dynamic command depending on nested calling and binary operations inside
    by AGI on September 1, 2026 at 5:27 pm

    My main idea is to define a macro, \trans such that if called twice, the second calling has a delimiter with it. This is more general and not only about transposes. The question then is What code can make a macro behave this way?. For example, I usually use \NewDocumentCommand{\trans}{+m}{{#1}^{\bm t}} But then \trans{\trans{\mathbf{A}}} produces Instead of the desired Another example: Say I want to define \dual such that if in the parameter there is another \dual then applies parenthesis. Say \NewDocumentCommand{\dual}{+m}{{{#1}^\ast}}} Then I would like to modify \dual so that \dual{V + \dual{\Omega}} produces Instead of the actual render of Another extension: Such that if inside braces it is detected a binary operator then it applies parenthesis, in this way \dual{V+W} should produce I have checked How a program a command which counts the delimiter within itself and alternates brackets accordingly?, it would solve the problem about checking if there is another instance of the command in the parameter but I'm still curious about checking if there is a binary operator, and if possible integrating both features in a single command. Example code: \documentclass{article} \usepackage{amsmath,bm} %------------------------------------------% %---------- Auxiliar definitions ----------% %------------------------------------------% \def\blank{\cdot} %------------------------------------------% %----------- Example Delimiters -----------% %------------------------------------------% \NewDocumentCommand{\paren}{+m}{% \IfBlankTF{#1}{\left(\mathopen{} \: \blank \: \mathclose{}\right)}% {\left(\mathopen{} \, {#1} \, \mathclose{}\right)}% } \NewDocumentCommand{\norm}{+m}{% \IfBlankTF{#1}{\lVert\mathopen{} \: \blank \: \mathclose{}\rVert}% {\left\lVert\mathopen{} \, {#1} \, \mathclose{}\right\rVert}% } \NewDocumentCommand{\abs}{+O{}}{% \IfBlankTF{#1}{\left|\mathopen{} \: \blank \: \mathclose{}\right|}% {\left|\mathopen{} \, {#1} \, \mathclose{}\right|}% } \NewDocumentCommand{\br}{+m}{% \IfBlankTF{#1}{\left[\mathopen{} \: \blank \: \mathclose{}\right]}% {\left[\mathopen{} \, {#1} \, \mathclose{}\right]}% } %------------------------------------------% %------------ Main definitions ------------% %------------------------------------------% \NewDocumentCommand{\trans}{+m}{{{#1}^{\bm t}}} \NewDocumentCommand{\dual}{+m}{{{#1}^\ast}} \NewDocumentCommand{\pow}{+O{} +m}{\IfBlankTF{#1}{\paren{}^{#2}}{{#1}^{#2}}} \DeclareMathOperator{\Int}{Int} \DeclareMathOperator{\Cl}{Cl} \begin{document} \pagestyle{empty} \centerline{\Large \textsc{Comparison between present code output and desired output}}\vspace{1em}% \hrule\vspace{2em}% \centerline{\hspace{-4em}\textsc{Code Rendered}\hspace{3em} \textsc{Desired}} %------------------------------------------% %--------------- Main code ----------------% %------------------------------------------% \[\hspace{-1.25em}\trans{\bm{A}} \quad \longrightarrow \quad \bm{A}^{\bm{t}} \]% % \[\trans{\trans{\bm{A}}} \quad \longrightarrow \quad \paren{\trans{\bm{A}}}^{\bm{t}}\]% % \[\dual{V+\dual{\Omega}} \quad \longrightarrow \quad \dual{\paren{V+\dual{\Omega}}}\]% % \[\dual{V+W} \quad \longrightarrow \quad \dual{\paren{V+W}}\]% % \[\pow[a+b]{2} \quad \longrightarrow \quad \pow[\paren{a+b}]{2}\]% % \[\hspace{-1.25em}\Int A \quad \longrightarrow \quad \mathrm{Int}\,A \]% % \[\Int{\Int{A}} \quad \longrightarrow \quad \Int\paren{\Int{A}}\]% % \[\Cl{\Int{A}} \quad \longrightarrow \quad \mathrm{Cl}\paren{\Int{A}}\]% % \[\hspace{-1.25em}\Cl{2Z} \quad \longrightarrow \quad \mathrm{Cl}\,2Z\]% % \[\Cl{2Z+b} \quad \longrightarrow \quad \Cl{\paren{2Z+b}}\]% \end{document}

  • siunitx: single uncertainty descriptor
    by BeneLaTeXerit on September 1, 2026 at 2:53 pm

    I wanted to use \sisetup{uncertainty-descriptors = ....} in my lab protocol, specifically, I wanted to display a number only with a systematic error, so I tried \num[uncertainty-descriptors = {sys}]{1.2(3)} but that doesn't print (sys). So I tried, if siunitx neglects one error if its zero (because 0 in a single error number \num{1.2(0)} is neglected). But if one of those errors is 0 - ´\num{1.2(3)(0)}´, then siunitx gets stuck in an endless compiling process. As the documentation shows, the standard works: If \num[uncertainty-descriptors = {sys,stat}]{1.2(3)(4)} receives both errors, it prints just fine. Why does siunitx crash, did I miss something in sisetup? The quick alternative would be to display it manually as seen below. There's a MWE below: (you need to clear auxiliary files when testing the crashes yourself) \documentclass{article} \usepackage{siunitx} \sisetup{ separate-uncertainty=true, uncertainty-descriptor-mode = subscript } \begin{document} \[\num{1.2(3)(4)}\] % works \[\num{1.2(0)}\] % works % \[\num{1.2(3)(0)}\] % crashes \[\num[uncertainty-descriptors = {sys}]{1.2(3)}\] % doesn't print (sys) % \[\num[uncertainty-descriptors = {sys,stat}]{1.00(2)(0)}\] % crashes \[\num[uncertainty-descriptors = {sys,stat}]{1.2(3)(4)}\] % default, both errors given % manual alternative \[1.2\pm0.3_{\text{sys}}\] \end{document}

  • One space in the source code leads to a vertical space in the output
    by Annemarie Kästner on September 1, 2026 at 2:04 pm

    I have the following tex-File \documentclass[a4paper,12pt,BCOR=12mm]{scrbook} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath,amsthm} \usepackage{hyperref} \usepackage{thmtools} \newtheorem{proposition}{Proposition}[chapter] \newtheorem{thm}[proposition]{Theorem} \newtheorem{lem}[proposition]{Lemma} \theoremstyle{remark} \newtheorem{rem}[proposition]{Remark} \numberwithin{section}{chapter} \numberwithin{equation}{chapter} \begin{document} \setcounter{chapter}{4} \setcounter{proposition}{8} \begin{thm}\label{thm:stabilitaet} This is a theorem. \end{thm} \begin{rem}\label{rem:Gammavergleich} This is a remark. \end{rem} In order to prove Remark \ref{rem:Gammavergleich} and Theorem \ref{thm:stabilitaet}, we need the following formulas. % \begin{lem}\label{lem:Gammaformel} There is an ugly space above this lemma. \end{lem} \end{document} If I remove the '%' before the Lemma or if I add a space between the period and the '%', I get an anomalous vertical space before the lemma in the output. Supposingly, the reason is that the line with the text "In order to ... formulas." is already very full. If I remove the word "formulas", the additional vertical space does not appear. But should TeX behave like this? Edit: The behaviour changes, if I remove \usepackage{hyperref} or \usepackage{thmtools}.

  • How to draw/visualize/simulate to show the diffence between the two almost identical curves?
    by Black Mild on September 1, 2026 at 9:45 am

    This question is related to an interesting question on mathSE. The blue curve $E$ is the ellipse $\left(\frac{4x}{\pi}\right)^2+\left(\frac{y}{\ln\left(\sqrt2+1\right)}\right)^2=1$ and the red curve $L$ is $y^2=\ln^2\left(\sqrt2\cos x-\sqrt{\cos(2x)}\right)$ are almost identical in shapes. So far several answers show that they are different (some 1/10000) but almost identical (it's still open for that exact value/measure of how different they are). Naturally we want to see the difference. The question is to draw/visualize/simulate how different they are. It's interesting in mathematics but challenging in drawing due to very small diffrences. I can draw them (the code below is a MWE); the below left is E over thicker L, the below right is L over a thicker E; however we can not see the difference. Any tools (tikz, pgfplot, asymptote, luadraw, julia, ...) are allowed (standalone can be integrated into LaTeX/beamer). I just think of f(x)-g(x), f(x)/g(x), ... then scale by 10000 in graph, but not yet clear and complete. Please explain some maths behind your way, if any. // https://asymptote.ualberta.ca/ // https://math.stackexchange.com/questions/5147646/why-is-this-curve-almost-an-ellipse-y2-ln2-left-sqrt2-cos-x-sqrt-cos2x/5148177 // The blue curve $E$ is the ellipse $\left(\frac{4x}{\pi}\right)^2+\left(\frac{y}{\ln\left(\sqrt2+1\right)}\right)^2=1$. import graph; usepackage("amsmath"); size(12cm); real a = pi/4; // \approx 0.7854 real b = log(sqrt(2)+1); // = arcsinh(1) \approx 0.8814 write(a); write(b); // The ellipse E real xE(real t) { return a*cos(t); } real yE(real t) { return b*sin(t); } // The curve L real yL_upper(real x) { // Tránh sai số dấu phẩy động lân cận nghiệm bằng hàm max real u = sqrt(max(cos(2*x), 0)); return log(u + sqrt(u^2 + 1)); } real yL_lower(real x) { return -yL_upper(x); } // draw on a picture with pen void draw_curve_E(picture pic=currentpicture, pen p) { draw(pic, graph(xE, yE, 0, 2*pi), p); } void draw_curve_L(picture pic=currentpicture, pen p) { path upper = graph(yL_upper, -a, a, operator ..); path lower = reverse(graph(yL_lower, -a, a, operator ..)); draw(pic, upper -- lower -- cycle, p); } pen penE = blue+1pt; pen penL = red+1pt; pen draw_first = opacity(.3) + 4pt; picture picaxes, picE, picL, picEL, picLE; real extra = .1; xaxis(picaxes, -a-extra, a+extra, gray); yaxis(picaxes, -b-extra, b+extra, gray); add(picE,picaxes); add(picL,picaxes); add(picEL,picaxes); add(picLE,picaxes); draw_curve_E(picE, penE); string sE=" \begin{minipage}[C]{6cm} \[ \left(\frac{4x}{\pi}\right)^2+ \left(\frac{y}{\ln(\sqrt2+1)}\right)^2=1 \] \begin{align*} a&=\pi/4 \approx 0.7854\\ b&=\ln(\sqrt2+1)\\ &=\operatorname{arsinh}(1)\approx0.8814 \end{align*} \[ \frac{x^2}{a^2}+\frac{y^2}{b^2}=1 \] \end{minipage}"; label(picE,Label(scale(.6)*sE,penE),(-a-extra,0),W); draw_curve_L(picL, penL); string sL=" \begin{minipage}[C]{6cm} $$y^2=\ln^2\left(\sqrt2\cos x-\sqrt{\cos(2x)}\right)$$ $$2\sin^2x +\sinh^2 y=1$$ \end{minipage}"; label(picL,Label(scale(.6)*sL,penL),(a+extra,0),E); draw_curve_E(picEL, penE + draw_first); draw_curve_L(picEL, penL); draw_curve_L(picLE, penL + draw_first); draw_curve_E(picLE, penE); real dx=1, dy=1.8; add(shift(-dx,0)*picE); add(shift(dx,0)*picL); add(shift(-dx,-2dy)*picEL); add(shift(dx,-2dy)*picLE); label("They are different but almost identical!",(0,-dy-.2)); label("How do we see their difference ?",(0,-2dy-b-.8)); //shipout(bbox(2mm,invisible)); shipout(bbox(2mm,Fill(.2yellow+.8white)));

  • How to draw realistic, semi-3D chemistry glassware (volumetric flask) in pure TikZ?
    by user446526 on September 1, 2026 at 8:34 am

    I am trying to recreate an educational chemistry diagram illustrating the dilution of a solution using pure TikZ. Here is the target image I want to emulate (specifically the realistic, glossy 3D look of the glassware and liquid): I have made an initial attempt at drawing the volumetric flask and adding some basic gradients to simulate a 3D effect and control the water level. Here is my current Minimal Working Example (MWE), which is stripped of all custom fonts and language packages, along with a screenshot of my current output: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm, y=1cm] % Water level control \def\waterlevel{-0.5} % Main flask path \def\flaskpath{ (0,-2.115) .. controls (1.85,-2.0) and (0.2,-0.45) .. (0.225,-0.01) .. controls (0.15,1.95) and (0.25,1.55) .. (0.25,1.725) .. controls (0.175,2.15) and (0.3,2.15) .. (0.3,2.225) .. controls (0.2,2.35) and (-0.2,2.35) .. (-0.3,2.225) .. controls (-0.3,2.15) and (-0.175,2.15) .. (-0.25,1.725) .. controls (-0.25,1.55) and (-0.15,1.95) .. (-0.225,-0.01) .. controls (-0.2,-0.45) and (-1.85,-2.0) .. cycle } % 1. Flask glass (3D transparent background) \fill[left color=gray!10, right color=gray!30, middle color=white, opacity=0.4] \flaskpath; % 2. Liquid with 3D gradient \begin{scope} \clip \flaskpath; \fill[left color=blue!60!black, right color=blue!40, middle color=blue!15, opacity=0.85] (-2,-2.2) rectangle (2, \waterlevel); % Liquid surface line \draw[blue!80!black, thick, opacity=0.6] (-1, \waterlevel) -- (1, \waterlevel); \end{scope} % 3. Flask outline \draw[line width=1.3pt, color=black!75] \flaskpath; % 4. Top stopper/neck details \draw[line width=1.3pt, color=black!75] (-0.3,2.225) .. controls (-0.15,2.125) and (0.15,2.125) .. (0.3,2.225); \draw[line width=1.3pt, color=black!75] (-0.25,2.275) .. controls (-0.15,2.2) and (0.15,2.2) .. (0.25,2.275); \draw[line width=1.3pt, color=black!75, left color=gray!5, right color=gray!40, middle color=white] (0.25,2.275) .. controls (0.15,2.325) and (0.15,2.375) .. (0.175,2.425) .. controls (0.45,2.5) and (0.3,2.7) .. (0,2.675) .. controls (-0.3,2.7) and (-0.45,2.5) .. (-0.175,2.425) .. controls (-0.15,2.375) and (-0.15,2.325) .. (-0.25,2.275) .. controls (-0.1,2.325) and (0.1,2.325) .. (0.25,2.275); \draw[line width=1.3pt, color=black!75] (-0.25,2.625) .. controls (-0.15,2.575) and (0.15,2.575) .. (0.25,2.625); % 5. Calibration mark (red ring on the neck) \draw[line width=1pt, red!70!black] (-0.23, 1.2) .. controls (-0.1, 1.15) and (0.1, 1.15) .. (0.23, 1.2); \end{tikzpicture} \end{document} My question: How can I further improve the shading, highlights, and transparency of this TikZ code to closely match the professional, glossy 3D rendering seen in the target image? (Note: I am looking for a pure TikZ solution and prefer not to use pst-labo or external 3D software if possible).

  • Failed to modify \input@path
    by lyl on September 1, 2026 at 2:33 am

    I want to make seach paths in my project like this: \documentclass{article} \usepackage{graphics} % [#1:optional arg,a list of paths delimited by comma, would be added to "./, lib/, material/"] % {#2:a path searched from} \ExplSyntaxOn \newcommand{\setsearchpath}[2][./, lib/, material/]{ \def\pathcomb{} \clist_map_inline:nn {#1} { \tl_put_right:Nx \pathcomb { {#2\tl_trim_spaces:n {##1}} } } \expandafter\graphicspath\expandafter{\pathcomb} \def\input@path{\pathcomb\input@path} }%\setsearchpath \ExplSyntaxOff \begin{document} \setsearchpath{../} \includegraphics{paperclip} \input{test} %This causes error. \end{document} Test this code showes that the set of graphic paths works all rigth, the input paths however fails. What's wrong with my code? And how to make my \setsearchpath work?

  • How to align this text in the first letter?
    by Alastair Stratford on September 1, 2026 at 1:02 am

    I'm currently a freshman taking Math program. I don't have any much to do so I want to learn LaTeX. Yet when I try to align this in the center, it looks like this: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} u &= x^2-4 & v &= -2e^{-x/2} \\ du &= 2x & dv &= e^{-x/2} \end{align*} \end{document} I don't now how to compile this here, but here's the picture I want to align the it in the first letter, which is in d, and I want to tighter the space of it. How can I do it?

  • Ratio inside scalebox doesn't work
    by AGI on August 31, 2026 at 8:37 pm

    my main problem that I'm looking forward to solving and understanding is the following: With the graphicx package we have the \scalebox{}[]{} macro. I don't quite know the most technical parts but I do know about tokenization of TeX code and category codes but the thing is that if I try to use calc in order to use the \ratio macro to produce a dynamical scaling of the expresion I get an error. A snippet of my code (example +packages loaded) would be \documentclass{article} \usepackage{etoolbox} \usepackage{mathtools} \usepackage{graphicx} \usepackage{cancel} \usepackage{amssymb} \usepackage{xparse} \usepackage{ifthen} \usepackage{calc} \usepackage{intcalc} \usepackage{forloop} \usepackage{nicematrix} \usepackage{xfp} \NewDocumentCommand{\set}{+m}{\ifblank{#1}{\varnothing}{ \scalebox{1}[\ratio{\heightof{#1}}{\heightof{X}}]{ \raisebox{0.04em}{\{} } #1 \scalebox{1}[\ratio{\heightof{#1}}{\heightof{X}}]{ \raisebox{0.04em}{\} } }}} \begin{document} %induces error %$\set{}$ %$\br{X}$ \renewcommand{\set}{\ifblank{#1}{\varnothing}{ \scalebox{1}[1.15]{ \raisebox{0.04em}{\{} } #1 \scalebox{1}[1.15]{ \raisebox{0.04em}{\}} $\set{}$ %produces \varnothing $\set{a,B}$ %produces {a,B} with adjusted height of braces \renewcommand{\br}[1]{\raisebox{0.1em}{[} #1 \raisebox{0.1em}{]} $\mathds R\br{X}$ %produces set of polinomials with coeficients in R and variable X with adjusted braces \end{document} I have tried using 1*\ratio... and expl3 but those also gives errors. These are the error messages I see I also know about mathtools and \DeclareMathDelimiterX but I also want code that handles translating of the expresion, like in \newcommand{\br}[1]{\raisebox{0.1em}{[} {#1} \raisebox{0.1em}{]}} Which, for what I know isn't possible with it. I hope you know how to solve this and can help me. What I want is that it scales with respect to the height of X for reference. Edit2: So for more added context, I also defined a macro for an adjusted integral (I'm a bit picky with symbols hahaha) and I would also (just to be sure) that it can scale by that much. \NewDocumentCommand{\integral}{+O{} +O{} +m +m +O{}}{\ifthenelse{\equal{#5}{partial}}{ \mathchoice{ \scalebox{1.1}[1.25]{$\displaystyle \int_{{#1}}^{{#2}}$}\kern0.25em{ \scalebox{1}{$\displaystyle {#3} \, \partial{}{#4}$}} }{ \scalebox{1}[1.1363]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.8}{${#3} \, \partial{}{#4}$} }{ \scalebox{0.6}[0.68]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.5}{$ {#3} \, \partial{}{#4}$} }{ \scalebox{0.55}[0.57]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.4}{$ {#3} \, \partial{}{#4}$}} }{ \mathchoice{ \scalebox{1.1}[1.25]{$\displaystyle \int_{{#1}}^{{#2}}$} \kern0.25em{ \scalebox{1}{$\displaystyle {#3} \, \diff{}{#4}$}} }{ \scalebox{1}[1.1363]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.8}{${#3} \, \diff{}{#4}$} }{ \scalebox{0.6}[0.68]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.5}{$ {#3} \, \diff{}{#4}$} }{ \scalebox{0.5}[0.57]{$\int_{{#1}}^{{#2}}$} \kern0.1em \scalebox{0.4}{$ {#3} \, \diff{}{#4}$}} } } This is the largest symbol I have adjusted for personal use.

  • Circle with tkz-euclide and transform shape goes wrong
    by Sander on August 31, 2026 at 6:41 pm

    I'm using tkz-euclide to draw a circle with center M through point A: \documentclass{article} \usepackage{tikz} \usepackage{tkz-base} \usepackage{tkz-euclide} \begin{document} \tikzset{ xaxe style/.style ={-}, yaxe style/.style ={-}, } \begin{tikzpicture}[scale=0.6, transform shape] \tkzInit[xmin=-3,xmax=7,ymin=-4,ymax=6] \tkzGrid[color=black!20](-3.5, -4.5)(7.5, 6.5) \tkzDrawX[left space=0.5, right space=0.5] \tkzDrawY[up space=0.5, down space=0.5] \tkzLabelX[orig=false] \tkzLabelY[orig=false] \tkzDefPoint(0,0){O} \tkzLabelPoint[below left=2pt](O){\(O\)} \tkzDefPoints{2/1/M, -2/-2/A} \tkzDrawCircle[draw=blue!80!black, line width=.75pt](M,A) \tkzDrawPoints[fill=black, size=4](M,A) \tkzLabelPoint[below left](A){\(A\)} \tkzLabelPoint[below right](M){\(M\)} \end{tikzpicture} \end{document} The result of this code is a circle with center M, but not through A: Apparently this is caused by using transform shape in combination with scale=0.6. When I remove transform shape everything works fine. Does anybody know how to make tkz-euclide draw the correct circle in combination with transform shape?

  • `\tl_replace_all` doesn’t work with counters
    by fauve on August 31, 2026 at 2:55 pm

    The goal I try to make a macro witch transform arabic digits (0123456789) into farsi ones (). The final goal is to transform counters, espaceilaly page counters intor farsi form. The current situation I made the command, it work when I just use normal input numbers, but it fail when I give it a counter. MWE \documentclass{article} \usepackage{fontspec} \newfontfamily\arabicfont[ Ligatures=TeX, Script=Arabic, Language=Persian, ]{IranNastaliq} % Conversion des chiffres occidentaux en chiffres persans \ExplSyntaxOn \NewDocumentCommand{\persiandigits}{m} { \tl_set:Nn \l_tmpa_tl {#1} \tl_replace_all:Nnn \l_tmpa_tl {0} {۰} \tl_replace_all:Nnn \l_tmpa_tl {1} {۱} \tl_replace_all:Nnn \l_tmpa_tl {2} {۲} \tl_replace_all:Nnn \l_tmpa_tl {3} {۳} \tl_replace_all:Nnn \l_tmpa_tl {4} {۴} \tl_replace_all:Nnn \l_tmpa_tl {5} {۵} \tl_replace_all:Nnn \l_tmpa_tl {6} {۶} \tl_replace_all:Nnn \l_tmpa_tl {7} {۷} \tl_replace_all:Nnn \l_tmpa_tl {8} {۸} \tl_replace_all:Nnn \l_tmpa_tl {9} {۹} \tl_use:N \l_tmpa_tl } \ExplSyntaxOff \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{% \thepage\quad \arabicfont\persiandigits{\thepage} } \begin{document} Chiffres normaux : 12345 Chiffres persans : {\arabicfont\persiandigits{12345}} Numéro de page : {\arabicfont\persiandigits{\the\value{page}}} \end{document} Rendernig Chiffres normaux : 12345 Chiffres persans : ۱۲۳۴۵ Numéro de page : 1 <- here the problem happend The question How to make \persiandigits even work with \thepage ?

  • Two columns of items
    by Andy Fletcher on August 31, 2026 at 8:54 am

    I'm creating a list of items in two columns as the picture show, with the first half in the left and the second one in the right. In the process I used minipage, but the items are not horizontal aligned, line by line. For instance, in the example, item 1 and 3 are not under the same horinzontal line. There is a way to creating these two columns such that, in each line, the items are in the same horinzontal line? Thanks. \documentclass{article} \usepackage{amsmath} \usepackage{enumitem} \begin{document} \begin{enumerate} \begin{minipage}[l]{0.45\textwidth} \item a. \item b. \end{minipage} \begin{minipage}[l]{0.45\textwidth} \item c: $\dfrac{\dfrac{a}{b}}{2}$. \item d \end{minipage} \end{enumerate} \end{document}

  • Why box255 has non-zero depth when height is sufficient?
    by Igor Liferenko on August 31, 2026 at 5:50 am

    If we run TeX on this file \immediate\write16{vsize=\the\vsize} \def\pagebody{\immediate\write16{ht=\the\ht255 \space dp=\the\dp255 } \box255 } \hbox{A\vrule depth1pt B} \eject \end we get this output vsize=643.20255pt ht=643.20255pt dp=1.0pt Why height of box255 is equal to vsize while the height of hbox is less then vsize? Also, vsize is large enough to contain height+depth of hbox, but box255 has depth of hbox. Why? Where is this behavior documented in TeXbook?

  • Suppressing an expl3 warning [duplicate]
    by Andrew Stacey on August 30, 2026 at 10:58 pm

    I've installed TeXLive 2026, and for some reason there's a mismatch between expl3 versions: the package that got installed and the LaTeX format. I get a warning when a package loads expl3 explicitly: ! LaTeX Error: Mismatched LaTeX support files detected. (LaTeX) Loading 'expl3.sty' aborted! (LaTeX) (LaTeX) The L3 programming layer in the LaTeX format (LaTeX) is dated 2026-03-20, but in your TeX tree the files require (LaTeX) at least 2026-04-28. For immediate help type H <return>. ... l.78 \ExplLoaderFileDate{expl3.sty}} % While I can remove the explicit load of expl3 from my own packages, I find that there are still plenty in the TL tree that load it for themselves (the current culprit being unicode-math). What's the best way to get rid of this warning? Did a step fail to run when I last updated TeXLive (and if so, how do I force it?)? The reason why I can't just ignore it is that it's messing up some automatic scripts that rely on LaTeX's exit codes.

  • Including Octave source code and output in LaTeX document?
    by Kevin Zembower on August 29, 2026 at 7:56 pm

    all, I'm trying to create a LaTeX document that contains both source Octave code and output, like the way that Rmarkdown can be used to create a LaTeX document with both R source code and its output. Here's an example of what I'm trying to do, in a file named 'Ex.tex': \documentclass{article} \title{Exercise 1.1 T1} \author{Kevin Zembower} \date{} \begin{document} \maketitle \section{T1} This is an example from the documentation: ```{octave,engine.path='/usr/bin/octave',results='asis',echo=TRUE} x=-10:0.1:10; plot (x, sin (x)); print -djpg ./myfigure.jpg ``` Import the generated figure: ![My Plot of sin()]{./myfigure.jpg} \end{document} I don't know whether to put this code in a .Rnw, or .tex file. I'm not sure whether to use the << >> or ```{} delimiters. I'm producing the document in Emacs with LaTeX and Polymode enabled. I'm familiar with the latex interpreter in Octave, but I don't want to use it. I want more control over the document's appearance than the markdown in Octave allows. Can I use KnitR to combine Octave and LaTeX? I tried to use the ```{} delimters with the code in a .tex file, but when it's processed with pdflatex, it doesn't execute the Octave code. Am I missing a step to knit or sweave the code? Any help getting started? Any advice or guidance is appreciated. I think I'm confusing KnitR, Rmarkdown and LaTeX codes, with a lot of frustration. -Kevin

  • Designing consistent, good-looking inline TikZ nodes for keyboard keys and menu items
    by Marco Moldenhauer on August 29, 2026 at 6:38 pm

    I am creating my own inline TikZ commands for a Blender tutorial. So far, I have defined three commands: \KeyboardLetter{...} for keyboard letters, such as \KeyboardLetter{A} \KeyboardSymbol{...} for keyboard symbols, such as \KeyboardSymbol{\shift} \BlenderMenu{...} for Blender menu items, such as \BlenderMenu{Object Mode} My main requirement is that all three types of inline nodes should have the same height, regardless of their contents. I am not particularly happy with my current design (see the output below). How could I improve the design so that keyboard letters, keyboard symbols, and Blender menu items look like they belong to the same visual system? Maybe someone has a creative idea or a nice design suggestion? 🙂 my Code \documentclass{article} \usepackage{menukeys} \tikzset{ keystroke/.style={ draw=black!50, fill=yellow!20, %drop shadow={shadow xshift=0.15ex,shadow yshift=-0.15ex,fill=black,opacity=0.7}, rectangle, %rounded corners=0.8pt, inner xsep=1.5pt, inner ysep=1.5pt, line width=0.3pt, %minimum width=0.21cm, %minimum height=0.21cm, font=\sffamily\small, %text=blue!75!black, %anchor=south } } \newcommand*\KeyboardLetter[1]{% \tikz[baseline=(key.base)] % \node[keystroke](key) {#1} ;% } \newcommand*\KeyboardSymbol[1]{% \tikz[baseline=(key.base)]{% \node[keystroke,inner sep=1.5pt] (key) {\phantom{A}}; \node[ inner sep=0.8pt, transform shape, scale=0.75 ] at (key.center) {#1}; }% } \newcommand*\BlenderMenu[1]{% \tikz[baseline=(key.base)] % \node[% keystroke, %signal, fill=red!5 ](key) {#1} ;% } \begin{document} \KeyboardSymbol{\tab}\KeyboardLetter{A}\KeyboardLetter{P}\KeyboardLetter{=}\KeyboardSymbol{\shift}\KeyboardLetter{,}\BlenderMenu{Object Mode}\BlenderMenu{Edit Mode} \end{document} my Output

  • tcolorbox suboptimal connexion with dotted borderline
    by Denis Bitouzé on August 29, 2026 at 2:40 pm

    The example of a dotted borderline in the tcolorbox's documentation (currently page 207): \documentclass{article} \usepackage{tcolorbox} \usepackage{lipsum} \tcbuselibrary{skins} \begin{document} \begin{tcolorbox}[enhanced,arc=3mm,boxrule=1.5mm, frame hidden,colback=blue!10!white, borderline={1mm}{0mm}{blue,dotted} ] \lipsum[2] \end{tcolorbox} \end{document} is miraculously well-connected. But, in general, the connexion is only suboptimal, as shown in the following picture (look at its southwestern corner), obtained by replacing \lipsum[2] by \lipsum[1] in the previous example: Is there a way to get an optimal connexion, I mean automatically, by computing the height of the box and adapting the size of the dots and/or of the space between them?