Week
- Drawing a bracket over several lines in a tableby rensemil on August 17, 2026 at 9:15 am
I need to draw a cornered bracket over several lines in a table. I want it to look somewhat like this: You can see the bracket on the right. I also have a table with three columns, just like in the picture. The first columns are the line numbers, the second latin text, the third are abbreviations about the lines' metre. I have all this working just fine except for the bracket. I first tried to get help from AI and this is the result: \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark} \newcounter{verstabsystem} \NewDocumentCommand{\startsystem}{}{% \stepcounter{verstabsystem}% \xdef\verstabSysCurrent{\theverstabsystem}% \makebox[0pt][l]{\strut\tikzmark{verstabSysStart\verstabSysCurrent}}% } \NewDocumentCommand{\endsystem}{}{% \makebox[0pt][l]{\strut\tikzmark{verstabSysEnd\verstabSysCurrent}}% \begin{tikzpicture}[remember picture, overlay] \draw[thick] ([xshift=-0.3em]pic cs:verstabSysStart\verstabSysCurrent) -- ++(-0.3em,0) -- ([xshift=-0.3em]pic cs:verstabSysEnd\verstabSysCurrent) -- ++(0.3em,0); \end{tikzpicture}% } \begin{document} \begin{table} \begin{tabular}{rcl} 1 & text & \startsystem an sy\textsuperscript{10} \\ 2 & text & \\ 2 & text & \\ 2 & text & \endsystem \end{tabular} \end{table} \end{document} Which produces: As you can see, the bracket is there, but there are a few issues with it that I have been unable to solve: It has the shape of an opening bracket [, but I need a closing one ]. The vertical line is not vertical. I first thought that the verticalness issue was due to there being text in the same line, but that happens even when there is none. I believe that the solution would be to move the horizontal line to the right so it is at the same height as the bottom one and then connect the right ends of both lines with a vertical one. How may this be achieved? Thanks in advance!!
- قالب مذكرة.tex: erreur: 215: Undefined control sequence. ^^I^^I\begin{tabular}by خالد بن حورية on August 17, 2026 at 7:51 am
\begin{center} \begin{tabular}{|c|c|c|} \hline \rowcolor{gold!40} \textbf{المرحلة} & \textbf{عناصر الدرس} & \textbf{المدة} \\ \hline مرحلة الانطلاق & مراجعة المكتسبات القبلية وربطها بالدرس الجديد & 10 دقائق \\ \hline مرحلة الاكتشاف & تقديم التعريفات الأساسية مع أمثلة توضيحية & 20 دقيقة \\ \hline مرحلة بناء التعلمات & نشاط حول العمليات على الدوال + شرح الحل & 25 دقيقة \\ \hline مرحلة التطبيق & تمرين فردي أو جماعي مع مناقشة النتائج & 15 دقيقة \\ \hline مرحلة التقويم & تمرين ختامي أو أسئلة قصيرة للتأكد من الفهم & 10 دقائق \\ \hline \end{tabular} \end{center}
- My goal is to approximate an arc length reparameterizationby Jasper on August 16, 2026 at 9:51 pm
My goal is to approximate an arc length reparameterization. The thick curve and the red curve should nearly coincide is the expected result. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{mathtools} \usepackage{unicode-math} \tikzset{ declare function={ alpha(\t)=1/\t; dalpha(\t)=(alpha(\t+0.02)-alpha(\t-0.02))/0.04; length(\x,\y)=sqrt((\x)^2+(\y)^2); ldalpha(\t)=length(1,dalpha(\t)); } } \pgfmathdeclarefunction{riemannsumldalpha}{3}{% \pgfmathsetmacro{\count}{0}% \pgfmathsetmacro{\dx}{(#2-#1)/#3}% \pgfplotsinvokeforeach{1,...,#3} {% \pgfmathsetmacro{\count}{\count+ldalpha(#1+##1*\dx)*\dx}% }% \let\pgfmathresult\count% } \pgfmathdeclarefunction{inverseriemannsumldalpha}{4}{% \pgfmathsetmacro{\lo}{#2}% \pgfmathsetmacro{\hi}{#3}% \pgfplotsinvokeforeach{1,...,#4}{% \pgfmathsetmacro{\mid}{(\lo+\hi)/2}% \pgfmathsetmacro{\value}{riemannsumldalpha(0.25,\mid,#4)}% \pgfmathsetmacro{\test}{\value < #1}% \ifnum\test=1 \pgfmathsetmacro{\lo}{\mid}% \else \pgfmathsetmacro{\hi}{\mid}% \fi }% \pgfmathsetmacro{\pgfmathresult}{(\lo+\hi)/2}% } \tikzset{ declare function={ alphainverseriemannsumldalpha(\t,\s,\e,\sam)=alpha( inverseriemannsumldalpha(\t,\s,\e,\sam) ); } } \begin{document} Let \(\alpha(t)=1/t\). My goal is to approximate an arc length reparameterization. I believe that plotting the following composition will achieve this; \[\alpha\Biggl(\biggl(\int_{t_0}^t\lvert\alpha'(t)\rvert\,dt\biggr)^{-1}\Biggr).\] \begin{center} \begin{tikzpicture}[samples=5] % producing the expected result \draw[red] plot[domain=0.25:4] (\x,{alpha(\x)}); \draw[green] plot[domain=0.25:4] (\x,{dalpha(\x)}); \draw[blue] plot[domain=0.25:4] (\x,{ldalpha(\x)}); \draw[purple] plot[domain=0.25:4] (\x,{riemannsumldalpha(0.25,\x,7)}); \draw[yellow] plot[domain=0.25:4] (\x,{inverseriemannsumldalpha(\x,0.25,4,7)}); % not producing the expected result \draw[thick] plot[domain=0.25:4] (\x,{alphainverseriemannsumldalpha(\x,0.25,4,7)}); \end{tikzpicture} \end{center} \end{document}
- Using lettrine equivalent inside Verse or Poem environmentby Yves on August 16, 2026 at 1:39 pm
This is a follow-up question of https://tex.stackexchange.com/a/163355. After numerous experiments with the lettrine package in the task of preparing a collection of poems for a friend who is unfamiliar with LaTeX, I have found the superb piece of code from Steven B. Segletes, and was delighted primarily because only the \startverse command does the job. However when long verses exceed the settings as in the example below, there is a space created between the lines 2 and 3 of the poem. I have been able to eliminate the problem by removing the "verse" package from the preamble, and also to some extent by changing the length of the minipage, in the code \begin{minipage}{4in}. But I wish to better understand the role of the {4in} minipage lenghth. (I wonder if a size depending on the textwidth would be more adequate and why the verse package affects the results. \documentclass[12pt, a5paper,draft]{book} \usepackage{scalerel} \usepackage[english]{babel} \usepackage[numberpoems, clearpageafterpoem]{poetrytex} \usepackage{showframe} \usepackage{stackengine} \usepackage{verse} %Following code borrowed from Steven B. Segletes %https://tex.stackexchange.com/a/163355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\startverse#1\\#2\\{% \begin{minipage}{4in}% \firstline#1\relax% \def\verselineB{#2}% \if Q\versalletter\def\descstrut{\strut}\else\def\descstrut{}\fi% \def\Versal{\scalerel*{$\fontsize{28}{30}\selectfont\versalletter$}% {\def\stacktype{L}\stackon{T\descstrut}{T}}}% \setbox0=\hbox{\Versal\,}% \noindent\hspace*{\wd0}\verselineA\\% \smash{\Versal\,}\verselineB\strut% \end{minipage}\\% } \def\firstline#1#2\relax{\def\versalletter{#1}\def\verselineA{#2}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} Note: The witdh of the text is {\the\textwidth} \begin{poem}{A Limerick}{} \startverse There was an old party of Lyme\\ Who married three wives at one time. \\ When asked: ‘Why the third?’ \\ He replied: ‘One’s absurd, \\ And bigamy, sir, is a crime.’ \\ \end{poem} \end{document}
- Crafting tcolorbox theorem environments with ams-like syntax and working \label and \refby GeometriaDifferenziale on August 16, 2026 at 8:08 am
I'm trying to define some custom theorem environments with tcolorbox, while keeping the usual amsth syntax \begin{my_env}[My Optional Title] \label{my_optional_label} stuff \end{my_env} instead of tcolorboxs \begin{my_tcb_env}{My Optional Title}{my_optional_label} stuff \end{my_tcb_env} one. This way, if I decide to get rid of tcolorbox, I can do that without much hassle. I achieved a good-looking result with the following definitions: \definecolor{definitioncolor}{HTML}{0072B2} % Blue \definecolor{theoremcolor}{HTML}{D55E00} % Vermillion \definecolor{examplecolor}{HTML}{F0E442} % Yellow \definecolor{propositioncolor}{HTML}{D55E00} % Vermillion \definecolor{corollarycolor}{HTML}{D55E00} % Vermillion \definecolor{lemmacolor}{HTML}{D55E00} % Vermillion \definecolor{constructioncolor}{HTML}{CC79A7} % Reddish Purple \tcbset{ breakable, commonbox/.style={ boxrule=0.3pt, left=10pt, right=10pt, top=8pt, bottom=8pt, arc=3pt, outer arc=3pt, %colback=white, colbacktitle=white, coltitle=black, colframe=black!12, % Very subtle border enhanced, }, } % Theorem \NewTColorBox[auto counter, number within=section]{thm}{+O{}}{% commonbox, title={\textbf{Theorem} \thetcbcounter\IfBlankTF{#1}{}{ --- #1}}, colframe=theoremcolor, colback=theoremcolor!10, } % Definition \NewTColorBox[use counter from=thm]{dfn}{+O{}}{% commonbox, title={\textbf{Definition} \thetcbcounter\IfBlankTF{#1}{}{ --- #1}}, colframe=definitioncolor, colback=definitioncolor!10, } % Definition \NewTColorBox[use counter from=thm]{construction}{+O{}}{% commonbox, title={\textbf{Construction} \thetcbcounter\IfBlankTF{#1}{}{ --- #1}}, colframe=constructioncolor, colback=constructioncolor!10, } and so on. The problem now is that whenever I \begin{dfn}[My definition] \label{my_definition} stuff \end{dfn} and then try to \ref{my_definition}, I end up with the section number, not the definition number. The same goes for the other environments. This is in some sense expected, but I don't know how to change my code to make it work properly.
- arydshln dashed lines regression since TL2024?by Explorer on August 16, 2026 at 3:55 am
See the following code: \documentclass{article} \usepackage{array} \usepackage{arydshln} \begin{document} $\left( \begin{array}{ccc:c} 1 & 3 & 1 & 0 \\ 0 & -7 & 0 & -1 \\ 0 & 0 & m+1 & k-1 \end{array} \right)$ \end{document} With TL2023, it gives the expected result: However, if I switched to Tl24, things changed: When I compiled with my latest TL26 on my PC, it also gives the warning msg of ==> First Aid for arydshln.sty applied!: This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./mwe.tex LaTeX2e <2026-06-01> L3 programming layer <2026-07-20> (c:/texlive/2026/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (c:/texlive/2026/texmf-dist/tex/latex/base/size10.clo)) (c:/texlive/2026/texmf-dist/tex/latex/tools/array.sty) (c:/texlive/2026/texmf-dist/tex/latex/extarrows/extarrows.sty (c:/texlive/2026/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (c:/texlive/2026/texmf-dist/tex/latex/amsmath/amstext.sty (c:/texlive/2026/texmf-dist/tex/latex/amsmath/amsgen.sty)) (c:/texlive/2026/texmf-dist/tex/latex/amsmath/amsbsy.sty) (c:/texlive/2026/texmf-dist/tex/latex/amsmath/amsopn.sty))) (c:/texlive/2026/texmf-dist/tex/latex/arydshln/arydshln.sty) ==> First Aid for arydshln.sty applied! (c:/texlive/2026/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def) (./mwe.aux) [1{c:/texlive/2026/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./mwe.aux) )<c:/texlive/2026/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10. pfb><c:/texlive/2026/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb><c:/t exlive/2026/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><c:/texlive/202 6/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb> Output written on mwe.pdf (1 page, 35671 bytes). Transcript written on mwe.log. Anyone could kindly tell mme the reason and solution? BTW, I know that nicematrix could handle this easily, but this post is more like a bug report for backward compatibility.
- How to stretch these double-angle delimiters appropriately?by Frode Alfson Bjørdal on August 15, 2026 at 9:30 pm
I have this MWE: \documentclass{article} \usepackage{amsmath} \newcommand{\AnschauungMultiline}[2]{% \left\langle\hspace{-1.8mm}\left\langle \vphantom{\begin{matrix} A \\ A \end{matrix}} #1 \mathrel{:} #2 \right\rangle\hspace{-1.8mm}\right\rangle } \begin{document} \[ \AnschauungMultiline{x}{ \begin{aligned} \forall y\biggl( g(&0)\in y \wedge H(0)\in y \wedge \forall n \Bigl((g(n)\in y\to g(n+1)\in y)~\\[-1mm] &\wedge (H(n)\in y\to H(n+1)\in y)\Bigr) \to x\in y\biggr) \end{aligned}} \] \end{document} How may I obtain outer double angle delimiters whose tops align with the top of the upper written line $g(0)\in y\wedge H(0)\in y \ldots$, and whose bottoms align with the bottom of the lower written line $\wedge (H(n)\in y\to H\ldots$? It would be very useful if the solution allows regulation for fine adjustment.
- Triangle Nesting ( Similar to Sierpinski Triangles ) [duplicate]by Discrete on August 15, 2026 at 7:09 pm
Im curious to know if there is a more efficient way to have triangles repeat themselves in one another without needing to run the \draw command for each line of the triangle; similar to Sierpinski's triangles is essentially what it is but in a different way for nesting. So far i've been doing the \draw command as such \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale = 3] \draw[thick] (0,0) -- (2,0) -- (1,1.73205) -- cycle; \draw[thick] (0,0) -- (1,0.8) (2,0) -- (1,0.8) -- (1,1.73205) -- (1,0.8); \draw[thick] (1,0.8) -- (1.566667,0.769); \end{tikzpicture} \end{document} Ive provided an example above of what it should look like however I need to define what the colors mean and some rules it has. Meaning of Colors: Black = 1st Generation triangles, Blue = 2nd Generation triangles, and Red = 3rd Generation triangles as well each generation has a specific intersection where all the points meet ( for example black has a intersection in the middle where all points meet ) I should also say that each generation has its own "sub section" where the rule above applies to each sub section and these sub sections are divided by the lines of the previous generation. ( for example a 3rd generation sub section can have a different intersection than another 3rd generation sub section this is so each has one intersection which will for the sake of simplicity be set in the center for all generations) if you have any questions on this to better help me feel free to ask and I apologize if some of it seems confusing it is a rather "niche" section of discrete geometry relating to triangles and other two dimensional shapes ( side note i'd like this concept to be done with other two dimensional shapes as well so if theres a way to set the starting shape to say a circle or another shape that would be amazing; and it would follow the same rules I have revealed here).
- standalone class gives PDF warningby karlh on August 15, 2026 at 6:13 pm
If I create a minimal drawing using the standalone class, I get a warning: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw circle (1); \end{tikzpicture} \end{document} $ pdflatex [filename] [blah blah] [1 Non-PDF special ignored! <special> papersize=57.30548pt,57.30548pt A similar warning is emitted when using LuaTeX instead of PDFTeX. This message can safely be ignored, of course, but if I recall correctly, it was not there in past versions, and I thought I'd ask if someone knows why it occurs and whether it should occur. I don't know when this started happening, but I also do not remember it happening prior to a particular TeXLIVE upgrade (which would have been from TeXLIVE 2022 -> 2025, iirc, which Fedora was waiting on for quite a while so they could reorganize the packages).
- How to draw highly accurate, continuous pH titration curves with the tangent method in TikZ/pgfplots?by Natsu on August 15, 2026 at 5:28 pm
When attempting to plot pH-metric titration curves for weak/polyprotic acids and bases using piecewise Henderson-Hasselbalch approximations, sharp breaks and discontinuous artifacts often appear near equivalence points. Is there a robust, automated way in TikZ and pgfplots to plot continuous curves using exact charge and mass balance equations, while also supporting geometric constructions such as the tangent method (méthode des tangentes)?
- How can I customize an create new the unicode-math package's \symxx command and toggle between letter glyphs? [closed]by mathrm alpha on August 15, 2026 at 8:08 am
While LaTeX has a similar mechanism for inputting single characters, it doesn't mention something like \symttit{ABC€} where you only need to switch ABC in \symttit, meaning you don't need to switch € in \symttit in Monospace Italic style. Replacing characters in the argument - even within other commands unicode-math font character new mapping in \symsf I also used the above reference programs to switch font characters in a similar way: \documentclass{article} \usepackage{unicode-math} \ExplSyntaxOn \NewDocumentCommand{\symttit}{m} { \group_begin: \cs_set:Npn A { \texttt{\textit{A}} } \cs_set:Npn B { \texttt{\textit{B}} } \cs_set:Npn C { \texttt{\textit{C}} } \symit{#1}% Make a unavailable \symttit glyphs in fallback fonts \group_end: } \ExplSyntaxOff \begin{document} \texttt{\textit{ABC}} vs $\symttit{ABC}$ \end{document} However, it does not support switching between Monospace Italic style by inputting a single character within \symttit. The full name of the LaTeX command is required to switch to other character types (like the previous mechanism of converting \symsf{\alpha} to Greek letters).
- BibLatex not working on Mac TeXShop [duplicate]by Kevin on August 15, 2026 at 7:45 am
I'm using Mac TeXShop Version 5.57, on Mac OS Sequoia 15.7.4. I had been using BibTeX before with no problem but I've heard about BibLaTeX and figured I should get with the times and start using it (I also hope to do more complicated things like having several Bibliographies in the same document and such). \documentclass{amsbook} \include{header} % things I define in all my stuff here \usepackage{biblatex} \addbibresource{refs.bib} % my BibTeX file \begin{document} My document, blah blah, \cite{firstcitation}. \printbibliography \end{document} In TeXShop, I go to the "Typeset" Menu > LaTeX Then "Typeset" Menu > BibTeX Then "Typeset" Menu > LaTeX Then "Typeset" Menu > LaTeX like I always did with BibTeX. When it runs BibTeX, I get the following: This is BibTeX, Version 0.99d (TeX Live 2025) The top-level auxiliary file: app-history.aux I found no \citation commands---while reading file myfile.aux I found no \bibdata command---while reading file myfile.aux I found no \bibstyle command---while reading file myfile.aux (There were 3 error messages) and it doesn't generate anything in the .bbl file. In the end, I LaTeX it twice and no bibliography appears but instead I get the error: Package biblatex Warning: Please (re)run Biber on the file: (biblatex) app-history (biblatex) and rerun LaTeX afterwards. I am able to use BibTeX fine: \documentclass{amsbook} \include{header} % things I define in all my stuff here \begin{document} My document, blah blah, \cite{firstcitation}. \bibliographystyle{plain} % We choose the "plain" reference style \bibliography{refs} \end{document} works just fine.
- "Red. by", series editor in bibliographyby Mirco Nonchef on August 15, 2026 at 7:03 am
I'm using Latex with Zotero. I want to cite a book from a book series. The book has an author and an editor, and the book series has a separate title (the Dover Thrift Editions) and its own editor. When I add an Editor and a Series Editor role as in the MWEB below, I get the following in the bibliography: "Ed. by Janet B. Kopito, Red. by Susan L. Rattiner". The Red. (redacted) does not reflect the role of the series editor properly. Also, the name of the series is currently not part of the entry in the .bib file. How can I add the information for this publication such that it is displayed completely and accurately? MWEB: \begin{filecontents*}{\jobname.bib} @book{frost2019, title = {New {H}ampshire}, author = {Frost, Robert}, editor = {Kopito, Janet B.}, editora = {Rattiner, Susan L.}, editoratype = {redactor}, } \end{filecontents*} \documentclass{article} \usepackage[% autolang=other, backend=biber, style=numeric, defernumbers=true, autocite=superscript, giveninits=false, uniquename=false, language=english ]{biblatex} \addbibresource{\jobname.bib} \begin{document} \cite{frost2019} \printbibliography \end{document}
- How to make Verbatim environment that matches my current one based on tcolorboxby Nasser on August 15, 2026 at 12:01 am
Currently I use this to make verbatim display with rounded frame and yellow background, which works well, but I have to use \begin{tcolorbox}[myBox] \begin{verbatim} ..... \end{verbatim} \end{tcolorbox} But I'd like to be shorten this and be able to just write \begin{myVerbatim} ..... \end{myVerbatim} I can't make normal latex environment using \newenvironment{myVerbatim}[1]{% \begin{tcolorbox}[myBox] \begin{verbatim} }{% \end{verbatim} \end{tcolorbox} } Because what I am passing is verbatim. So I tried to use fancyvrb and its \DefineVerbatimEnvironment{myVerbatim}{Verbatim}{ but I am not able to get the exact look I currently have using tcolorbox and verbatim. From what I found it seems fancyvrb does not support rounded corners for frame and also does not support background color. fillcolor is not same. I do not want to use listings package in any way in all of this. (causes issue with tex4ht) Below I show my current tcolorbox implementation and my fancyvrb one. The question is: Is it possible to obtain the same look but using \DefineVerbatimEnvironment ? \documentclass[12pt]{article} \usepackage{tcolorbox} \usepackage{xcolor} \usepackage{verbatim} \tcbuselibrary{breakable} \definecolor{bg}{RGB}{255,255,226} \tcbset{ myBox/.style={ colframe=gray, colback=bg, boxrule=0.5pt, boxsep=4pt, arc=4pt, left=0pt, right=0pt, top=0pt, bottom=0pt } } \begin{document} \begin{tcolorbox}[myBox] \begin{verbatim} some 3^2 verbatim % text \sin x def hello_world_and_my_var(): print("Underscores work fine inside standard verbatim!") return True \end{verbatim} \end{tcolorbox} %I'd like to just do the following instead %\begin{myVeratim} % ................ %\end{myVerbatim} \end{document} Compiled using lualatex Here is the best I can do using fancyvrb \documentclass[12pt]{article} \usepackage{fancyvrb} \usepackage{xcolor} \definecolor{bg}{RGB}{255,255,226} % Define the custom verbatim environment \DefineVerbatimEnvironment{myVerbatim}{Verbatim}{ frame=single, % Adds the outer border framerule=0.5pt, % Sets border thickness rulecolor=\color{gray}, % Sets border color fillcolor=\color{yellow}, % Sets the yellow background color framesep=4pt, % Adjusts internal padding (matches boxsep) } \begin{document} \begin{myVerbatim} some 3^2 verbatim % text \sin x def hello_world_and_my_var(): print("Underscores work fine inside standard verbatim!") return True \end{myVerbatim} \end{document} Gives Which is not exactly the same. The solution I am looking for is to generate similar output as the first one above, but using \begin{myVerbatim}....\end{myVerbatim} to reduce typing. But with restrictions no use or loading listing package no use of external temporary files Any solution that does this will be great. It does not have to use fancyvrb either For an example, solution such as \newtcblisting{myVerbatim}{ colback=yellow!20, % background color colframe=gray, % border color boxrule=0.5pt, % border thickness arc=4pt, % rounded-corner radius boxsep=4pt, % padding left=4pt, right=4pt, top=4pt, bottom=4pt, listing only } Will not work, as this causes listing package to be loaded. TL 2026
- How to embed a qr code in a tcolorbox?by modallyFragile on August 14, 2026 at 10:58 am
I want to make an environment which takes two mandatory arguments, a title and a url, and prints a box, with the title at the top, a QR code of the url on the left, and the url itself at the bottom. The contents of the environment should be printed in the right of the box, wrapping under the qr code if long enough. I've got close. The MWE below creates a command which does this. But: It's not an environment. The tcolorbox tools available make it harder to create an environment with preset content. The qr code is printed, but leaves a thick margin at the top, between the QR code and the box. If the text is short, the QR code doesn't 'push' the bottom of the box down to accommodate it. (all demonstrated by the MWE below). The main issue seems to be floating (or otherwise managing) the QR code inside the box. I'm not sure how to approach this; below I used wrapfig2 because another question I found had success it. It compiles, but it doesn't quite work. How can I achieve what I want? \documentclass{article} \usepackage[skins]{tcolorbox} \usepackage{qrcode} \usepackage{wrapfig2} \usepackage{lipsum} % <title> <link> <description> \NewTotalTColorBox{\mweqrbox}{ m m m }{ enhanced,colback = white,colframe=black,coltitle=black, sharp corners,boxrule = 0.4pt, fonttitle = \itshape, attach boxed title to top text left = { yshift = -0.5\baselineskip-0.5pt, yshifttext = -0.25\baselineskip }, boxed title style={ tile, size = minimal, left = 0.5mm, right = 0.5mm, colback = white, before upper = \strut }, title={#1}, subtitle style = { fontupper = \scriptsize\ttfamily, colback = white, colframe = white, top=0pt, nobeforeafter }, lower separated=false }{% \begin{wrapfigure}{l} \qrcode{#2} \end{wrapfigure} #3 % Description % this is useful because otherwise, with a short description, the % subtitle cuts through the middle of the QR code. \tcblower \tcbsubtitle{#2} } \begin{document} \mweqrbox{Foo}{https://example.com/some/long/path#fragment}% { Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here.} \end{document}
- Text in multicolumn cells does not center in tabularxby Alexander Z. on August 14, 2026 at 10:23 am
I am trying to create a tabularx table with centered content. Everything works as long as each cell is one column wide. But as long as I add multicolumn cells, the centering is skewed. How do I make the content centered properly? MWE: \documentclass[12pt,a4paper]{book} \usepackage{graphicx} % Required for inserting images \usepackage{float} \usepackage{tabularx} \usepackage[a4paper,hmargin=1.0cm,vmargin=1.5cm]{geometry} \newcolumntype{R}{>{\centering\arraybackslash}X} \renewcommand\tabularxcolumn[1]{m{#1}} \usepackage{multicol} \setlength{\columnsep}{1.0pc} \usepackage{multirow} \begin{document} \begin{figure}[H] \centering \begin{minipage}{1.0\textwidth} \Large \centering \begin{tabularx}{\textwidth}{|R|R|R|R|R|R|R|R|R|R|} \hline 30 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 \\ \hline 40 & 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 \\ \hline 50 & 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 \\ \hline 60 & (61) & (64) & (85) & (94) & (140) & (162) & \multicolumn{3}{>{\hsize=3\hsize\linewidth=\hsize}R|}{(\emph{on the right:} 163)} \\ \hline \multicolumn{6}{|>{\hsize=6\hsize\linewidth=\hsize}R|}{(\emph{on the left:} 170)} & & & & \\ \hline \end{tabularx} \end{minipage} \end{figure} \end{document} Result:
- Combining "manyfoot" with "endnotes" package to store two different sets of endnotesby BarbarianLunatic on August 14, 2026 at 9:56 am
I am currently working on a new book and would like to store two different sets of endnotes at the end of the document. One Should go under the Title "Botanical Relevance" and one "Noteworthy Mentions". I have managed at least to set the titles, but I cannot wrap my mind around the formatting. The idea is to predefine two sets of endnotes (one \alph and one \ arabic) with manyfoot and store them in two separate endnote libraries at the end of the document. The endnote libraries should preferably be called with a command like "\theendnotesB" and "\theendnotesN". I tried using "\let\footnoteB=\endnote" and changing it to "\let\footnoteN=\endnote" after having called the first endnote library, but the attempt failed. Any help appreciated. This is the MWE: \documentclass[12pt,draft]{book} \usepackage[ paperwidth=148mm,%242mm, paperheight=210mm, top=17mm, bottom=10mm, inner=15mm, outer=13mm, ]{geometry} \usepackage{nopageno} \usepackage[T1]{fontenc} \usepackage{manyfoot} \usepackage{endnotes} % multifoot Declaration \DeclareNewFootnote{B}[alph] % B = Botanical Relevance \DeclareNewFootnote{N}[arabic] % N = Noteworthy Mentions % How to Create a custom command to store all “B” Notes in one Endnote Library and all “N” Notes in another. \newcommand{\theendnotesB}{ } % not sure how to do this \newcommand{\theendnotesN}{ } % not sure how to do this % Sending "B" footnotes to endnotes library \let\footnoteB=\endnote % this command stores the “B” notes in Endnotes, but also changes them to arabic numbering \begin{document} ...and the Mage picked a white multifaceted flower and said ''Kham\footnoteB{This flower is equivalent to Yarrow (Achillea millefolium) and has the same properties}'' to the stranger, who understood nothing for the moment, but promised to himself quietly that he would learn everything he could from this man, who seemed so strange and yet so resourceful...for he knew that his people were in need of this knowledge\footnoteN{Here it must be mentioned that any man, who strives to become truly wise in the properties of healing plants, is an asset to his people.}.\\ The Moment passed and turned to dust, as everything will do at last, but worry not for life moves on and shows the seeking heart what's strong. %Endnotes Title B \renewcommand{\notesname}{\hphantom{cccccc}Botanical Relevance} %Endnotes B \newpage \begingroup \parindent 0pt \parskip 2ex \def\enotesize{\normalsize} \theendnotes %should probably be a new command → \theendnotesB \endgroup %Endnotes Title N \renewcommand{\notesname}{\hphantom{cccccc}Noteworthy Mentions} \let\footnoteN=\endnote % it was an attempt, but it failed %Endnotes N \newpage \begingroup \parindent 0pt \parskip 2ex \def\enotesize{\normalsize} \theendnotes %should probably be a new command → \theendnotesN \endgroup \end{document} These are the Pages with comments:
- kpfonts-otf: too much whitespace between integral sign and integrand?by Jürgen on August 13, 2026 at 4:16 pm
Maybe it is a matter of taste, but I think the space between integral sign and integrand is way too large when the kpfonts-otf package is in use: \documentclass{scrartcl} \usepackage{kpfonts-otf} %\usepackage{unicode-math} % loaded automatically by kpfonts-otf \removenolimits{\int} \removenolimits{\oint} \begin{document} \begin{equation} I = \int_0^x S ds \end{equation} \begin{equation} I = \oint_0^x S ds \end{equation} \end{document} This has already been discussed in this question, but I still think the space is not correct. [I am not sure, whether the tags are ok. Pls modify them if necessary.]
- How to realize a parenthesis with polyglossia?by Jürgen on August 13, 2026 at 9:32 am
I used to glue the dashes to the parenthesis like shown below with pdflatex. \documentclass{scrartcl} \usepackage{kpfonts-otf} \usepackage[babelshorthands=true]{polyglossia} \setdefaultlanguage{german} \begin{document} This is a "~- not necessarily smart~-- text. \end{document} Running with lualatex yields this result (edited): I cannot find a solution in the fine polyglossia manual. How to do it correctly? Edit: The result should like this: with the important aspect, that both dashes are glued to the parenthesis when it comes to a line break.
- Problem when defining a new operator for the l3fp module: \fp_tuple_item:nnby Jasper Habicht on August 12, 2026 at 3:09 pm
Note that the aim of this is to add a new operator to the l3fp module of the LaTeX3 kernel and therefore internal functions and reserved prefixes are used throughout the code. Please use this code with the due caution. I try to add a function and operator to the l3fp module that extracts an item from a tuple. I started with defining a public function and underlying internal functions that leave the relevant item of a tuple in the internal fp representation in the input stream. Placed into \fp_eval:n, this results in the intended output (one could also imagine adding \fp_to_decimal:n to this, so it returns the relevant number directly): \documentclass{article} \begin{document} \ExplSyntaxOn \makeatletter % public function \cs_new:Npn \fp_tuple_item:nn #1#2 { \exp_args:Nee \__fp_tuple_item:nn { \__fp_parse:n {#2} } { \__fp_parse:n {#1} } } % internal functions \cs_new:Npn \__fp_tuple_item:nn #1#2 { \__fp_tuple_item_aux:ww #1#2 } \cs_new:Npn \__fp_tuple_item_aux:ww #1 \__fp_sep: { \__fp_tuple_item_select_aux:nw { \__fp_to_int:w #1 \__fp_sep: } } \cs_new:Npn \__fp_tuple_item_select_aux:nw #1 \s__fp_tuple \__fp_tuple_chk:w #2 \__fp_sep: { \int_compare:nNnTF {#1} < 0 { \__fp_tuple_item_select_aux:nw { \__fp_int_eval:w \__fp_array_count:n {#2} + 1 + #1 \__fp_int_eval_end: } \s__fp_tuple \__fp_tuple_chk:w {#2} \__fp_sep: } { \__fp_tuple_item_select_auxi:nw {#1} #2 \s__fp_stop } } \cs_new:Npn \__fp_tuple_item_select_auxi:nw #1 { \int_compare:nNnTF {#1} = 1 { \__fp_tuple_item_select_auxii:w } { \__fp_tuple_item_select_auxiii:nw {#1} } } \cs_new:Npn \__fp_tuple_item_select_auxii:w #1 \__fp_sep: #2 \s__fp_stop { #1 \__fp_sep: } \cs_new:Npn \__fp_tuple_item_select_auxiii:nw #1#2 \__fp_sep: { \__fp_tuple_item_select_auxi:nw { \__fp_int_eval:w #1 - 1 \__fp_int_eval_end: } } \makeatother \fp_eval:n { \fp_tuple_item:nn { ( 1 , 2 ) } { 1 } } % returns 1 \fp_eval:n { \fp_tuple_item:nn { 2 * ( 1 , 2 ) } { 2 } } % returns 4 \fp_eval:n { \fp_tuple_item:nn { ( 1 , 2 , 3 ) } { -1 } } % returns 3 \ExplSyntaxOff \end{document} So far, so good, but now I want to define a new function operator that can be used in an fp expression. The syntax should be item(n,t) where n is the index of the item and t is the tuple. I looked at the implementation of various other functions in the l3fp module such as round() or rand() and came up with the following relatively straight-forward defintion: \cs_new:Npn \__fp_parse_word_item:N { \__fp_parse_function:NNN \__fp_item_o:Nw ? } \cs_new:Npn \__fp_item_o:Nw ? #1 @ { \exp_after:wN \__fp_item_o:w #1 @ } \cs_new:Npn \__fp_item_o:w { \exp_after:wN \__fp_tuple_item_aux:ww } However, this results in an error as eventually \__fp_parse_after:ww does not see the expected tokens. I checked the expansion process up to this point using the unravel package and I can see that I get something along the following lines (<fp> being the relevant internal fp representation): \__fp_parse_after:ww \s__fp <fp> \__fp_sep: @ \exp:w \exp_end_continue_f:w \__fp_parse_infix_end:N \c__fp_prec_end_int \s__fp_expr_stop \exp_end: Other functions return something similar but without \c__fp_prec_end_int which is exactly what \fp__parse_after:ww wants whose argument defintion is #1 @ \__fp_parse_infix_end:N \s__fp_expr_stop #2. Now, I am lost at this point. I can see that my implementation yields the correct fp representation, but I am unable to find the reason why \c__fp_prec_end_int (along with \exp:w \exp_end_continue_f:w) is left in the stream and what I should do to remove this. Full MWE: \documentclass{article} \begin{document} \ExplSyntaxOn \makeatletter % public function \cs_new:Npn \fp_tuple_item:nn #1#2 { \exp_args:Nee \__fp_tuple_item:nn { \__fp_parse:n {#2} } { \__fp_parse:n {#1} } } % internal functions \cs_new:Npn \__fp_tuple_item:nn #1#2 { \__fp_tuple_item_aux:ww #1#2 } \cs_new:Npn \__fp_tuple_item_aux:ww #1 \__fp_sep: { \__fp_tuple_item_select_aux:nw { \__fp_to_int:w #1 \__fp_sep: } } \cs_new:Npn \__fp_tuple_item_select_aux:nw #1 \s__fp_tuple \__fp_tuple_chk:w #2 \__fp_sep: { \int_compare:nNnTF {#1} < 0 { \__fp_tuple_item_select_aux:nw { \__fp_int_eval:w \__fp_array_count:n {#2} + 1 + #1 \__fp_int_eval_end: } \s__fp_tuple \__fp_tuple_chk:w {#2} \__fp_sep: } { \__fp_tuple_item_select_auxi:nw {#1} #2 \s__fp_stop } } \cs_new:Npn \__fp_tuple_item_select_auxi:nw #1 { \int_compare:nNnTF {#1} = 1 { \__fp_tuple_item_select_auxii:w } { \__fp_tuple_item_select_auxiii:nw {#1} } } \cs_new:Npn \__fp_tuple_item_select_auxii:w #1 \__fp_sep: #2 \s__fp_stop { #1 \__fp_sep: } \cs_new:Npn \__fp_tuple_item_select_auxiii:nw #1#2 \__fp_sep: { \__fp_tuple_item_select_auxi:nw { \__fp_int_eval:w #1 - 1 \__fp_int_eval_end: } } % operator defintion \cs_new:Npn \__fp_parse_word_item:N { \__fp_parse_function:NNN \__fp_item_o:Nw ? } \cs_new:Npn \__fp_item_o:Nw ? #1 @ { \exp_after:wN \__fp_item_o:w #1 @ } \cs_new:Npn \__fp_item_o:w { \exp_after:wN \__fp_tuple_item_aux:ww } \makeatother \fp_eval:n { item ( 1 , ( 1 , 2 ) ) } \ExplSyntaxOff \end{document}
- Where is download KAOBOOK class [closed]by 조문수 on August 12, 2026 at 12:14 pm
After installing TeX Live 2026, whenever I compile Kaobook in TeXstudio, I keep getting an error similar to the one in the attachment. I’m new to LaTeX. Where can I download the complete, modified Kaobook file? I’m trying to compile using XeLaTeX with Korean text by using \usepackage{kotex}. How should I configure the settings or the cls file? Is there anyone who can help me?
- Text disappears in tabularray with bg color (polyglossia)by user446526 on August 12, 2026 at 9:25 am
I am typesetting an Arabic document using XeLaTeX and the polyglossia package. I am trying to build a table using the tabularray package. The Problem: Whenever I apply a background color to a specific row using the bg key (e.g., row{1} = {bg=blue!20}), the Arabic text inside that row completely disappears in the output PDF. The text in the other rows (which do not have a background color) renders perfectly fine. It seems like a layering or grouping issue where the bidi package (loaded by polyglossia) conflicts with tabularray's drawing engine, causing the colored box to either cover the text or push the RTL text out of bounds. I have already tried: Removing font=\bfseries from the row settings. Using manual \textbf{} inside the cells. Wrapping the text in \mbox{}. Using \SetCell{bg=blue!20} instead of row{1}. None of these solved the issue; as long as the background color is present, the text vanishes. Minimum Working Example (MWE): \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} % RTL Setup \usepackage{polyglossia} \setmainlanguage{arabic} \setmainfont{Amiri} % Standard Arabic font for testing \begin{document} \begin{center} \begin{longtblr}{ colspec = {|X[c,m,1.6]|X[c,m,1.4]|X[c,m,1.4]|}, hlines, vlines, row{1} = {bg=blue!20, rowsep=5pt}, % The text in this row disappears rowsep=8pt } \textbf{النهاية} & \textbf{التفسير الهندسي} & \textbf{التمثيل البياني} \\ Text appears here & Text appears here & Text appears here \\ \end{longtblr} \end{center} \end{document}
- How to get WebOMints GD to work in LuaLaTeXby Maronite Monks on August 11, 2026 at 8:42 pm
I'm running an antique MacOS (mojave) with MacTeX 2022 installed. The MWE below compiles successfully with XeLaTeX, but with LuaLaTeX, I get the following message: kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 WebOMintsGD mktexpk: don't know how to create bitmap font for WebOMintsGD. mktexpk: perhaps WebOMintsGD is missing from the map file. kpathsea: Appending font creation commands to missfont.log. ! error: (file WebOMintsGD) (type 3): font WebOMintsGD at 600 not found ! ==> Fatal error occurred, no output PDF file produced! What does LuaLaTeX want me to do to make this work? %%%%%%%%%%%%%%%%%%%%%%%% \documentclass{memoir} \usepackage{fontspec} \newfontfamily\wb{WebOMints GD} \pagestyle{empty} \begin{document} \wb ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz \end{document}
- Title ends with two periods using apaciteby Mirlan on August 11, 2026 at 6:39 pm
I'm citing a popular online dictionary: \documentclass{article} \usepackage[natbibapa]{apacite} \begin{filecontents}{\jobname.bib} @inbook {MWOganesson, author = {Merriam-Webster}, title = {Oganesson}, book = {Merriam-Webster.com dictionary}, url = {https://www.merriam-webster.com/dictionary/oganesson} } \end{filecontents} \begin{document} The word ``oganesson'' is stressed on the third syllable \citep{MWOganesson}. \bibliographystyle{apacite} \bibliography{\jobname} \end{document} In the output, the title is printed as "Oganesson.." with two periods. Is a workaround known?
- lualatex: integral limits above and below the integral sign wanted (instead of right) [duplicate]by Jürgen on August 11, 2026 at 11:17 am
[continuation of this closed question from today] I would like to have the limits above and below the integral, not on the right side. Using pdflatex I realized this with the shown options for amsmath. What do I have to do when using lualatex? \documentclass{scrartcl} %\usepackage[intlimits,sumlimits]{amsmath} % used w/ pdflatex \usepackage{unicode-math} %\setsansfont{KpSans} %\setmainfont{KpRoman} %\setmathfont{KpMath-Regular} \begin{document} \begin{equation} E = \int_0^x m d c \end{equation} \end{document} With the \removenolimits macro the limits are on the right place (for me on displayed equations). When I compare the results with pdflatex & kpfonts with lualatex & kpfonts-otf I notice two points: (1) The slanted integral sign looks better (for me). But this is surely the decision of the designer. That's ok for me. (2) The distance between the integral sign and the integrand is far too long. Of course I can modify the \int macro, but maybe there is a better way?!
- Adjust vertical space after last item of a listby Sunris8 on August 11, 2026 at 8:23 am
I'm using setlength\itemsep{..} to change the space between subitems of a customized list. The problem is that the last "subitem" is too close to the second "main item" (see picture). This is quite ugly and unbalanced. Is there a way to automatically increase the spacing (other than setlength\itemsep{..} or \vspace) that would fit in this case? \documentclass{article} \usepackage{enumitem} \newlist{questions}{enumerate}{3} \setlist[questions,1]{font=\bfseries, label = Exercise~\arabic*~:, ref = \arabic*, align = left, wide=0cm} \setlist[questions,2]{label=\bfseries \arabic*),align = right, leftmargin=1.2cm} \begin{document} \begin{questions} \item Question? \begin{questions} \item Subquestion 1 \item Subquestion2: nice spacing \end{questions} \item More Questions? \begin{questions} \item Subquestion 1 \item Subquestion2 \end{questions} \end{questions} \vspace{2cm} \begin{questions} \item Question? \begin{questions}\setlength\itemsep{3em} \item Subquestion 1 \item Subquestion2 : bad spacing \end{questions} \item More Questions? \begin{questions} \item Subquestion 1 \item Subquestion2 \end{questions} \end{questions} \end{document}
- lualatex: integral limits above and below the integral sign wanted [closed]by Jürgen on August 11, 2026 at 8:01 am
I would like to have the limits above and below the integral, not on the right side. Using pdflatex I realized this with the shown options for amsmath. What do I have to do when using lualatex? \documentclass{scrartcl} \usepackage{fontspec} %\usepackage[intlimits,sumlimits]{amsmath} \usepackage{unicode-math} %\setsansfont{KpSans} %\setmainfont{KpRoman} %\setmathfont{KpMath-Regular} \begin{document} \begin{equation} E = \int_0^x m d c \end{equation} \end{document}
- Unknown Template Keys in \EditInstanceby CarneSeca on August 10, 2026 at 5:17 pm
I'm trying to write a set of course notes with LaTeX's accessibility tagging on, but I want to change up the chapter and sections headings. The titlesec package is incompatible, so I'm using the \EditInstance command, based on the answers to this previously asked question: Space between top of text area and chapter heading using \EditInstance formating (ruled headformat) I copy-pasted MWE#2 from that answer into my LaTeX editor, re-copied below for completeness. I'm compiling with TexLive 2026's version of lua-latex, which reports itself as ' LuaHBTeX, Version 1.24.0 (TeX Live 2026) ', all packages are up-to-date in tlmgr. The issue is that I get several errors of the form "LaTeX template: Unknown template key 'after-sep'." (I also get the same error for before-sep and decls, as well as "LaTeX template: The instance 'hang' of type 'headformat' is unknown.") I'd like to make this MWE work on my system (so I can modify it to my needs), but I can't for the life of me figure out what is going on. I haven't been able to find any good documentation online about the \EditInstance command, I'm basically just going off of what I can learn from Stack Exchange questions. Any help is appreciated! % Source - https://tex.stackexchange.com/q/760989 % Posted by polaren % Retrieved 2026-08-10, License - CC BY-SA 4.0 \DocumentMetadata{ lang = sv, pdfversion = 2.0, pdfstandard = ua-2, tagging = on, } \documentclass[11pt,a4paper,twoside,final]{report} \usepackage[margin=25mm,top=24mm,bottom=24mm,nomarginpar,nohead,footskip=11mm]{geometry} \usepackage{showframe}\renewcommand\ShowFrameLinethickness{0.05mm} \usepackage[document]{ragged2e} % Needed for compilation. \usepackage{hyperref} % Needed to pass VeraPDF. \hypersetup{ pdftitle={MWE}, pdfauthor={polaren}, pdfsubject={First question to LaTeX Stack Exchange.}, } \EditInstance{heading}{chapter}{ number-format=\makebox[12mm][l]{\theheading.}, number-decls=\sffamily\fontsize{14pt}{16pt}\selectfont, title-decls=\sffamily\fontsize{14pt}{16pt}\selectfont, after-sep=0mm, before-sep=0mm, start-code=\clearpage\vspace*{-10.75mm}\rule{\textwidth}{0.1mm}\newline\vspace*{-18mm}, final-code=\vspace*{-5mm}\rule{\textwidth}{0.1mm}\newline\vspace*{0mm}, headformat-instance=hang, decls=\raggedright\parindent 0pt\rmfamily } \setlength{\parskip}{6pt plus 1pt minus 1pt} %\setlength{\parskip}{0pt} \usepackage{kantlipsum} \begin{document} \chapter*{Unnumbered Chapter} Test. \chapter{Title of Chapter} \kant[1] \end{document}
- Is There a Simpler Way to Use Lettrines in a Verse Environment without Invoking a Subroutineby Yves on August 10, 2026 at 2:10 pm
This is a follow-up question, based on the solutions found in Is There a Simpler Way to Use Lettrines in a Verse Environment without Invoking a Subroutine? In an attempt to help a friend compose a book of her poems, I have tried to take advantage of the lessons above, in particular the last one using the lettrine method. However when I change the poem (seemingly without any other change), I get the two first lines severely indented and the output is not visually satisfactory. I could not explain the reason for this and even less find a correction. \documentclass[a4paper,10pt]{article} \usepackage{lettrine} \usepackage{verse} \begin{document} \poemtitle{Complete solution via {\em lettrine} methods} \begin{verse}[8cm] \lettrine[lhang=1.5,nindent=0em]{M}{aking} a famine where abundance lies,\\> Thy self thy foe, to thy sweet self too cruel.\\ Thou that art now the world's fresh ornament, \\ And only herald to the gaudy spring, \\ Within thine own bud buriest thy content, \end{verse} \bigskip \poemtitle {The Sea Bell} \begin{verse}[8cm] \lettrine[lhang=1.5,nindent=0em]{I}{walked} by the sea,\\> and there came to me,\\ as a star-beam on the wet sand,\\ a white shell like a sea-bell;\\ trembling it lay\\ in my wet hand.\\ In my fingers shaken I heard waken\\ a ding within, by a harbour bar\\ a buoy swinging, a call ringing\\ over endless seas,\\ faint now and far\ldots \end{verse} \end{document
- How to reproduce the correct intersection curve of two 3D surfaces using PGFPlots?by Samia Rani on August 10, 2026 at 10:50 am
I am trying to reproduce a 3D figure from a mathematics book in LaTeX using TikZ/PGFPlots. The figure shows two surfaces and their intersection. The two surfaces are given by x^2 + xy - y - 3z = 0 and 2x^2 + 3xy - 2y - 3z = 0. I plotted both surfaces directly from their equations and also added their intersection curve. However, the shape and especially the intersection curve in my output look quite different from the figure in the book, even though I am using the same equations. I am not sure whether the difference is caused by the viewing angle, the plotting ranges, the parametrization of the intersection curve, or something else. Here is my current code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ view={120}{25}, axis lines=none, xmin=-2.5, xmax=2.5, ymin=-2.5, ymax=2.5, zmin=-5, zmax=5, width=11cm, height=8cm, ticks=none, ] %================================================ % GREEN SURFACE % 2x^2 + 3xy - 2y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={greenmap}{ color(0cm)=(green!15); color(1cm)=(green!35) }, colormap name=greenmap, domain=-2:2, y domain=-2:2, samples=35, samples y=35, opacity=0.65, ] { (2*x^2 + 3*x*y - 2*y)/3 }; %================================================ % BLUE SURFACE % x^2 + xy - y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={bluemap}{ color(0cm)=(blue!15); color(1cm)=(blue!35) }, colormap name=bluemap, domain=-2.2:2.2, y domain=-2.2:2.2, samples=30, samples y=30, opacity=0.55, ] { (x^2 + x*y - y)/3 }; %================================================ % INTERSECTION CURVE % gamma(t) = % ( t, -t^2/(2t-1), t^3/(3(2t-1)) ) %================================================ \addplot3[ very thick, red, samples=100, domain=-2.2:0.35, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \addplot3[ very thick, red, samples=50, domain=0.65:2.2, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \end{axis} \end{tikzpicture} \end{document} The book's figure has a noticeably different orientation and shape for the two surfaces and their intersection. The book's figure looks like this: My current output looks like this: Could someone please explain what is causing this difference and how I can modify my PGFPlots code to obtain a figure that looks like the one in the book? In particular, I would like to know whether I should change the view angles, the plotting domains, or the parametrization of the intersection curve.