Week
- Placing text at the end of the last line of center environmentby mbert on August 3, 2026 at 11:04 pm
I'm working on some code to improve amsthm's \qedhere in various list-type environments, e.g., center. I'm having trouble getting the placement right in the last line of the center environment. The default of amsthm is to insert an \hfill which causes the text on the last line to be placed flush left. Here's an example showing the effect of \hfill and amsthm's default behavior. \documentclass{article} \usepackage[nopar]{kantlipsum} \usepackage{amsthm} \begin{document} \begin{center} \kant[1][1-2] \hfill\qedsymbol % not good \end{center} \begin{center} \kant[1][1-2]% this doesn't work \makebox[0pt]{\mbox{}\hfill\qedsymbol} \end{center} \begin{proof} \begin{center} \kant[1][1-2] \qedhere % not good \end{center} \end{proof} \end{document} Is there a way to place the \qedsymbol at the end of the line without affecting the text in that line? My first idea was to use a zero-width box but I couldn't figure out the right combination of (possibly nested) \makeboxes. Ideally, if the last line did not have room for the \qedsymbol, it would be moved to the end of the following line. I'm hoping to do this without writing to the aux with \pdfsavepos (as in the linegoal package).
- Octavo class. Is it possible to obtain a oneside document?by Yves on August 3, 2026 at 7:00 pm
I am trying to evaluate the best possible option for a friend to compose a book of her poems. I have found that the poetrytex package has the necessary features. However I sense my friend could be attracted by the appearance created by the octavo class. She intends to have her book printed, but also wishes to obtain a pdf file to share easily with remote friends. I was unable to get the oneside option working in the octavo class, which may be by design. A file containing poems with a change of margins on each page is not visually attractive, while a book obviously is. \documentclass[12pt,oneside,titlepage,imperial]{octavo} \usepackage{lipsum} \begin{document} \title{Test octavo class} \maketitle \lipsum[1-10] \newpage \lipsum[5-9] \end{document}
- \SI{}{} Units Are Converted into Multiple MathML Elements Instead of a Single MathML Elementby rcv on August 3, 2026 at 3:36 pm
Issue: Each \SI{}{} unit is converted into two separate MathML elements instead of a single MathML element. Requirement: How can each \SI{}{} expression be converted into a single MathML element? Example: For example, \SI{14.7}{\percent} is currently converted into two separate MathML elements—one for 14.7 and another for %. It should instead be converted into a single MathML element representing the complete SI value and unit. MWE: \documentclass{book} \usepackage{siunitx} \usepackage{algorithm2e} \usepackage{algpseudocode} \begin{document} Manufacturing decarbonization requires emission control that remains auditable under regulatory uncertainty. We propose Carbon-Conformal Manufacturing (CCM), which uses one-sided conformal upper bounds and Carbon Compliance Certificates to connect hourly control decisions with EU ETS and CBAM reporting logic in paper-mill energy systems. On 12 months of source-plant data, CCM reduces carbon emissions by \SI{14.7}{\percent} while maintaining \SI{99.1}{\percent} of production and achieving \SI{96.2}{\percent} empirical coverage at a \SI{95}{\percent} target. In two validated digital-twin variants, coverage remains between \SI{95.4}{\percent} and \SI{96.6}{\percent}, with carbon reduction between \SI{14.2}{\percent} and \SI{14.7}{\percent}. Point optimization reaches \SI{11.3}{\percent} reduction, Bayesian uncertainty intervals reach \SI{93.8}{\percent} coverage, and removing conformal calibration reduces coverage to \SI{87.0}{\percent} while increasing violation events by \SI{23}{\percent}. CCM improves carbon reduction per compute-hour by \SI{11.5}{\percent} over RL-noCP and yields annualized savings of 2,831 tCO$_2$e and 244 kEUR at 86 EUR/t. Temporal and stress tests show stable monthly coverage, and an 8-week shadow deployment sustains weekly monitoring performance under operator review. Live closed-loop actuation remains future work, and the paper's claim boundary is limited to source-plant, digital-twin, and shadow-deployment evidence. \end{document} Produced Output: <!--l. 8--><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mn>1</mn><mn>4</mn><mo class="MathClass-punc" stretchy="false">.</mo><mn>7</mn></math> <!--l. 8--><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mstyle mathvariant="normal"><mi >%</mi></mstyle></math>
- Code Review: A custom TikZ package for drawing Chemistry Reaction Progress Tables (ICE tables)by Natsu on August 3, 2026 at 2:33 pm
As part of my workflow for typesetting educational materials, I frequently need to draw Chemistry Reaction Progress Tables (often known as ICE tables). To automate this, I am developing a small custom package using tikz called tkzPhysTab. The package calculates the grid coordinates automatically based on the number of reactants and products, places the $+$ and $\rightarrow$ signs, and allows adding rows dynamically. Here is the package code (tkzPhysTab.sty): \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{tkzPhysTab}[2025/11/07 Physical Reaction Table by Khaldi] \RequirePackage{tikz} % ============================= % Default Values % ============================= \def\tkzPhysTabFirstColWidth{1.5} % Width of the first column \def\tkzPhysTabColWidth{2.5} % Width of the data columns \def\tkzPhysTabRowHeight{1.0} % Row height % ============================= % Setup pgfkeys % ============================= \pgfkeys{ /tkzPhysTab/.is family, /tkzPhysTab, firstcol/.store in = \tkzPhysTabFirstColWidth, colwidth/.store in = \tkzPhysTabColWidth, rowheight/.store in = \tkzPhysTabRowHeight, reset/.code = { \def\tkzPhysTabFirstColWidth{1.5} \def\tkzPhysTabColWidth{2.5} \def\tkzPhysTabRowHeight{1.0} } } % Counters (Note: I am aware calling \newcounter here might cause issues if called twice, looking for better alternatives) \newcounter{tkzcolsOne} \newcounter{tkzcolsTwo} \newcounter{tkzlevel} \newcounter{tkzrows} % ============================= % Table Initialization Command % ============================= \newcommand{\tkzPhysicsTabInit}[4][]{% % Reset default values \pgfkeys{/tkzPhysTab/reset} % Apply custom options from [options] \pgfkeys{/tkzPhysTab,#1} \setcounter{tkzcolsOne}{0} \setcounter{tkzcolsTwo}{0} \setcounter{tkzlevel}{1} \setcounter{tkzrows}{0} \foreach \c in {#3}{\stepcounter{tkzcolsOne}} \foreach \c in {#4}{\stepcounter{tkzcolsTwo}} \foreach \r in {#2}{\stepcounter{tkzrows}} \pgfmathtruncatemacro{\ncolData}{\thetkzcolsOne + \thetkzcolsTwo} \pgfmathtruncatemacro{\nrows}{\thetkzrows + 1} \pgfmathsetmacro{\W}{\tkzPhysTabFirstColWidth + \ncolData * \tkzPhysTabColWidth} \pgfmathsetmacro{\H}{\nrows * \tkzPhysTabRowHeight} \coordinate (T) at (0,0); \draw[very thick] (T) rectangle (\W,-\H); % Vertical lines \draw (\tkzPhysTabFirstColWidth, 0) -- (\tkzPhysTabFirstColWidth, -\H); \foreach \i in {1,...,\ncolData}{ \pgfmathsetmacro{\xpos}{\tkzPhysTabFirstColWidth + \i * \tkzPhysTabColWidth} \draw (\xpos, -\tkzPhysTabRowHeight) -- (\xpos, -\H); } % Horizontal lines \foreach \j in {1,...,\nrows}{ \draw (0, -\j*\tkzPhysTabRowHeight) -- (\W, -\j*\tkzPhysTabRowHeight); } % Reactants \foreach [count=\i from 1] \c in {#3} { \pgfmathsetmacro{\xcenter}{\tkzPhysTabFirstColWidth + (\i - 0.5) * \tkzPhysTabColWidth} \node at (\xcenter, -\tkzPhysTabRowHeight/2) {\c}; \ifnum\i>1 \pgfmathsetmacro{\xplus}{\tkzPhysTabFirstColWidth + (\i - 1) * \tkzPhysTabColWidth} \node at (\xplus, -\tkzPhysTabRowHeight/2) {$+$}; \fi } % Arrow between reactants and products \pgfmathtruncatemacro{\nReact}{\thetkzcolsOne} \pgfmathsetmacro{\xarrow}{\tkzPhysTabFirstColWidth + \nReact * \tkzPhysTabColWidth} \node at (\xarrow, -\tkzPhysTabRowHeight/2) {$\rightarrow$}; % Products \foreach [count=\i from 1] \c in {#4} { \pgfmathsetmacro{\xcenter}{\xarrow + (\i - 0.5) * \tkzPhysTabColWidth} \node at (\xcenter, -\tkzPhysTabRowHeight/2) {\c}; \ifnum\i>1 \pgfmathsetmacro{\xplus}{\xarrow + (\i - 1) * \tkzPhysTabColWidth} \node at (\xplus, -\tkzPhysTabRowHeight/2) {$+$}; \fi } % Row labels \foreach [count=\j from 1] \r in {#2} { \pgfmathsetmacro{\ycenter}{-(\j + 0.5) * \tkzPhysTabRowHeight} \node at (\tkzPhysTabFirstColWidth/2, \ycenter) {\r}; } } % ============================= % Add Row Command % ============================= \newcommand{\tkzPhysicsTabLine}[1]{% \stepcounter{tkzlevel} \foreach [count=\i from 1] \val in {#1} { \pgfmathsetmacro{\xcenter}{\tkzPhysTabFirstColWidth + (\i - 0.5) * \tkzPhysTabColWidth} \pgfmathsetmacro{\ycenter}{-(\thetkzlevel - 0.5) * \tkzPhysTabRowHeight} \node at (\xcenter, \ycenter) {\val}; } } And here is the Minimum Working Example (MWE) generating the table: \documentclass[border=5mm]{standalone} \usepackage{tkzPhysTab} \begin{document} \begin{tikzpicture} \tkzPhysicsTabInit[firstcol=2.0,colwidth=3,rowheight=1.2]% {$x=0$,$x=t$,$x=f$}% {$Fe_3O_4$,$4H_2$}% {$3Fe$,$4H_2O$} \tkzPhysicsTabLine{$2.18$,$9.65$,$0$,$0$} \tkzPhysicsTabLine{$2.18-x$,$-4x$,$?$,$?$} \tkzPhysicsTabLine{$2.18-x_{\max}$,$-4x_{\max}$,$??$,$??$} \end{tikzpicture} \end{document} My questions for the experts: I initially defined \newcounter inside \tkzPhysicsTabInit, which caused an error when calling the table twice. I fixed this by declaring the counters globally in the package file and using \setcounter inside the macro to reset them. Is this the standard LaTeX best practice, or is there a more elegant way to handle local counters/variables in this context without polluting the global namespace? Is manually calculating coordinates using \pgfmathsetmacro the most efficient way to draw this grid, or would you recommend using TikZ libraries like matrix or integrating with packages like tabularray? Are there any other optimizations or best practices you would suggest to make this package more robust for general users? Thank you in advance for your insights!
- Why new line is added when glue is zero?by Igor Liferenko on August 3, 2026 at 8:12 am
The following two examples demonstrate that when \hskip becomes zero, an empty line is added: \hfuzz=10000pt \hsize=0pt \noindent\hskip0pt thirteen\hskip0pt---\hskip1sp dimensional \bye \hfuzz=10000pt \hsize=0pt \noindent\hskip0pt thirteen\hskip0pt---\hskip0sp dimensional \bye
- Footnote order problem in old version of elsarticleby C.F.G on August 2, 2026 at 6:59 pm
I encountered the following footnote ordering and numbering problem in old version of elsarticle.cls class. Footnotes in the main text should be placed after the footnotes for title and authors. I know that this problem does not occur in the new version of elsarticle i.e. cas-sc.cls. How can I fix this problem? (numbering and order of footnotes) MWE \documentclass[3p, times]{elsarticle} \usepackage{lipsum} \begin{document} \begin{frontmatter} \title{Angels of Minab} % Authors names \author[add1]{Makan Nasiri\fnref{label1}} \ead{email address} \author[add1]{Amir-Ali Jadavi\corref{cor1}\fnref{label2}} \ead{email address} %\ead[url]{home page} \fntext[label1]{Victim of the US attack; remains never recovered} \fntext[label2]{Victim of the US attack; remains never recovered} \cortext[cor1]{corresponding author} \address[add1]{Shajareh Tayyebeh Elementary School, Minab, Hormozgan province, Iran} \begin{abstract} %% Text of abstract This paper presents a study on the...\footnote{a footnote}\footnote{a footnote}\footnote{a footnote}\footnote{a footnote} \end{abstract} \begin{keyword} Makan Nasiri \sep Amir-Ali Jadavi \end{keyword} \end{frontmatter} \section{part 1} \lipsum[1-2] \section{part 2} \label{} \lipsum[1-2] \end{document}
- How to put the content of a table in a separate file [duplicate]by Roland Chastain on August 2, 2026 at 5:59 pm
The following file (demo5.tex) is generated by a program. 2026 & & & & & 18 fév. & 5 avr. & & & & & \\ 2027 & & & & & 10 fév. & 28 mars & & & & & \\ 2028 & & & & & 1er mars & 16 avr. & & & & & \\ 2029 & & & & & 14 fév. & 1er avr. & & & & & \\ 2030 & & & & & 6 mars & 21 avr. & & & & & \\ 2031 & & & & & 26 fév. & 13 avr. & & & & & \\ 2032 & & & & & 11 fév. & 28 mars & & & & & \\ 2033 & & & & & 2 mars & 17 avr. & & & & & \\ 2034 & & & & & 22 fév. & 9 avr. & & & & & \\ 2035 & & & & & 7 fév. & 25 mars & & & & & \\ 2036 & & & & & 27 fév. & 13 avr. & & & & & \\ 2037 & & & & & 18 fév. & 5 avr. & & & & & \\ 2038 & & & & & 10 mars & 25 avr. & & & & & \\ 2039 & & & & & 23 fév. & 10 avr. & & & & & \\ 2040 & & & & & 15 fév. & 1er avr. & & & & & \\ 2041 & & & & & 6 mars & 21 avr. & & & & & \\ 2042 & & & & & 19 fév. & 6 avr. & & & & & \\ 2043 & & & & & 11 fév. & 29 mars & & & & & \\ 2044 & & & & & 2 mars & 17 avr. & & & & & \\ 2045 & & & & & 22 fév. & 9 avr. & & & & & \\ I try to include it in my main document as follows (document.tex) : \documentclass[a4paper,landscape,12pt]{article} \usepackage{tabularray} \usepackage{showframe} \usepackage{geometry} \geometry{margin=1in} \usepackage{fontspec} \setmainfont{EBGaramond} \begin{document} \begin{tblr}{*{12}{c}} {Année du\\Seigneur} & {Litt.\\Dom.} & {Nb.\\d'or} & Epactae & {Septua-\\gésime} & Cendres & Pâques & Ascension & Pentecôte & {Fête-\\Dieu} & {Nb. dim.\\ap. Pent.} & {1er dim.\\Avent} \\ \input{demo5.tex} \end{tblr} \end{document} I get this error: $ lualatex document This is LuaHBTeX, Version 1.24.0 (TeX Live 2026/Mageia) restricted system commands enabled. (./document.tex LaTeX2e <2025-11-01> L3 programming layer <2026-01-19> (/usr/share/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class ... *geometry* driver: auto-detecting *geometry* detected driver: luatex (./demo5.tex ! Misplaced alignment tab character &. l.1 2026 & & & & & 18 fév. & 5 avr. & & & & & \\ ? I don't understand the error. If I paste manually the content of demo5.tex in my main document (document2.tex), I can compile the document. \documentclass[a4paper,landscape,12pt]{article} \usepackage{tabularray} \usepackage{showframe} \usepackage{geometry} \geometry{margin=1in} \usepackage{fontspec} \setmainfont{EBGaramond} \begin{document} \begin{tblr}{*{12}{c}} {Année du\\Seigneur} & {Litt.\\Dom.} & {Nb.\\d'or} & Epactae & {Septua-\\gésime} & Cendres & Pâques & Ascension & Pentecôte & {Fête-\\Dieu} & {Nb. dim.\\ap. Pent.} & {1er dim.\\Avent} \\ 2026 & & & & & 18 fév. & 5 avr. & & & & & \\ 2027 & & & & & 10 fév. & 28 mars & & & & & \\ 2028 & & & & & 1er mars & 16 avr. & & & & & \\ 2029 & & & & & 14 fév. & 1er avr. & & & & & \\ 2030 & & & & & 6 mars & 21 avr. & & & & & \\ 2031 & & & & & 26 fév. & 13 avr. & & & & & \\ 2032 & & & & & 11 fév. & 28 mars & & & & & \\ 2033 & & & & & 2 mars & 17 avr. & & & & & \\ 2034 & & & & & 22 fév. & 9 avr. & & & & & \\ 2035 & & & & & 7 fév. & 25 mars & & & & & \\ 2036 & & & & & 27 fév. & 13 avr. & & & & & \\ 2037 & & & & & 18 fév. & 5 avr. & & & & & \\ 2038 & & & & & 10 mars & 25 avr. & & & & & \\ 2039 & & & & & 23 fév. & 10 avr. & & & & & \\ 2040 & & & & & 15 fév. & 1er avr. & & & & & \\ 2041 & & & & & 6 mars & 21 avr. & & & & & \\ 2042 & & & & & 19 fév. & 6 avr. & & & & & \\ 2043 & & & & & 11 fév. & 29 mars & & & & & \\ 2044 & & & & & 2 mars & 17 avr. & & & & & \\ 2045 & & & & & 22 fév. & 9 avr. & & & & & \\ \end{tblr} \end{document} Why?
- How to draw a complex shaded ribbon with a central jewel using TikZ?by Natsu on August 2, 2026 at 7:48 am
I am looking for guidance on how to recreate the attached image (image.png) entirely within LaTeX using TikZ. The image consists of two main complex elements: A red ribbon with intricate curves and realistic 3D-like gradient shading. A multi-faceted jewel/diamond in the center with sharp light reflections. Initially, I thought simulating this 3D effect in TikZ would be too complex, but following the community's helpful feedback and advice on providing a Minimal Working Example (MWE), I decided to tackle both the ribbon and the central jewel to demonstrate my progress. I managed to draw the ribbons using manual Bézier curves and custom shadings to simulate the folds. For the jewel, I used a clipping mask and layered semi-transparent polygons (opacity) to mimic the glass facets and light reflections. Here is my current MWE: \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{shadings,calc} \definecolor{ribbonred}{RGB}{215,10,28} \begin{document} \begin{tikzpicture}[x=3cm,y=3cm] \begin{scope} \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=150] (-0.463,-0.006) .. controls (-0.497,-0.017) and (-0.649,-0.048) .. (-0.672,-0.073) .. controls (-0.680,-0.110) and (-0.637,-0.134) .. (-0.601,-0.158) .. controls (-0.563,-0.147) and (-0.467,-0.035) .. (-0.445,-0.010) .. controls (-0.423,0.015) and (-0.464,-0.008) .. (-0.468,-0.008); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=150] (-0.188,-0.128) .. controls (-0.204,-0.135) and (-0.236,-0.149) .. (-0.281,-0.167) .. controls (-0.320,-0.207) and (-0.380,-0.306) .. (-0.372,-0.502) .. controls (-0.372,-0.717) and (-0.372,-0.842) .. (-0.562,-0.776) .. controls (-0.684,-0.438) and (-0.369,-0.102) .. (-0.231,-0.080) .. controls (-0.199,-0.102) and (-0.195,-0.127) .. (-0.188,-0.136); \fill[% top color=ribbonred!50!black, bottom color=ribbonred!50!black, middle color=ribbonred!80, shading angle=140] (-0.182,-0.067) .. controls (-0.437,-0.096) and (-0.598,-0.685) .. (-0.497,-0.794) .. controls (-0.664,-0.762) and (-0.983,-0.545) .. (-0.870,-0.355) .. controls (-0.742,-0.221) and (-0.518,-0.079) .. (-0.410,0.012) .. controls (-0.295,0.059) and (-0.217,-0.054) .. (-0.180,-0.069) .. controls (-0.142,-0.084) and (-0.196,-0.091) .. (-0.199,-0.095); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=30] (-0.178,0.212) .. controls (-0.206,0.278) and (-0.189,0.365) .. (-0.246,0.416) .. controls (-0.280,0.438) and (-0.328,0.400) .. (-0.328,0.369) .. controls (-0.315,0.330) and (-0.208,0.214) .. (-0.182,0.186) .. controls (-0.157,0.159) and (-0.178,0.209) .. (-0.177,0.213); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=30] (-0.160,0.197) .. controls (-0.221,0.247) and (-0.283,0.409) .. (-0.387,0.469) .. controls (-0.469,0.505) and (-0.508,0.420) .. (-0.521,0.365) .. controls (-0.488,0.312) and (-0.254,0.183) .. (-0.192,0.154) .. controls (-0.129,0.125) and (-0.166,0.190) .. (-0.161,0.198); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=90] (-0.141,0.178) .. controls (-0.350,0.409) and (-0.606,0.510) .. (-0.676,0.366) .. controls (-0.690,0.282) and (-0.678,0.169) .. (-0.660,0.115) .. controls (-0.634,0.025) and (-0.692,-0.075) .. (-0.665,-0.108) .. controls (-0.604,0.016) and (-0.319,-0.044) .. (-0.258,-0.059) .. controls (-0.171,-0.008) and (-0.165,0.163) .. (-0.147,0.207); \end{scope} \begin{scope}[shift={(-0.04, 0.03)}, xscale=-1, shift={(0.04, -0.03)}] \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=30] (-0.463,-0.006) .. controls (-0.497,-0.017) and (-0.649,-0.048) .. (-0.672,-0.073) .. controls (-0.680,-0.110) and (-0.637,-0.134) .. (-0.601,-0.158) .. controls (-0.563,-0.147) and (-0.467,-0.035) .. (-0.445,-0.010) .. controls (-0.423,0.015) and (-0.464,-0.008) .. (-0.468,-0.008); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=30] (-0.188,-0.128) .. controls (-0.204,-0.135) and (-0.236,-0.149) .. (-0.281,-0.167) .. controls (-0.320,-0.207) and (-0.380,-0.306) .. (-0.372,-0.502) .. controls (-0.372,-0.717) and (-0.372,-0.842) .. (-0.562,-0.776) .. controls (-0.684,-0.438) and (-0.369,-0.102) .. (-0.231,-0.080) .. controls (-0.199,-0.102) and (-0.195,-0.127) .. (-0.188,-0.136); \fill[% top color=ribbonred!50!black, bottom color=ribbonred!50!black, middle color=ribbonred!80, shading angle=30] (-0.182,-0.067) .. controls (-0.437,-0.096) and (-0.598,-0.685) .. (-0.497,-0.794) .. controls (-0.664,-0.762) and (-0.983,-0.545) .. (-0.870,-0.355) .. controls (-0.742,-0.221) and (-0.518,-0.079) .. (-0.410,0.012) .. controls (-0.295,0.059) and (-0.217,-0.054) .. (-0.180,-0.069) .. controls (-0.142,-0.084) and (-0.196,-0.091) .. (-0.199,-0.095); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=160] (-0.178,0.212) .. controls (-0.206,0.278) and (-0.189,0.365) .. (-0.246,0.416) .. controls (-0.280,0.438) and (-0.328,0.400) .. (-0.328,0.369) .. controls (-0.315,0.330) and (-0.208,0.214) .. (-0.182,0.186) .. controls (-0.157,0.159) and (-0.178,0.209) .. (-0.177,0.213); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=160] (-0.160,0.197) .. controls (-0.221,0.247) and (-0.283,0.409) .. (-0.387,0.469) .. controls (-0.469,0.505) and (-0.508,0.420) .. (-0.521,0.365) .. controls (-0.488,0.312) and (-0.254,0.183) .. (-0.192,0.154) .. controls (-0.129,0.125) and (-0.166,0.190) .. (-0.161,0.198); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=90] (-0.141,0.178) .. controls (-0.350,0.409) and (-0.606,0.510) .. (-0.676,0.366) .. controls (-0.690,0.282) and (-0.678,0.169) .. (-0.660,0.115) .. controls (-0.634,0.025) and (-0.692,-0.075) .. (-0.665,-0.108) .. controls (-0.604,0.016) and (-0.319,-0.044) .. (-0.258,-0.059) .. controls (-0.171,-0.008) and (-0.165,0.163) .. (-0.147,0.207); \end{scope} \begin{scope} \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred, shading angle=0] (-0.189,-0.118) .. controls (-0.262,-0.210) and (-0.334,-0.412) .. (-0.198,-0.646) .. controls (-0.186,-0.647) and (0.020,-0.234) .. (-0.118,-0.126) .. controls (-0.131,-0.134) and (-0.179,-0.123) .. (-0.191,-0.123); \fill[% top color=ribbonred!20!black, bottom color=ribbonred, shading angle=60] (-0.131,-0.812) .. controls (-0.045,-0.966) and (0.098,-1.214) .. (0.060,-1.606) .. controls (0.142,-1.512) and (0.204,-1.281) .. (0.179,-1.065) .. controls (0.245,-1.127) and (0.337,-1.249) .. (0.337,-1.479) .. controls (0.516,-1.078) and (0.167,-0.702) .. (0.064,-0.552) .. controls (-0.015,-0.442) and (-0.101,-0.777) .. (-0.136,-0.819); \fill[% top color=ribbonred!20!black, bottom color=ribbonred!20!black, middle color=ribbonred!90, shading angle=0] (-0.167,-0.091) .. controls (0.030,-0.372) and (-0.401,-0.822) .. (-0.420,-1.051) .. controls (-0.489,-1.248) and (-0.417,-1.580) .. (-0.277,-1.714) .. controls (-0.351,-1.499) and (-0.303,-1.285) .. (-0.258,-1.233) .. controls (-0.250,-1.456) and (-0.057,-1.685) .. (0.073,-1.730) .. controls (-0.079,-1.540) and (-0.159,-1.035) .. (0.050,-0.742) .. controls (0.218,-0.479) and (0.235,-0.219) .. (0.058,-0.085) .. controls (0.019,0.022) and (-0.140,-0.101) .. (-0.179,-0.104); \end{scope} \begin{scope}[shift={(-0.04, 0.03)}] \shadedraw[draw=ribbonred, very thick, inner color=white, outer color=black!85] (0,0) circle (0.25); \begin{scope} \clip (0,0) circle (0.24); \def\rTable{0.12} \def\rEdge{0.25} \fill[black, opacity=0.35] (67.5:\rTable) -- (112.5:\rTable) -- (90:\rEdge) -- cycle; \fill[black, opacity=0.5] (202.5:\rTable) -- (247.5:\rTable) -- (225:\rEdge) -- cycle; \fill[black, opacity=0.2] (247.5:\rTable) -- (292.5:\rTable) -- (270:\rEdge) -- cycle; \fill[white, opacity=0.6] (22.5:\rTable) -- (67.5:\rTable) -- (45:\rEdge) -- cycle; \fill[white, opacity=0.4] (292.5:\rTable) -- (337.5:\rTable) -- (315:\rEdge) -- cycle; \fill[white, opacity=0.7] (112.5:\rTable) -- (135:\rEdge) -- (180:\rEdge) -- cycle; \fill[white, opacity=0.8] (0,0) -- (45:0.1) -- (0:0.15) -- cycle; \fill[white, opacity=0.5] (0,0) -- (135:0.1) -- (180:0.15) -- cycle; \draw[white, thin, opacity=0.7] (22.5:\rTable) \foreach \a in {67.5, 112.5, 157.5, 202.5, 247.5, 292.5, 337.5} { -- (\a:\rTable) } -- cycle; \foreach \a in {22.5, 67.5, 112.5, 157.5, 202.5, 247.5, 292.5, 337.5} { \draw[white, thin, opacity=0.6] (\a:\rTable) -- (\a+22.5:\rEdge); \draw[white, thin, opacity=0.5] (\a:\rTable) -- (\a-22.5:\rEdge); } \draw[white, thin, opacity=0.8] (0:\rEdge) -- (180:\rEdge); \draw[white, thin, opacity=0.4] (90:\rEdge) -- (270:\rEdge); \end{scope} \tikzset{sparkle/.pic={ \fill[white, opacity=0.9] (0,0.03) .. controls (0.005,0.005) .. (0.03,0) .. controls (0.005,-0.005) .. (0,-0.03) .. controls (-0.005,-0.005) .. (-0.03,0) .. controls (-0.005,0.005) .. cycle; }} \pic at (0.08, 0.12) {sparkle}; \pic[scale=0.7] at (-0.12, 0.05) {sparkle}; \pic[scale=0.5] at (-0.05, -0.15) {sparkle}; \pic[scale=0.8] at (0.15, -0.08) {sparkle}; \end{scope} \end{tikzpicture} \end{document} And here is the resulting output I am very happy with the jewel, but I am looking for advice on how to improve the overall code structure (e.g., making the ribbon code more modular). Additionally, I really struggled with color coordination and picking the right shades for the gradients. If anyone could help me adjust the color palette to make the ribbon look more naturally glossy and realistic, I would be very grateful. I also want to thank kabenyuk for their excellent answer which showed how to modularize the ribbon drawing! Any further improvements or tips on combining these elements effectively would be greatly appreciated.
- TexStudio "quit unexpectedly" [closed]by Rassine Orange on August 2, 2026 at 7:33 am
When I work on TexStudio and I put my Mac to sleep, 8 times out of 10, when I reopen my laptop, I get the following message (see image). I have seen some similar post but either the problem is slightly different (only happens to me when I close the laptop, and files are not corrupt) or the suggested solutions do not work (I don't see the file mentionned in one similar discussion). What could I do?
- \autoref gives wrong type for equationsby Akira on August 1, 2026 at 7:12 pm
I have a .tex file % Source - https://tex.stackexchange.com/a/737442 % Posted by Akira, modified by community. See post 'Timeline' for change history % Source - https://tex.stackexchange.com/a/737439 % Posted by egreg, modified by community. See post 'Timeline' for change history % Retrieved 2026-08-01, License - CC BY-SA 4.0 \documentclass{article} \usepackage{aliascnt} \usepackage{amsthm} \usepackage{mathtools} % before hyperref \mathtoolsset{showonlyrefs} \usepackage[notcite,notref]{showkeys} \usepackage[hypertexnames=false]{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, filecolor=blue, urlcolor=red, citecolor=magenta } \numberwithin{equation}{section} \newtheorem{theorem}{Theorem}[section] \newcommand{\addtheorem}[2]{% \newaliascnt{#1}{theorem}% \newtheorem{#1}[#1]{#2}% \aliascntresetthe{#1}% \ExpandArgs{c}\newcommand{#1autorefname}{#2}% } \addtheorem{corollary}{Corollary} \addtheorem{lemma}{Lemma} \addtheorem{proposition}{Proposition} \theoremstyle{definition} \addtheorem{definition}{Definition} \addtheorem{assumption}{Assumption} \addtheorem{remark}{Remark} \addtheorem{example}{Example} \renewcommand{\sectionautorefname}{Section} \begin{document} \section{Introduction} \label{chap} \begin{theorem} \label{thm} If A then \begin{align} B &= C , \label{thm:eq1} \\ X &= Y . \label{thm:eq4} \end{align} \end{theorem} From \autoref{thm} in \autoref{chap}, we have \autoref{thm:eq1}. \end{document} I expect \autoref{thm:eq1} produces something like Equation (1.1) or simply (1.1), and not Theorem 1.1. The problem is due to \mathtoolsset{showonlyrefs}. Nevertheless, I would like to keep this option? Is there anyway to resolve this wrong type?
- Input command with line rangesby Maronite Monks on August 1, 2026 at 6:42 pm
I'm using MacTeX 2022 on an antique Mojave 10.14.6 system. I employ XeLaTeX with a commercial font and document formatting via the memoir class. I've searched a bit into the minted and listings packages but they don't seem to do what I'd like. What I'd like to do is be able to select ranges of lines (e.g., lines 2-5, 6-9, etc.) and have the input be formatted (i.e., font/size, etc.) by what's in the preamble of the importing document. Minted seems to make what's imported a verbatim format, whereas I'd like any and all the text and markups processed, not printed. I haven't been able to get listings to do anything yet. Is there a package or command to use like this? \input[lines=2, 4, 5-10]{externalfile.tex} Or maybe something comparable to what the lipsum package does? Thanks for your help. fr. mgc Below is the minimum working example, followed by the contents of the external file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %!TEX TS-program = xelatex %!TEX encoding = UTF-8 Unicode \documentclass[12pt]{memoir} \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text} \setromanfont[Ligatures=TeX]{TeX Gyre Schola} \usepackage{lipsum} \pagestyle{plain} \begin{document} \lipsum[52] \bigskip \centerline{Psalm 1} \settowidth\versewidth{nor stands in the path with sinners} \begin{verse}[\versewidth] \input{./Ps1} \end{verse} And that says it all! \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % External file contents: Ps1.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \memgobble{1}Blessed indeed is the man\\ who follows not the counsel of the wicked,\\ nor stands in the path with sinners,\\ nor abides in the company of scorners,\\ \memgobble{2}but whose delight is the law of the Lord,\\ and who ponders his law day and night.\\! \memgobble{3}He is like a tree that is planted\\ beside the flowing waters,\\ that yields its fruit in due season,\\ and whose leaves shall never fade;\\ and all that he does shall prosper.\\! \memgobble{4}Not so are the wicked, not so!\\ For they, like winnowed chaff,\\ shall be driven away by the wind.\\! \memgobble{5}When the wicked are judged they shall not rise,\\ nor shall sinners in the council of the righteous;\\ \memgobble{6}for the Lord knows the way of the righteous,\\ but the way of the wicked will perish.
- How to set `oneside` left-margin with geometry parameter elegantly?by Explorer on August 1, 2026 at 4:36 pm
I want to get a oneside document, whose everypage holds left margin region as below: The target sketch above was the second page given by: \documentclass{book} \usepackage[ showframe, includemp, textwidth=12cm, marginparsep=0.5cm, marginparwidth=5cm, ]{geometry} \usepackage{amsmath} \usepackage{lipsum} \begin{document} \section{Test Test Test Test} \lipsum[1-3] \lipsum[1][1]\marginpar{\raggedright\lipsum[2][1-4]}\lipsum[2-3] \section{Test Test Test Test} \lipsum[1-3] \lipsum[1][1]\marginpar{\raggedright\lipsum[2][1-4]}\lipsum[2-3] \end{document} Now, I want to fix the geometry paramters, change to oneside, and add \reversemarginpar: \documentclass[oneside]{book} \usepackage[ showframe, includemp, textwidth=12cm, marginparsep=0.5cm, marginparwidth=5cm, ]{geometry} \usepackage{amsmath} \usepackage{libertinus-otf} \usepackage{lipsum} \reversemarginpar \begin{document} \section{Test Test Test Test} \lipsum[1-3] \lipsum[1][1]\marginpar{\raggedright\lipsum[2][1-4]}\lipsum[2-3] \section{Test Test Test Test} \lipsum[1-3] \lipsum[1][1]\marginpar{\raggedright\lipsum[2][1-4]}\lipsum[2-3] \end{document} The result was unexpected: My question is that, in my ideal "left margin region" oneside document, the settings: \usepackage[ showframe, includemp, textwidth=12cm, marginparsep=0.5cm, marginparwidth=5cm, ]{geometry} was enough to reverse the margin, I don't want to manually calculate something like left=? within geometry setting. I wonder how to get a "oneside" document with reversed "left margin region" everypage without specifying/calculating parameters other than textwidth=12cm,marginparsep=0.5cm,marginparwidth=5cm.
- Are there a way to obtain automatically all the "lua-unicode-math" fonts with samples?by Mika Ike on August 1, 2026 at 10:19 am
How can you obtain automatically all the available fonts in "https://ctan.org/pkg/lua-unicode-math" ( https://ctan.org/pkg/lua-unicode-math )
- Stacking multiple number lines on top of each otherby Muhannad Al Ayoubi on August 1, 2026 at 9:09 am
I made the following diagram, which is supposed to depict how the intersection of two intervals can be determined. However, as you can see, I could include only one number line, which makes the diagram look rather empty, in my opinion. Is there a away to draw two more number lines above the original one, aligned with the "flying" blue intervals? I have thought about drawing three separate tikz pictures above each other, but then I can't draw the red dashed line, and it would also make it difficult to control the invisible space taken by the y-axis. \documentclass{book} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[every node/.style={font=\small},] \begin{axis}[ clip=false, axis x line=middle, axis y line=none, x axis line style={<->}, xmin=-3.4, xmax=7.4, ymin=-.5, ymax=3, xtick distance=1, x=.6cm, y=1cm, ] % Red dashed lines \draw [red,dashed] (axis cs:-1,0) -- (axis cs:-1,2.2) (axis cs:6,0) -- (axis cs:6,2.2); % Points \addplot[only marks,mark options={fill=white}] coordinates {(6,2) (-1,1) (6,0) (-1,0)}; % Uppermost number line for x < 6 \draw[<-,very thick] (axis cs:-3,2) -- (axis cs:6,2); % Middle number line for x > -1 \draw[->,very thick] (axis cs:-1,1) -- (axis cs:7,1); % Lower number line for intersection of inequalities \draw[very thick] (axis cs:-1,0) -- (axis cs:6,0); % Labels \draw (axis cs:8,2) node[right]{$x<6$} (axis cs:8,1) node[right]{$x>-1$} (axis cs:8,0) node[right]{$x<6$ and $x>-1$, or simply $-1<x<6$.}; \end{axis} \end{tikzpicture} \end{document} Here is what it looks like (note I have removed color and font information from the code to keep things simple).
- How to format citation of a book reprinted within a multivolume set of worksby Michael L. on August 1, 2026 at 2:40 am
Code I am trying to reference a book which has been republished within a multivolume set of the author's works. Here are the relevant bibliography entries: @mvbook{OwenWorks, address={Edinburgh}, author = {Owen, John}, title = {The Works of John Owen}, shorttitle = {Works}, date = {1850}, editor = {William J. Goold}, publisher = {T\&T Clark}, volumes={24}, } @bookinbook{Pneumatologia, crossref={OwenWorks}, title={Pneumatologia}, volume={3}, pages={1–651} } A brief example of the file: \documentclass{turabian-thesis} \usepackage[backend=biber, notes, isbn=false, noibid]{biblatex-chicago} \addbibresource{example.bib} \begin{document} Example text.\autocite{OwenWorks} More example text.\autocite{Pneumatologia} \printbibliography \end{document} Output The footnote for Pneumatologia appears as: John Owen, Pneumatologia, vol. 3 of The Works of John Owen, ed. William J. Goold (Edinburgh: T&T Clark), 1–651. In accordance with Turabian 17.1.4.1, I would like it to read as: John Owen, Pneumatologia, in Works, 3:1–651. If I use \autocite[3:1–651]{OwenWorks}, I get: Owen, Works, 3:1–651. This does not include the title of the work Pneumatologia. If I use \footnote{Owen, *Pneumatologia*, in \cite[3:1–651]{OwenWorks}.}, I get: Owen, Pneumatologia, in Owen, Works, 3:1–651. This list Owen's name twice. What do I need to do to?
- Examples of use for the block, list, and heading templates?by John02139 on July 31, 2026 at 9:06 pm
The LaTeX format has recently implemented templates for block environments, lists, and headings. Is there a collection of examples of using these templates for document design? (I'm only aware of the examples for ltx-talk.) It's not easy to search for "examples of LaTeX templates" online -- the wrong stuff comes up! Addendum: the ltx-talk examples are here.
- How can I format the derivative of a long vector function in LaTeX so it does not spill over the page margin?by Jasper on July 31, 2026 at 4:58 pm
How can I format the derivative of a long vector function in LaTeX so it does not spill over the page margin? Is it better to stack the components in a column, use line breaks with hanging indents inside parentheses, or break it down component by component? \documentclass{article} \usepackage{mathtools} \usepackage{unicode-math} \begin{document} \begin{align*} \frac{d}{dt}\biggl( \frac{2at^2}{t^2+1}, \frac{2at^3}{t^2+1}, \frac{2at^4}{t^2+1} \biggr) &=\biggl( \frac{d}{dt}[2at^2](1+t^2)^{-1}+\frac{d}{dt}[(1+t^2)^{-1}](2at^2), \frac{d}{dt}[2at^3](1+t^2)^{-1}+\frac{d}{dt}[(1+t^2)^{-1}](2at^3), \frac{d}{dt}[2at^4](1+t^2)^{-1}+\frac{d}{dt}[(1+t^2)^{-1}](2at^4) \biggr) \end{align*} \end{document}
- Does plain TikZ have a built-in way to reuse intermediate mathematical calculations across `plot` dimensions?by Jasper on July 31, 2026 at 3:29 pm
Does plain TikZ have a built-in way to reuse intermediate mathematical calculations across plot dimensions? I mean I could just use a foreach loop and pgfmathsetmacro, but that's quite intensive. Is this built in to plot? If not, should/could it be? I mean, I doubt it, but I also doubted that my previous question had a good solution - which I, to my pleasant surprise, turned out to be wrong about. % Source - https://tex.stackexchange.com/a/764941 % Posted by kabenyuk, modified (!) by Jasper. See post 'Timeline' for change history % Retrieved 2026-07-31, License - CC BY-SA 4.0 \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw plot[ domain=0:4, declare function={ f(\t)=(\t)^2-(\t)^3; } ] ( \x, {f(\x-2)}, % A third component requires that I recompute some % values which have already been computed. {f(\x-2) - \x} ) ; \end{tikzpicture} \end{document}
- Cannot break align* environment in nested tcolorbox environmentby Drazer on July 31, 2026 at 9:45 am
I would like to break between pages an align* environment, yet it does not work. I use \tcbsetforeverylayer[breakable] so that all nested tcolorbox environment that I use can break between pages and \allowdisplaybreaks for breaking align* environment in pages. When I try to put an align* environment in my theorem (or leftrule) environment, it breaks between pages. But if I put nested environments, it does not anymore and I get the following warning : Package tcolorbox Warning: The upper box part has become overfull Here is my (maybe not minimal) source code : \documentclass[11pt]{scrbook} \usepackage{amsmath,amsfonts, amsthm, graphicx} \usepackage[margin=1.5cm,bottom=3cm, top=3cm]{geometry} \allowdisplaybreaks \usepackage{tikz} \usepackage[most]{tcolorbox} \tcbsetforeverylayer{enhanced,breakable} \newenvironment{leftrule}{ \begin{tcolorbox}[frame hidden, boxrule=0pt, borderline west={2pt}{0pt}{black}, opacityback=0] } { \end{tcolorbox} } \title{} \author{} \date{} \begin{document} \maketitle \begin{leftrule} \begin{leftrule} \begin{align*} &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= b \\ &= c \end{align*} \end{leftrule} \end{leftrule} \end{document}
- Centering a tableby user446112 on July 31, 2026 at 9:20 am
I'm struggling in centering a table in Beamer. The final result is a horizontally ill centered table. My code is: \documentclass{beamer} \usepackage{nicematrix} \begin{document} \begin{frame} My table \\[5pt] \begin{center} \begin{NiceTabular}{w{l}{1em}w{l}{7em}}[cell-space-limits=2.5pt] \textbf{i.} & My first item, \\ \textbf{ii.} & My second item is very looooooooooooooong, \\ \textbf{iii.} & My third item is not very long. \end{NiceTabular} \end{center} \end{frame} \end{document} (complied via LuaLaTeX). With thanks.
- Very slow compilation due to complex TikZ page background: How to optimize?by Natsu on July 30, 2026 at 11:39 pm
I am working on a document where I created a custom page border and headers/footers using TikZ and eso-pic. However, the document is extremely heavy to process. The compilation time is very slow, and it gets significantly worse as the number of pages increases. Is there a more efficient way to write this code? For example, is there a way to render the background only once and reuse it across all pages (like saving it to a box), instead of drawing these complex paths and loops on every single page? Here is my MWE (compiled with XeLaTeX/LuaLaTeX): \documentclass[a4paper]{report} \usepackage[right=1.1cm,left=1.3cm,top=2.5cm,bottom=2cm,foot=0mm,head=0mm]{geometry} \usepackage{amsmath,amsfonts,eso-pic,amssymb,mathrsfs,tikz,fancyhdr,multicol,pifont,ifthen,lastpage,graphicx} \usepackage[most]{tcolorbox} \usetikzlibrary{arrows,shapes,calc} \parindent=0mm \colorlet{col1}{blue} \colorlet{col2}{col1!50} \pagestyle{empty} \newcounter{tabb} \newcommand{\shape}[2][1]{\setcounter{tabb}{1}\tabcolsep=0mm\begin{tabular}{c} \whiledo{\thetabb<#2}{\hskip-3pt% \tikz{\path[top color=col2,bottom color=col2,middle color=white] (3.9cm,-.7)rectangle(7.1cm,7mm); \draw[.!50!col1] (3.9,-.7)--(7.1,-.7)(3.9,.7)--(7.1,.7); \draw[line width=3pt,smooth,inner color=white,outer color=gray,draw=.!25!gray] plot[domain=3.9:7.1] (\x,{sin deg(\x)}) plot[domain=3.9:7.1] (\x,{cos deg(\x)}); \draw[transform canvas={yscale=#1},line width=3pt,smooth,inner color=white,outer color=gray,draw=.!25!gray] plot[domain=3.9:7.1] (\x,{sin deg(\x)}) plot[domain=3.9:7.1] (\x,{cos deg(\x)});}\stepcounter{tabb}}% \end{tabular}} \AddToShipoutPicture{ \begin{tikzpicture}[overlay,remember picture] \coordinate (1) at ([shift={(-.8,-1.25)}]current page.north east); \coordinate (2) at ([shift={(.8,-1.25)}]current page.north west); \coordinate (3) at ([shift={(.8,1.25)}]current page.south west); \coordinate (4) at ([shift={(-.8,1.25)}]current page.south east); \path (2)--node[scale=0.2,rotate=90,inner sep=0mm]{\shape{41}}(3); \path (1)--node[scale=0.2,rotate=90,inner sep=0mm]{\shape{41}}(4); \coordinate (5)at ($(1)!1/4!(2)$); \coordinate (6)at ($(1)!3/4!(2)$); \coordinate (7)at ($(4)!1/4!(3)$); \coordinate (8)at ($(4)!3/4!(3)$); \path (1)--node[scale=0.2,inner sep=0mm]{\shape{4}}(5); \path (2)--node[scale=0.2,inner sep=0mm]{\shape{4}}(6); \path (4)--node[scale=0.2,inner sep=0mm]{\shape{4}}(7); \path (3)--node[scale=0.2,inner sep=0mm]{\shape{4}}(8); \foreach \i/\j/\k in {1/1/1,2/-1/1,3/-1/-1,4/1/-1}{ \node [inner sep=0mm,left] at (\i) {\scalebox{\j}[\k]{% \tikz[transform canvas={shift={(-.5mm,-.4mm)}}]{ \coordinate (a)at (0,0); \draw[inner color=white,outer color=gray]([shift={(-2mm,1mm)}]a)to[out=250,in=-45]([xshift=-1.6cm,yshift=-.8mm]a)-|+(.14,2mm)to[out=-45,in=240]([yshift=-3mm,xshift=-2mm]a); \draw[inner color=white,outer color=gray] ([yshift=-.75cm,xshift=1.5mm]a)to[out=40,in=-90]([xshift=-1mm,yshift=2mm]a)--([xshift=-3mm,yshift=2mm]a)to[out=-90,in=10]([shift={(-1mm,-.75cm)}]a); }% }}; \node[inner sep=0mm,scale=2,text=col1] at (\i){% \includegraphics[width=.5cm,height=.5cm]{im1}% }; } \node[text width=0.75\textwidth,inner sep=0mm,baseline={(1.east)}] at ($(1)!.5!(2)$){ %\begin{otherlanguage}{arabic} \begin{tcolorbox}[enhanced,nobeforeafter,right=5mm,left=5mm,frame empty,fontupper=\bfseries\large,interior code={ \path[draw=col1,line width=.8pt,bottom color=col1!50,top color=col1!50,middle color=white] ([yshift=1.5mm]interior.east)to[out=180,in=0]([xshift=-2cm]interior.north east)--([xshift=2cm]interior.north west)to[out=180, in=0]([yshift=1.5mm]interior.west)to[bend left]([yshift=-1.5mm]interior.west)to[out=0,in=180]([xshift=2cm]interior.south west)--([xshift=-2cm]interior.south east)to[out=0,in=180]([yshift=-1.5mm]interior.east)to[bend left]cycle; \path(interior.east)-- node[pos=0.33,yscale=.8,xscale=.5,inner sep=0mm]{\colorlet{gray}{col1}\shape[-1]{2}} node[pos=0.69,yscale=.8,xscale=.5,inner sep=0mm]{\colorlet{gray}{col1}\shape[-1]{2}}(interior.west); }] text left \hfill text center \hfill text right \end{tcolorbox}% %\end{otherlanguage}% \vglue-\baselineskip }; \node[text width=0.75\textwidth,inner sep=0mm] at ($(4)!.5!(3)$){ \begin{tcolorbox}[enhanced,nobeforeafter,right=5mm,left=5mm,frame empty,top=0mm,bottom=0mm,fontupper=\bfseries\large,interior code={ \path[draw=col1,line width=.8pt,bottom color=col1!50,top color=col1!50,middle color=white] ([yshift=1.5mm]interior.east)to[out=180,in=0]([xshift=-2cm]interior.north east)--([xshift=2cm]interior.north west)to[out=180, in=0]([yshift=1.5mm]interior.west)to[bend left]([yshift=-1.5mm]interior.west)to[out=0,in=180]([xshift=2cm]interior.south west)--([xshift=-2cm]interior.south east)to[out=0,in=180]([yshift=-1.5mm]interior.east)to[bend left]cycle; }]\centering Page 1 of 1 \end{tcolorbox}% %\end{otherlanguage}% \vglue-\baselineskip }; \end{tikzpicture} } \begin{document} hey \end{document} image im1: Note: I have attached the image (im1) used in the document. Also, I am using some local Arabic fonts in my code (Aljazeera.ttf and Al Qalam Quran Majeed Web.ttf). If you want to test the code on your machine, you can simply comment them out or replace them with any standard font (like Amiri). My main problem is that compiling this document is extremely slow because of the complex TikZ background (especially the loops and smooth paths). The processing time gets heavier and heavier with every new page added. Is there a way to optimize this? For example, is it possible to render this background only once (saving it into a box) and reuse it on every page to drastically reduce the compilation time? Any help or optimized code would be highly appreciated. Thank you! EDIT/UPDATE: I sincerely apologize for my previous code. I realized it contained local Arabic fonts and packages (polyglossia) which made it impossible for you to compile and test. I have completely cleaned up the code. It is now a proper Minimal Working Example (MWE) using only standard packages and example-image. My issue is that this document is extremely slow to compile because of the complex TikZ background (the loops, \whiledo, and smooth curves). The compilation time increases heavily with every new page. As pointed out in the comments, I need to separate the static parts (the complex borders/decorations) from the variable parts (like the page number), but my code is too entangled with nested tikzpictures and tcolorbox. Could someone please provide a structural example of how to redesign this so the heavy background is drawn/saved only once, drastically reducing compilation time? Here is the clean, compilable MWE (you can test it with pdfLaTeX): \documentclass[a4paper]{report} \usepackage[right=1.1cm,left=1.3cm,top=2.5cm,bottom=2cm,foot=0mm,head=0mm]{geometry} \usepackage{amsmath,amsfonts,eso-pic,amssymb,mathrsfs,tikz,fancyhdr,multicol,pifont,ifthen,lastpage,graphicx} \usepackage[most]{tcolorbox} \usetikzlibrary{arrows,shapes,calc} \parindent=0mm \colorlet{col1}{blue} \colorlet{col2}{col1!50} \pagestyle{empty} \newcounter{tabb} \newcommand{\shape}[2][1]{\setcounter{tabb}{1}\tabcolsep=0mm\begin{tabular}{c} \whiledo{\thetabb<#2}{\hskip-3pt% \tikz{\path[top color=col2,bottom color=col2,middle color=white] (3.9cm,-.7)rectangle(7.1cm,7mm); \draw[.!50!col1] (3.9,-.7)--(7.1,-.7)(3.9,.7)--(7.1,.7); \draw[line width=3pt,smooth,inner color=white,outer color=gray,draw=.!25!gray] plot[domain=3.9:7.1] (\x,{sin deg(\x)}) plot[domain=3.9:7.1] (\x,{cos deg(\x)}); \draw[transform canvas={yscale=#1},line width=3pt,smooth,inner color=white,outer color=gray,draw=.!25!gray] plot[domain=3.9:7.1] (\x,{sin deg(\x)}) plot[domain=3.9:7.1] (\x,{cos deg(\x)});}\stepcounter{tabb}}% \end{tabular}} \AddToShipoutPicture{ \begin{tikzpicture}[overlay,remember picture] \coordinate (1) at ([shift={(-.8,-1.25)}]current page.north east); \coordinate (2) at ([shift={(.8,-1.25)}]current page.north west); \coordinate (3) at ([shift={(.8,1.25)}]current page.south west); \coordinate (4) at ([shift={(-.8,1.25)}]current page.south east); \path (2)--node[scale=0.2,rotate=90,inner sep=0mm]{\shape{41}}(3); \path (1)--node[scale=0.2,rotate=90,inner sep=0mm]{\shape{41}}(4); \coordinate (5)at ($(1)!1/4!(2)$); \coordinate (6)at ($(1)!3/4!(2)$); \coordinate (7)at ($(4)!1/4!(3)$); \coordinate (8)at ($(4)!3/4!(3)$); \path (1)--node[scale=0.2,inner sep=0mm]{\shape{4}}(5); \path (2)--node[scale=0.2,inner sep=0mm]{\shape{4}}(6); \path (4)--node[scale=0.2,inner sep=0mm]{\shape{4}}(7); \path (3)--node[scale=0.2,inner sep=0mm]{\shape{4}}(8); \foreach \i/\j/\k in {1/1/1,2/-1/1,3/-1/-1,4/1/-1}{ \node [inner sep=0mm,left] at (\i) {\scalebox{\j}[\k]{% \tikz[transform canvas={shift={(-.5mm,-.4mm)}}]{ \coordinate (a)at (0,0); \draw[inner color=white,outer color=gray]([shift={(-2mm,1mm)}]a)to[out=250,in=-45]([xshift=-1.6cm,yshift=-.8mm]a)-|+(.14,2mm)to[out=-45,in=240]([yshift=-3mm,xshift=-2mm]a); \draw[inner color=white,outer color=gray] ([yshift=-.75cm,xshift=1.5mm]a)to[out=40,in=-90]([xshift=-1mm,yshift=2mm]a)--([xshift=-3mm,yshift=2mm]a)to[out=-90,in=10]([shift={(-1mm,-.75cm)}]a); }% }}; \node[inner sep=0mm,scale=2,text=col1] at (\i){% \includegraphics[width=.5cm,height=.5cm]{im1}% }; } \node[text width=0.75\textwidth,inner sep=0mm,baseline={(1.east)}] at ($(1)!.5!(2)$){ %\begin{otherlanguage}{arabic} \begin{tcolorbox}[enhanced,nobeforeafter,right=5mm,left=5mm,frame empty,fontupper=\bfseries\large,interior code={ \path[draw=col1,line width=.8pt,bottom color=col1!50,top color=col1!50,middle color=white] ([yshift=1.5mm]interior.east)to[out=180,in=0]([xshift=-2cm]interior.north east)--([xshift=2cm]interior.north west)to[out=180, in=0]([yshift=1.5mm]interior.west)to[bend left]([yshift=-1.5mm]interior.west)to[out=0,in=180]([xshift=2cm]interior.south west)--([xshift=-2cm]interior.south east)to[out=0,in=180]([yshift=-1.5mm]interior.east)to[bend left]cycle; \path(interior.east)-- node[pos=0.33,yscale=.8,xscale=.5,inner sep=0mm]{\colorlet{gray}{col1}\shape[-1]{2}} node[pos=0.69,yscale=.8,xscale=.5,inner sep=0mm]{\colorlet{gray}{col1}\shape[-1]{2}}(interior.west); }] text left \hfill text center \hfill text right \end{tcolorbox}% %\end{otherlanguage}% \vglue-\baselineskip }; \node[text width=0.75\textwidth,inner sep=0mm] at ($(4)!.5!(3)$){ \begin{tcolorbox}[enhanced,nobeforeafter,right=5mm,left=5mm,frame empty,top=0mm,bottom=0mm,fontupper=\bfseries\large,interior code={ \path[draw=col1,line width=.8pt,bottom color=col1!50,top color=col1!50,middle color=white] ([yshift=1.5mm]interior.east)to[out=180,in=0]([xshift=-2cm]interior.north east)--([xshift=2cm]interior.north west)to[out=180, in=0]([yshift=1.5mm]interior.west)to[bend left]([yshift=-1.5mm]interior.west)to[out=0,in=180]([xshift=2cm]interior.south west)--([xshift=-2cm]interior.south east)to[out=0,in=180]([yshift=-1.5mm]interior.east)to[bend left]cycle; }]\centering Page 1 of 1 \end{tcolorbox}% %\end{otherlanguage}% \vglue-\baselineskip }; \end{tikzpicture} } \begin{document} hey \end{document}
- Hyphenated word has one single letter on next lineby Robert E on July 30, 2026 at 6:55 pm
I am typesetting a Dutch text in lualatex / polyglossia. All hyphenation instances occur correctly, but one: Nederlands-Indië, which I coded as Nederlands\hyp{}In\-dië, in order to preserve the dash and to encourage hyphenation between n-d. Correct hyphenations are: Neder- lands-Indië Ne- derlands-Indië Nederlands- Indië Nederlands-In- dië. Note that in all these cases the dash remains. However, in my text it is occasionally also hyphenated as: Nederlands-Indi- e. This is incorrect and ugly typesetting, because of the single e on the new line. It is probably caused by the fact words containing an ë (e-trema) are hyphenated, e.g. in the case of geënt, ë indicates a new syllable. Therefore ge- ent is correct. I tried settings like these, \lefthyphenmin=3 \righthyphenmin=3 \hyphenpenalty=500 but the problem persists. Has anyone a solution?
- How to include a TikZ .tex file in a large document? I keep getting "LaTeX Error: Environment tikzpicture undefined."by ali bab613 on July 30, 2026 at 1:28 am
I have a fairly complex document, but I extracted this MWE from it. I'm including a similar file tree as what's in the actual document to ensure that its as close to my document as possible. For extra context, I am using Overleaf, and compiling using LuaLaTeX (in case that's relevant). main.tex has this: \documentclass{article} \usepackage{standalone} \usepackage{hyperref} \begin{document} \input{Chapter1} \end{document} The content of Chapter1.tex is as follows: \input{Images/Chapter 1/Tester} and the Tester.tex file referenced is as follows: \documentclass{standalone} \usepackage{tikz} \usepackage{adjustbox} \begin{document} \begin{adjustbox}{margin=2} \begin{tikzpicture} \node [draw,circle,black,scale=0.7,minimum width=46] at (0,0) {Tester}; \end{tikzpicture} \end{adjustbox} \end{document} I should note that when I compile Tester.tex, it generates the circle fine. When I compile main.tex, however, it gives me the line of code itself in the pdf: I was using the standalone package as suggested in the answers to this question, but it was not enough. Any advice is appreciated!
- How can I handle division by zero and non-Euclidean distortions in Asymptote without erroring?by Jasper on July 29, 2026 at 7:05 pm
How can I handle division by zero and non-Euclidean distortions in Asymptote without erroring? My goal is to illustrate point-at-infinity illustrations. For example, try setting MAIN_PARAMETER to 180, which is a full inversion, and I cannot achieve it due to the error. Moreover, the diagram seems to not handle the distortions well leading up to these errors. import three; import graph3; real MAIN_PARAMETER = 20; unitsize(1cm); currentprojection=orthographic(1,2,3); triple SP(triple point){ return ( point.x / (1 - point.z), point.y / (1 - point.z), 0 ); } triple ISP(triple point){ real temp = point.x^2 + point.y^2; return ( 2 * point.x / (1 + temp), 2 * point.y / (1 + temp), (-1 + temp) / (1 + temp) ); } transform3 R = rotate(MAIN_PARAMETER, (1,1,0)); triple riemann(pair uv){ return R*ISP((uv.x,uv.y,0)); } triple mobius(pair uv){ return SP(riemann(uv)); } surface theriemann = surface(riemann, (-2, -2), (2, 2), Spline); draw(theriemann, green, meshpen=black + 0.5pt); surface themobius = surface(mobius, (-2, -2), (2, 2), Spline); draw(themobius, blue, meshpen=black + 0.5pt); Without much distortion, it is fine: With a lot of distortion, it is not:
- tikz and pgf not framedby user446112 on July 29, 2026 at 3:55 pm
I'm drawing the graph below using Beamer, but the plot is not framed with the points (1/Pi/2) and (-1,-Pi/2). What’s happening here? My code is: \documentclass{beamer} \usepackage{pgfplots} \usepackage{tikz} \usetikzlibrary{tikzmark,calc,positioning,fit,arrows,shapes,backgrounds,shapes.geometric,arrows.meta,patterns.meta,decorations.pathreplacing} \begin{document} \begin{frame} \begin{center} \begin{tikzpicture}[scale=0.7, samples=100] \draw[-latex,thick] (-3,0) -- (3,0); \draw[-latex,thick] (0,-2.5) -- (0,2.5); \draw [thick](-1,-0.125)--(-1,0.125); \draw [thick](1,-0.125)--(1,0.125); \draw [thick](-0.125,-1.570796327)--(0.125,-1.570796327); \draw [thick](-0.125,1.570796327)--(0.125,1.570796327); \node at (2.5,-0.5) {$x$}; %\draw[-latex,thick] (0,-2) -- (0,3); \node at (-0.5,2.3) {$y$}; \node at (-1,-0.5) {{\scriptsize$-1$}}; \node at (1,-0.5) {{\scriptsize$1$}}; \node at (0.6,-1.570796327) {{\scriptsize$-\frac{\pi}{2}$}}; \node at (-0.4,1.570796327) {{\scriptsize$\frac{\pi}{2}$}}; \draw [thick](-0.125,-1.570796327)--(0.125,-1.570796327); \draw [thick](-0.125,1.570796327)--(0.125,1.570796327); \draw [dotted](1,0)--(1,1.570796327); \draw [dotted](-1,-0.8)--(-1,-1.570796327); \draw [dotted](0,1.570796327)--(1,1.570796327); \draw [dotted](-1,-1.570796327)--(0,-1.570796327); \begin{axis}[smooth,anchor=origin,xmin=-3,xmax=3, domain=-3:3,ymin=-2.5,ymax=2.5,restrict y to domain=-2.5:2.5,axis equal,axis x line=none,axis y line=none,xticklabels=\empty,yticklabels=\empty,samples=100] \addplot[domain=-1:1,blue,line width=2pt] {rad(asin(x))}; \end{axis} \end{tikzpicture} \end{center} \end{frame} \end{document} (compiled through LuaLaTeX).
- Why lipsum package use changes decimal separator in spanish?by Mika Ike on July 28, 2026 at 5:00 pm
Why lorem/lipsum use makes that spanish decimmal is not comma, as expected?. \documentclass[12pt,a4paper]{article} \usepackage[spanish,es-notilde,]{babel} %\spanishdecimal{,} \usepackage{amsmath,mathtools} \usepackage{amssymb} \usepackage{siunitx} \sisetup{output-decimal-marker={,}} \usepackage{lipsum} \begin{document} \lipsum[1] \textbf{If you comment the previous \texttt{lipsum[1]} you obtain comma as decimal separator in the next 2 lines, as expected in spanish.} Decimal: $\dfrac{7}{4}\approx 1.75$ $\angle{3.4;2}$ No problem in the next lines: $\ang{3.4;2}$ $\num{5.5}$ \end{document}
- Spacing is too small when using TeX Gyre Termes Math fontby Muhannad Al Ayoubi on July 28, 2026 at 2:01 pm
I have noticed that when using the TeX Gyre Termes Math font, the spacing is too small. As you can see below, the letter j is practically jammed into the absolute value bars, as well as the ordinary square and round brackets. Is this the expected behavior of the font? If yes, is there a way to fix it? MWE: \documentclass{book} \usepackage{unicode-math} \setmainfont{TeX Gyre Termes}[Scale=1] \setmathfont{TeX Gyre Termes Math}[Scale=1] \begin{document} \[ \lvert j^2 - 1 \rvert \] \[ [j^2+1] \] \[ (j^2+1) \] \end{document}
- columns longer than a pageby Sergi Espinosa Polo on July 28, 2026 at 12:12 pm
I have the following question. I have been looking in other places and I can't find anything similar (or I don't know how to look for it). I want to make a table with two columns and one row, so that I can buy a text in medieval Catalan and the Latin translation. I had thought about making a table, but I have a problem. The columns go beyond the page and, then, they appear cut off and do not continue on another page (as would happen with Word). Is there any way to make this document look like the one in Word that I am attaching? Thank you very much This is my code: \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{longtable} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{longtable}{|p{0.47\textwidth}|p{0.47\textwidth}|} \hline \lipsum[1] \par \lipsum[1] \par \lipsum[1] \par \lipsum[1] & \lipsum[1] \par \lipsum[1] \par \lipsum[1] \par \lipsum[1] \par \end{longtable} \lipsum[1-2] \end{document}
- Necessarily high-sampled curve in plain TikZby Jasper on July 28, 2026 at 6:34 am
I was making a rational double pendulum in Asymptote: // a rational double pendulum import graph; unitsize(3cm); pair truncated_pi(real t) { real t1 = 3.14 * t; return ( cos(t) + cos(t1), sin(t) + sin(t1) ); } path f = graph(truncated_pi, 0, 314, n=10000); draw(f); I wanted to make it in TikZ, but I am running into the issue of needing a number of samples which is beyond the limit imposed by pgfmath. As some of you may be familiar with, I am very fond of plain TikZ. I would like to see if there are ways to achieve this which are not overly ad hoc. For example, one strategy would be to break the domain into separate regions. How would one draw something like this in the spirit of plain TikZ? \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw[ domain=0:314, samples=10000, trig format=rad, declare function={ t1(\x) = 3.14 * \x; x(\x) = cos(\x) + cos(t1(\x)); y(\x) = sin(\x) + sin(t1(\x)); } ] plot ({x(\x)},{y(\x)}); \end{tikzpicture} \end{document}
- How to do single variable domain detection using the package luacas?by Jasper on July 28, 2026 at 1:59 am
How to do single variable domain detection using the package luacas? Expected result: (-infty,0)U(0,infty) \documentclass{article} \usepackage{luacas} \begin{document} \begin{CAS} vars('x') f = x*e^(1/x) \end{CAS} The domain of \(f\) is ... (I want to know). \end{document}