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

  • newline in caption of tabularray
    by albert on September 4, 2026 at 4:22 pm

    A bit a similar question to Create a hyper link in caption of tabularray with a different "payload": \begin{DoxyTable}{1}{PRE~\newline POST}{}{0} Some longer text for better visibility\\ \end{DoxyTable} As can be seen in the output there is no newline there: Unfortunately the solution of Create a hyper link in caption of tabularray (using \protect) does not work here. Where DoxyTable is the wrapper as used and shown in the following (and a bit large) MWE: \documentclass[twoside]{book} \usepackage[pdftex,pagebackref=true]{hyperref} \usepackage{tabularray} \usepackage{longtable} \UseTblrLibrary{varwidth} \ExplSyntaxOn \dim_new:N \doxytablewidth \NewDocumentCommand \doxycalculatetablewidth {} { \cs_set_protected:Nn \__tblr_build_whole: { \__tblr_get_table_width: \dim_gset:Nn \doxytablewidth { \tablewidth } } } \ExplSyntaxOff % define a theme for the DoxyTable environment (without caption) \NewTblrTheme{DoxyTableBareTheme}{ \DefTblrTemplate{firsthead}{default}{}% \DefTblrTemplate{middlehead, lasthead}{default}{}% \DefTblrTemplate{contfoot-text}{default}{}% } % define a theme for the DoxyTable environment (with caption) \NewTblrTheme{DoxyTableCaptionTheme}{ \SetTblrStyle{firsthead}{font=\bfseries}{}% \DefTblrTemplate{middlehead, lasthead}{default}{}% \DefTblrTemplate{contfoot-text}{default}{}% } % Define a table environment to use with Doxygen % parameters: % - #1: number of columns % - #2: table caption (can be empty) % - #3: label to refer to the table (can be empty) % - #4: 1=table has a heading row, 0=no heading row % - #5: body of the table (part between start{DoxyTable}..\end{DoxyTable} \NewDocumentEnvironment{DoxyTable}{m +m m m +b}{% \par% \def\hascaption{#2}% \def\haslabel{#3}% \ifx\hascaption\empty% if caption is empty \SetTblrOuter[longtblr]{theme=DoxyTableBareTheme,entry=none}% table without caption or label \else% caption not empty \ifx\haslabel\empty% if label is empty \SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2}}% set table caption \else% label not empty \SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2},label={#3}}% set table caption and label \fi% \fi% \begingroup \doxycalculatetablewidth \sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \doxytablewidth \begin{tblr}{hlines,vlines,measure=vbox,colspec={*{#1}{l}}}% #5 \end{tblr}% }% end of sbox0 \endgroup \ifdim\doxytablewidth>\linewidth% use flexible columns % now render the table for real \begin{longtblr}{hlines,vlines,% automatically set horizontal and vertical cell lines measure=vbox,% needed to allow nested lists and tables colspec={*{#1}{X[-1]}},% set column type for all columns rowhead=#4} % set which row is the header (0=disable, 1=enable) #5 \end{longtblr}% \else% use fixed left aligned columns % now render the table for real \begin{longtblr}{hlines,vlines,% automatically set horizontal and vertical cell lines measure=vbox,% needed to allow nested lists and tables colspec={*{#1}{l}},% set column type for all columns rowhead=#4} % set which row is the header (0=disable, 1=enable) #5 \end{longtblr}% \fi% }{% no end marker needed anymore }% \usepackage{caption} \captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top} \begin{document} Test \hypertarget{index_bbb}{} \begin{DoxyTable}{1}{PRE~\newline POST}{}{0} Some longer text for better visibility\\ \end{DoxyTable} \end{document} How to solve this problem?

  • Create a hyper link in caption of tabularray
    by albert on September 4, 2026 at 3:47 pm

    I want to create a hyper link in the cation of a tabularray like: \begin{DoxyTable}{1}{PRE\hyperlink{index_bbb}{Table}POST}{}{0} Some longer text for better visibility\\ \end{DoxyTable} but I get an error like: ! Undefined control sequence. \hyper@@link ->\let \Hy@reserved@a \relax \@ifnextchar [{\hyper@link@ }{\hyp... l.93 \end {DoxyTable} ? Where DoxyTable is the wrapper as used and shown in the folowing MWE: \documentclass[twoside]{book} \usepackage[pdftex,pagebackref=true]{hyperref} \usepackage{tabularray} \usepackage{longtable} \UseTblrLibrary{varwidth} \ExplSyntaxOn \dim_new:N \doxytablewidth \NewDocumentCommand \doxycalculatetablewidth {} { \cs_set_protected:Nn \__tblr_build_whole: { \__tblr_get_table_width: \dim_gset:Nn \doxytablewidth { \tablewidth } } } \ExplSyntaxOff % define a theme for the DoxyTable environment (without caption) \NewTblrTheme{DoxyTableBareTheme}{ \DefTblrTemplate{firsthead}{default}{}% \DefTblrTemplate{middlehead, lasthead}{default}{}% \DefTblrTemplate{contfoot-text}{default}{}% } % define a theme for the DoxyTable environment (with caption) \NewTblrTheme{DoxyTableCaptionTheme}{ \SetTblrStyle{firsthead}{font=\bfseries}{}% \DefTblrTemplate{middlehead, lasthead}{default}{}% \DefTblrTemplate{contfoot-text}{default}{}% } % Define a table environment to use with Doxygen % parameters: % - #1: number of columns % - #2: table caption (can be empty) % - #3: label to refer to the table (can be empty) % - #4: 1=table has a heading row, 0=no heading row % - #5: body of the table (part between start{DoxyTable}..\end{DoxyTable} \NewDocumentEnvironment{DoxyTable}{m +m m m +b}{% \par% \def\hascaption{#2}% \def\haslabel{#3}% \ifx\hascaption\empty% if caption is empty \SetTblrOuter[longtblr]{theme=DoxyTableBareTheme,entry=none}% table without caption or label \else% caption not empty \ifx\haslabel\empty% if label is empty \SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2}}% set table caption \else% label not empty \SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2},label={#3}}% set table caption and label \fi% \fi% \begingroup \doxycalculatetablewidth \sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \doxytablewidth \begin{tblr}{hlines,vlines,measure=vbox,colspec={*{#1}{l}}}% #5 \end{tblr}% }% end of sbox0 \endgroup \ifdim\doxytablewidth>\linewidth% use flexible columns % now render the table for real \begin{longtblr}{hlines,vlines,% automatically set horizontal and vertical cell lines measure=vbox,% needed to allow nested lists and tables colspec={*{#1}{X[-1]}},% set column type for all columns rowhead=#4} % set which row is the header (0=disable, 1=enable) #5 \end{longtblr}% \else% use fixed left aligned columns % now render the table for real \begin{longtblr}{hlines,vlines,% automatically set horizontal and vertical cell lines measure=vbox,% needed to allow nested lists and tables colspec={*{#1}{l}},% set column type for all columns rowhead=#4} % set which row is the header (0=disable, 1=enable) #5 \end{longtblr}% \fi% }{% no end marker needed anymore }% \usepackage{caption} \captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top} \begin{document} Test \hypertarget{index_bbb}{} \begin{DoxyTable}{1}{PRE\hyperlink{index_bbb}{Table}POST}{}{0} Some longer text for better visibility\\ \end{DoxyTable} \end{document} (Hopefully I didn't strip to much packages, but in that case the missing packages are not relevant for the problem as the specific code is, apparently, not entered). How to solve this problem?

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

  • How to change the spacing between the title, the text, and the equation itself?
    by Alastair Stratford on September 4, 2026 at 9:04 am

    The spacing between the title and text, and the text itself and equation is bit too much for me. The equation on the middle is also small. This is what I've come up so far. \documentclass[12pt,english]{article} \usepackage[left=1in, right=1in, top=1in, bottom=1in]{geometry} \usepackage{blindtext} \title{Formal Definition of Limits\\ (Epsilon-Delta Definition)} \date{} \begin{document} \maketitle A simpler way to understand limits is when a certain function $f(x)$ approaches a certain value $a$, but not exactly to it, thus it has a limit $L$. Or we can write it like this: \[ \lim_{x \to a } f(x) = L \] \end{document} And this is the result so far:

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

  • why adding a label at the end of the document is not found?
    by R. N on September 3, 2026 at 9:12 pm

    In order to be compliant with a template given by my company, I need to have a main part and optionally an appendix. My problem is that the foot of the main part should contain the total number of pages only for the main part while the appendix's foot should restart the counter. Therefore, I thought about lastpage package. But this one is not accepting that I put 'its' label somewhere else (when I start the appendix), because it redefines the label anyway. So I thought that I could mimic lastpage by adding a label at the end of the document if this label has not been defined. This works correctly if I add my label in the middle of the document, but not if the label is not detected at the end of the document. (So, okay I could do everything manually but since the final purpose is to share this template with co-workers, they will make mistakes for sure and complain) Here is a MWE: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lastpage} % or another \usepackage{fancyhdr} \pagestyle{fancy} \fancyfoot[C]{\thepage{}/\pageref{LastMainPage}} \makeatletter \AddToHook{enddocument}{% or enddocument/afterlastpage \@ifundefined{r@LastMainPage}{% add \label{LastMainPage}% }{def}% } \makeatother \begin{document} page 1/2 \newpage page 2/2 % % appendix are optional so commented for this test % \newpage % \appendix % \label{LastMainPage} % then I will add it to \appendix % \pagenumbering{roman} % \fancyfoot[C]{\thepage{}} % appendix i % \label{LastMainPage} % if I uncomment this is working \end{document} In this example, despite the fact that I can see add on the produced pdf (indicating that the if condition works correctly in the hook at the end of the document), I get the warning: Reference 'LastMainPage' on page 2 undefined on input line 29 and very logically I have 2/?? on the produced foot. EDIT: to be more precise, I just realized that this unwanted behaviour appears when I use latexmk as I will be done on Overleaf. While if I run pdflatex or lualatex twice, on the first compilation the reference is not found while on the second it is as expected. latexmk version: 9 March 2026. Version 4.88 pdfTeX version: 3.141592653-2.6-1.40.29 (TeX Live 2026) luaTeX Version: 1.24.0 (TeX Live 2026) So do you see a simple way to solve this ? Is there a way to add a label at the end of a document without getting the warning/error: Reference 'LastMainPage' on page 2 undefined on input line 29 ? Or is there a way to redirect a label to another (here LastMainPage would point toward LastPage) if it has not been found ?

  • Underscores in header inconsistent between pages [closed]
    by Mstislav Keldysh on September 3, 2026 at 7:27 pm

    Consider the following document: \documentclass[12pt,letterpaper,final]{article} \usepackage[margin=2.54 cm]{geometry} \usepackage{wrapfig} \usepackage{setspace} \usepackage{xcolor} \usepackage{graphicx} \usepackage{caption} \usepackage{hyperref} \usepackage{amssymb} \usepackage{gensymb} \usepackage[fleqn]{amsmath} \usepackage[shortlabels]{enumitem} \usepackage[version=4]{mhchem} %\usepackage[para,bottom]{footmisc} \usepackage{fancyhdr} \fancyhf{} \fancypagestyle{plain}{ \fancyhf{} \lhead{THING} \chead{\textbf{A TITLE}} \rhead{Name} \fancyfoot[C]{\thepage} } \pagestyle{fancy} \lhead{THING} \chead{\textbf{A TITLE}} \rhead{NAME} \fancyfoot[C]{\thepage} \begin{document} LOTS OF TEXT \end{document} When I compile this, on the first page I get two underscores in the header: On the second page, I only get one: I don't know why. I want to have everything like the 2nd page with only one underscore. I use tectonic as my compiler.

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

  • How to replicate \exists symbol [duplicate]
    by AGI on September 3, 2026 at 12:29 pm

    I want to renew the command and add features to the macro but I want to replicate exactly the symbol without using \exists. Does anybody know how to check its definition or replicate it? It seems it isn't from any package and so don't know where to check its definition.

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

  • faild restore orignial landscape/portrait mode when \pdfpagewidth and \pdfpageheight changed [duplicate]
    by lyl on September 3, 2026 at 7:28 am

    I tried to insert some landscape pages in my portrait document, as this: V1: \documentclass[a4paper]{article} \usepackage{geometry} \usepackage{lipsum} \begin{document} \lipsum[1-2] % content of portrait wanted % switch to landscape \clearpage \newgeometry{margin=2cm} %This does not work, the margin does not change as the set. \pdfpagewidth=297mm \pdfpageheight=210mm \lipsum[3-6] % content of landscape wanted % restore to portrait \clearpage \restoregeometry %This does not work, the following pages are still landscape \lipsum[7-8] \end{document} Landscape page is created when reset the lengthes \pdfpagewidth and \pdfpageheight. But the document can not restore portrait mode any more by \restoregeometry. And \newgeometry{margin=2cm} does not take any effect. (and page numbering lost) What's wrong with my codes and how to make them work (without dependence on any other packages)? I tried another method like the following and failed also: V2: \documentclass[a4paper]{article} \usepackage{geometry} \usepackage{lipsum} \begin{document} \lipsum[1-2] \clearpage \newgeometry{paperwidth=297mm, paperheight=210mm, margin=2cm} \lipsum[3-6] \clearpage \restoregeometry \lipsum[7-8] \end{document} Does that mean Latex itself is unable to change landscape/portrat mode in document body?

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

  • Related to head note of an article [closed]
    by Rup_LA on September 2, 2026 at 6:04 pm

    I have seen a good head note with many details in the document written and shared by my professor. I want to use it too in my documents. I am showing an example of this here: How can I imitate it in my documents? I've tried but failed. So any help will be appreciated.

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

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