Hot
- No page numbering from AMS Undergrad textbook templateby Fifty Two on March 7, 2026 at 1:47 am
Hi I tried looking for solutions online, but found nobody with this error, so I think it justifies this question. I wanted to copy the rather common template I've seen from various lecture notes and books. The template in question is the pure and applied undergrad text from the AMS monograph website: https://www.ams.org/arc/books/book-produce.html An example of the template on a chapter page I want to emulate is this one: This was taken from the template given in the link on the AMS website, once downloaded. Yet when I try do use the exact same template in Overleaf, I get pretty much the same thing, but without any page numbering: I highly doubt this is an Overleaf issue, so that's why I wanted to ask here. I would appreciate any assistance/instructions on how to turn on page numbering (from what I can see it is already enabled). Thanks.
- What is the difference between the Web ConTeXt tool and the most recent install zip from Pragma ADE site?by Gary on March 6, 2026 at 10:53 pm
I learned about the https://context-on-web.eu/ site just a few hours ago and am a bit confused about the results I am getting; and thought perhaps there is a version difference of some kind. I've been trying to find a solution to this question and thought I might try joining the ConTeXt mailing list and ensure the MWE works in this web tool. The strange thing is that it works fine and generates the desired result that I have not been able to get on my desktop installation. (There is one issue of the \blackrule not working in the web version.) I tried updating my desktop version which appeared to succeed but, when I tried to process the document, there was an error of mtx-context | error, no format found with name: cont-en, aborting. So, I deleted it and re-installed from the zip file. Now, the document processes but still has the old error; yet the exact same script pasted in the web tool does not error and generates the expected/desired result. My question is, What is difference between the web version and the most recent download from https://www.pragma-ade.com/install.htm? I'm running Manjaro Linux OS 64 bit. Thank you. > context --version mtx-context | ConTeXt Process Management 1.06 mtx-context | mtx-context | main context file: /home/gary/programs/context/context-linux-64/tex/texmf-context/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2026.02.19 11:49 mtx-context | main context file: /home/gary/programs/context/context-linux-64/tex/texmf-context/tex/context/base/mkxl/context.mkxl mtx-context | current version: 2026.02.19 11:49
- Transfering a Project to a journals specific styleby Mathematical Dummy on March 6, 2026 at 9:16 pm
I have been working (with some co-authors) on a review article. As of now the document is written entirely in LaTeX (OverLeaf) using my own standard preamble. The PI would now like the paper to be formatted to look like a Nature Human Behavior Article. I tried downloading Natures standard template from their website but doing the transfer across was very messy and I kept getting compliation erros. What is the best way for me to transfer over this work into the required style?
- Italian Parliament: semicircle and colored dotsby Sebastiano on March 6, 2026 at 8:39 pm
I am preparing a project that involves representing the Italian Parliament using a semicircle made of colored dots, as shown in the following image: I have tried to create something using the wheelchart package (page 19 of the manual), which allows generating similar charts. However, I am unable to automatically increase the number of dots per row. For example, in the figure there are 12 dots per row, but I would like a more customizable (for example 7 balls for every radius) and automatic solution to control this. I prefer big dots and not balls. \documentclass{article} \usepackage{tikz} \usepackage{wheelchart} \begin{document} \begin{tikzpicture} \pgfkeys{ /wheelchart, discrete, discrete pic={\shade[ball color=\WCvarB] (0,0) circle[radius=2pt];}, discrete sort=angle, discrete space at borders=false, start angle=180, total angle=180, value=\WCvarA } \wheelchart{ 120/blue/, 45/green/, 40/red/, 25/orange/, 10/purple/, 5/teal/ } \end{tikzpicture} \end{document}
- How to tweak long s and other symbolsby Agente 156 on March 6, 2026 at 7:42 pm
I'm looking for something really simple, to remove completly the bar form the long s. I don't know how to do it properly. I thought of placing and offsetted square over the original long s, but I cannot manage to hide it without moving the whole line off and working properly with \textbf{} I use \newcommand{\longs}{\char"017F}
- Best way to get an extensible arrow with no arrowheads?by Dylan Thurston on March 6, 2026 at 6:42 pm
There are various packages that will conveniently give extensible arrows with sub/superscripts. I'm aware of: amsmath (only for basic arrows) mathtools extarrows chemarrow You can of course do the same thing with TikZ or similar. I want something similar, but with no arrowheads at all. What's the best way to achieve that? I can do it with TikZ, but the mildly annoying part would be matching the standard arrow height and width. Should I figure out how to use the internal \arrowfill@ command in amsmath? My application is essentially marking a chain of edges connected in a graph, with various labels on the edges. Here's one attempt using a text em-dash. You can see that the em-dash isn't the same as the math-mode arrow. \documentclass[12pt]{amsart} \begin{document} \[ x \overset{\mathcal{U}}{\mathbin{\text{---}}} y \overset{\mathcal{U}}{\longrightarrow} z\] \end{document}
- VS Code LaTeX Workshop: latexmk -pdfps fixes chemnum issue but breaks PNG graphics (Cannot determine size of graphic)by palloc on March 6, 2026 at 5:29 pm
I am compiling a LaTeX document in VS Code using the LaTeX Workshop extension on Windows 11. My document uses: chemnum / chemstyle nomencl biblatex mhchem Originally my latexmk tool was configured with: -pdf However, this produced incorrect compound labels when using chemnum with a scheme environment (temporary labels such as TMP1, TMP2 were not replaced). Following advice from a previous question, I changed the compilation pipeline to: -pdfps, (see my previous question: VS Code LaTeX Workshop: how to configure settings.json when using both chemnum and nomencl?) This indeed fixes the chemnum labeling issue. However, now I cannot include PNG graphics. For example: \begin{figure} \centering \includegraphics[scale=0.8]{random.png} \caption{random} \label{fig:random} \end{figure} produces the error: Cannot determine size of graphic (no BoundingBox) (This also does not work with [width=0.5\textwidth] or when using a .pdf image instead of .png.). In the real document there are several PNG graphics. I would also like all PNG images to be included with a fixed scale=0.8. I found the following related question, but it is quite old, so perhaps there is a more up-to-date solution: Cannot determine size of graphic settings.json { "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdfps", "%DOC%" ] }, { "name": "makenomenclature", "command": "makeindex", "args": [ "%DOCFILE%.nlo", "-s", "nomencl.ist", "-o", "%DOCFILE%.nls" ] } ], "latex-workshop.latex.recipes": [ { "name": "latexmk → nomencl → latexmk", "tools": [ "latexmk", "makenomenclature", "latexmk" ] } ], "latex-workshop.latex.recipe.default": "latexmk → nomencl → latexmk", "latex-workshop.latex.autoBuild.run": "never", } main.tex \documentclass{article} \usepackage{geometry} \usepackage{graphicx} \usepackage[version=4]{mhchem} \usepackage{chemstyle} \usepackage{chemnum} \usepackage[backend=biber]{biblatex} \addbibresource{bib.bib} \usepackage{nomencl} \makenomenclature \begin{document} \nomenclature{A}{a} \printnomenclature \section{First} \cite{knuth1984texbook} \begin{scheme} \replacecmpd{benezen} \replacecmpd{toluene} \includegraphics[scale=0.8]{aromatic.eps} \caption{Aromatic-compounds} \label{aromatic-compounds} \end{scheme} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{random.png} \caption{random} \label{fig:random} \end{figure} \refcmpd{benezen, toluene} \printbibliography \end{document} bib.bib @book{knuth1984texbook, title={The texbook}, author={Knuth, Donald Ervin and Bibby, Duane}, volume={15}, year={1984}, publisher={Addison-Wesley Reading} }
- Use a pattern in TikZ multipart nodeby Tobard on March 6, 2026 at 4:56 pm
I would like to apply a pattern decoration in one part of a split node, in TikZ. See the following code: \documentclass[tikz]{standalone} \usetikzlibrary{shapes.multipart, patterns.meta} \begin{document} \begin{tikzpicture}[text width=3cm, draw, rounded corners] \node[draw, fill=yellow, postaction={pattern color=orange, pattern={Lines[distance=10mm,angle=45,line width=5mm]}} ] at (0,0) {Example}; \node[draw, rectangle split, rectangle split parts=2, rectangle split part fill={yellow,white}] at (0,-1) {Title\nodepart{second}Element content}; \end{tikzpicture} \end{document} I would like the "Title" part to look like the "Example" node. I have tried to replace the yellow,white instruction by {yellow, postaction={pattern color=orange, pattern={Lines[distance=10mm,angle=45,line width=5mm]}} },white But it dosn't work. Can you help me? Thanks.
- TikZ: Projecting letter with a cm-matrix onto a 3D rectangular areaby cis on March 6, 2026 at 2:44 pm
I'm drawing a 3D rectangle (which should be a plane, represented by the letter "H"). At the top left corner, at 'C', I want to project a $H$ in mathematical font onto the plane. I've used a cm matrix for this. The position is correct, but I've noticed that the serifs of the 'H' are parallel, despite using $H$, so it doesn't look like mathematical font. What do I need to do? PS: I think, the $H$ should look something like this here: Unfortunately, I can't present it any better. \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[ x={(-4.85mm,-4.85mm)}, y={(10mm,0mm)}, z={(0,10mm)}, font=\footnotesize, ] %\coordinate[label=below:$O$](O) at (0,0,0); \coordinate[label=right:A](A) at (0,2,0); \coordinate[label=B](B) at (0,2,2); \coordinate[label={[anchor=south west, inner sep=1pt]{C $H$ (as it should be)}}](C) at (-2.5,-1.5,2); \coordinate[label=left:D](D) at (-2.5,-1.5,0); \draw[] (A) -- (B) -- (C) -- (D) --cycle; \path let \p1 = ($(B)-(C)$), \p2 = ($(C)-(D)$), \n{len1} = {veclen(\x1,\y1)}, \n{len2} = {veclen(\x2,\y2)}, \n1 = {\x1/\n{len1}}, \n2 = {\y1/\n{len1}}, \n3 = {\x2/\n{len2}}, \n4 = {\y2/\n{len2}} in node[cm={\n1, \n2, \n3, \n4, (C)}, anchor=north west, inner sep=1pt, %transform shape, % no effect ]{H $H$ \mbox{$H$}}; % CoSy \begin{scope}[-latex, thick, shift={(0,-2,2)}] \foreach \P/\s/\Pos in {(1,0,0)/x/above, (0,1,0)/y/right, (0,0,1)/z/right} \draw[] (0,0,0) -- \P node[\Pos, pos=0.9,inner sep=3pt]{$\s$}; \end{scope} \end{tikzpicture} \end{document}
- Section and subsection indentation [duplicate]by charuanl on March 6, 2026 at 1:43 pm
I want the section number to be aligned to the left, with a 1em space for the section name. After that, the content of the first line of the section should be indented to align with the section name, and from the second line onwards, the content should be aligned to the left or right. For the subsection, I want the subsection number to be indented to align with the section name, with a 1em space for the subsection name. After that, the content of the first line of the subsection should be indented to align with the subsection name, and from the second line onwards, the content should be aligned to the left or right. as shown below. Here's my code : \documentclass[a4paper,14pt,twoside,openright]{extbook} \usepackage[top=1in,left=1in,bottom=1in,right=1in]{geometry} \titleformat{\chapter}[display] {\normalfont\bfseries\color{Blue!75}} {\filleft% \begin{tikzpicture} \node[ outer sep=0pt, text width=2.5cm, minimum height=3cm, fill=Blue!75, text centered, inner sep=0pt, font=\color{white}\fontsize{80}{90}\selectfont, ] (num) {\thechapter}; \node[ rotate=90, anchor=south, font=\color{black}\Large ] at ([xshift=-5pt]num.west) {\chaptertitlename}; \end{tikzpicture}% } {10pt} {\titlerule[2pt]\vskip2pt\titlerule\LARGE} \titlespacing*{\chapter}{0pt}{0pt}{10pt} \usepackage{parskip} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Configuration \def\sectionindent{13mm} \def\subsectionindent{16mm} \def\subsubsectionindent{14mm} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Some derived quantities % (you should manually update these) \def\subsectiontotalindent{22mm} % = \sectionindent + \subsectionindent \def\subsubsectiontotalindent{36mm} % = \sectionindent + \subsectionindent + \subsubsectionindent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The following code is adapted from some sample code by % Vincent Zoonekynd, made available at the following website: % http://zoonek.free.fr/LaTeX/LaTeX_samples_section/0.html %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Redefining \section and \section* \def\section{\@ifstar\unnumberedsection\numberedsection} \def\numberedsection{\@ifnextchar[%] \numberedsectionwithtwoarguments\numberedsectionwithoneargument} \def\unnumberedsection{\@ifnextchar[%] \unnumberedsectionwithtwoarguments\unnumberedsectionwithoneargument} \def\numberedsectionwithoneargument#1{\numberedsectionwithtwoarguments[#1]{#1}} \def\unnumberedsectionwithoneargument#1{\unnumberedsectionwithtwoarguments[#1]{#1}} \def\numberedsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 0ex\goodbreak \refstepcounter{section}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright \rlap{\thesection}% \hspace{\sectionindent}% #2 \par \endgroup \vskip 0ex\nobreak \addcontentsline{toc}{section}{% \protect\numberline{\thesection}% #1}% \leftskip=\sectionindent\relax% \justifying } \def\unnumberedsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 0ex\goodbreak % \refstepcounter{section}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright %\rlap{\thesection}% \hspace{\sectionindent}% #2 \par \endgroup \vskip 0ex\nobreak \addcontentsline{toc}{section}{% % \protect\numberline{\thesection}% #1}% \leftskip=0pt \parindent=1.5em \justifying } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Redefining \subsection and \subsection* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\subsection{\@ifstar\unnumberedsubsection\numberedsubsection} \def\numberedsubsection{\@ifnextchar[%] \numberedsubsectionwithtwoarguments\numberedsubsectionwithoneargument} \def\unnumberedsubsection{\@ifnextchar[%] \unnumberedsubsectionwithtwoarguments\unnumberedsubsectionwithoneargument} \def\numberedsubsectionwithoneargument#1{\numberedsubsectionwithtwoarguments[#1]{#1}} \def\unnumberedsubsectionwithoneargument#1{\unnumberedsubsectionwithtwoarguments[#1]{#1}} \def\numberedsubsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 0ex\goodbreak \refstepcounter{subsection}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright \hspace{\sectionindent}% \rlap{\thesubsection}% \hspace{\subsectionindent}% #2 \par \endgroup \vskip 0ex\nobreak \addcontentsline{toc}{subsection}{% \protect\numberline{\thesubsection}% #1}% \parindent=1.5em \justifying } \def\unnumberedsubsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 3ex\goodbreak % \refstepcounter{subsection}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright \hspace{\sectionindent}% %\rlap{\thesubsection}% \hspace{\subsectionindent}% #2 \par \endgroup \vskip 2ex\nobreak \addcontentsline{toc}{subsection}{% % \protect\numberline{\thesubsection}% #1}% \parindent=1.5em \justifying } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Redefining \subsubsection and \subsubsection* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\subsubsection{\@ifstar\unnumberedsubsubsection\numberedsubsubsection} \def\numberedsubsubsection{\@ifnextchar[%] \numberedsubsubsectionwithtwoarguments\numberedsubsubsectionwithoneargument} \def\unnumberedsubsubsection{\@ifnextchar[%] \unnumberedsubsubsectionwithtwoarguments\unnumberedsubsubsectionwithoneargument} \def\numberedsubsubsectionwithoneargument#1{\numberedsubsubsectionwithtwoarguments[#1]{#1}} \def\unnumberedsubsubsectionwithoneargument#1{\unnumberedsubsubsectionwithtwoarguments[#1]{#1}} \def\numberedsubsubsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 3ex\goodbreak \refstepcounter{subsubsection}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright \hspace{\subsectiontotalindent}% \rlap{\thesubsubsection}% \hspace{\subsubsectionindent}% #2 \par \endgroup \vskip 2ex\nobreak \addcontentsline{toc}{subsubsection}{% \protect\numberline{\thesubsubsection}% #1}% \leftskip=\subsubsectiontotalindent\relax% } \def\unnumberedsubsubsectionwithtwoarguments[#1]#2{% \ifhmode\par\fi \removelastskip \vskip 3ex\goodbreak % \refstepcounter{subsubsection}% \noindent \begingroup \leavevmode\normalsize\bfseries\raggedright \hspace{\subsectiontotalindent}% %\rlap{\thesubsubsection}% \hspace{\subsubsectionindent}% #2 \par \endgroup \vskip 2ex\nobreak \addcontentsline{toc}{subsubsection}{% % \protect\numberline{\thesubsubsection}% #1}% \leftskip=\subsubsectiontotalindent\relax% } \makeatother \parindent=0pt \usepackage{lipsum} \begin{document} \chapter{A Chapter} \lipsum[2] \section{A Section} \lipsum[2] \subsection{A Subsection} \lipsum[2] \end{document} and this is the result:
- Ignore case sensitivity in Indexby GowriSaro on March 6, 2026 at 10:29 am
I'm using: \documentclass{book} \usepackage{makeidx} \makeindex \begin{document} Test\index{Test} \newpage test\index{test} \end{document} after running makeindex, output generated as: \begin{theindex} \item Test, 1 \item test, 2 \end{theindex} Is this possible to ignore the case sensitivity and generate the output as \item Test 1, 2?
- What would be the expl3 equivalent of \setbox0... + (Lua) box[0]by Denis Bitouzé on March 6, 2026 at 10:01 am
This question is a followup of a previous question of mine that David kindly answered with the following example: \documentclass{article} \usepackage{csquotes} \def\test#1{% \setbox0\hbox{#1}% \usebox{0}% \directlua{ local nn=0 for n in node.traverse_glyph(tex.box[0].head) do nn=n.char end if nn==8221 then tex.print("\string~yes") else tex.print("\string~no") end }} \begin{document} \begin{enumerate} \item \test{“Foo”} \item \test{\enquote{Bar}} \item \test{xyz} \end{enumerate} \ExplSyntaxOff \end{document} I'd like to expl3-ify this MCE and here is the first step which works nicely: \begin{filecontents*}[overwrite]{myfile.lua} function closing_double_quote(glyph) local nn=0 for n in node.traverse_glyph(glyph) do nn=n.char end if nn==8221 then tex.print("yes") else tex.print("~no") end end \end{filecontents*} \documentclass{article} \usepackage{csquotes} \ExplSyntaxOn \lua_now:n{ require('myfile') } \cs_new_protected:Nn \__mymodule_closing_double_quote:n { \setbox0\hbox{#1} \usebox{0} : \c_space_tl \lua_now:n{ tex.write(closing_double_quote(tex.box[0].head)) } } \begin{document} \begin{enumerate} \item \__mymodule_closing_double_quote:n {“Foo”} \item \__mymodule_closing_double_quote:n {\enquote{Bar}} \item \__mymodule_closing_double_quote:n {xyz} \end{enumerate} \end{document} What remains is: \setbox0\hbox{#1} \usebox{0} that could be expl3-ified as follows: \hbox_set:Nn \l_tmpa_box { #1 } \box_use:N \l_tmpa_box But what would be the equivalent of box[0] in the Lua code: tex.write(closing_double_quote(tex.box[0].head))
- How to set the vertical space between subtables?by CarLaTeX on March 6, 2026 at 8:51 am
Is it possible to set the vertical space between two subtables as in Table 2 in the following MWE, but using something more "automatic" than setting a \vspace manually? \documentclass{book} \usepackage{subcaption} \subcaptionsetup[table]{position=top} \begin{document} \begin{table}[ht]\centering \caption{Table caption} \begin{subtable}{\linewidth}\centering \caption{First subtable caption} \begin{tabular}{cc} \hline a & b \\ c & d \\ \hline \end{tabular} \end{subtable} \begin{subtable}{\linewidth}\centering \caption{Second subtable caption} \begin{tabular}{cc} \hline e & f \\ g & h \\ \hline \end{tabular} \end{subtable} \end{table} \begin{table}[ht]\centering \caption{Table caption} \begin{subtable}{\linewidth}\centering \caption{First subtable caption} \begin{tabular}{cc} \hline a & b \\ c & d \\ \hline \end{tabular} \end{subtable}\vspace{10pt} \begin{subtable}{\linewidth}\centering \caption{Second subtable caption} \begin{tabular}{cc} \hline e & f \\ g & h \\ \hline \end{tabular} \end{subtable} \end{table} \end{document} Maybe this is a trivial question, but I found only the \vspace (or similar) answers.
- How to get to the integer value of \currentlistentrynumber in a custom alternative in a TOC list?by Gary on March 6, 2026 at 5:11 am
I'm trying to use \definelistalternative to alter the way a part is displayed in the Table of Contents. That appears to be working but I'm having trouble with the conversion of the \currentlistentrynumber to the text provided in the \defineconversion[Parts] line in this example. I know that the \convertnumber{Parts}{...} works because it is used in the first chapter using hard-coded integers and it returns First, Second, or Third. But the \convertnumber{Parts}{\currentlistentrynumber} throws an error (strangely at the numberalign=flushright under the chapter level of setuplist); and I assume that is because \currentlistentrynumber is not treated as its integer value. I tried passing it to a custom command \ConvertPartNbr declared in this example, but the error is the same. How can I get to the value of \currentlistentrynumber in order to convert it? It is under \startsetups [PartsTOCsu], at line %{Part \convertnumber{Parts}{\currentlistentrynumber}{.}}% currently commented out. Thank you. Also {Part \convertnumber{Parts}{\currentlistentrynumber}} and {Part \expandafter\convertnumber{Parts}{\currentlistentrynumber}} both throw the error of csname overload > warning, protection level 3, control sequence 'P', properties 'permanent', file './mwe4.tex', line 6 csname overload > warning, protection level 3, control sequence 'convertnumber', properties 'permanent', file './mwe4.tex', line 6 ! Unexpected \relax in expression tex error > tex error on line 6 in file ./mwe4.tex: and although {Part \noexpand\convertnumber{Parts}{\currentlistentrynumber}} does not error it generates a "Part Parts1" while {Part \edef\convertnumber{Parts}{\currentlistentrynumber}} generates a "Part Partsnumbers1". None actually take the 1 and use it in \convertnumber{Parts}{...} to return First. \setupcombinedlist[content][list={part,chapter},] \setuplist[chapter][ alternative=c, stopper={.}, distance=5mm, numberalign=flushright, numbercommand={\sc}, style={\setupinterlinespace[2.5ex]\sc} ] \setuplist[part][ alternative=PartsTOC, ] % \defineconversion[en-us][Parts][First,Second,Third] \defineconversion[Parts][First,Second,Third,] \definelistalternative [PartsTOC] [renderingsetup=PartsTOCsu] % \currentlistentrylocation % \namedstructureheadlocation{chapter} % \currentlistentrynumber % \currentlistentrytitle % \currentlistentrypagenumber \startsetups [PartsTOCsu]% \framed [frame=off, width={\textwidth}, offset=none, toffset=10mm, align=center]{% \setuplocalinterlinespace[5ex] {Part \ConvertPartNbr{Parts}{3}}\\ %{Part \convertnumber{Parts}{\currentlistentrynumber}{.}}% {Part {\currentlistentrynumber}{.}}\\ {\sc\currentlistentrytitle}{.} \blank[0mm]\blackrule[width=32mm,height=0.6ex+0.6pt,depth=-0.6ex+0.6pt]\blank[5mm]% } \stopsetups \define[2]\ConvertPartNbr{% \convertnumber{#1}{#2}{.} } \starttext \startfrontmatter \completecontent[criterium=all] \stopfrontmatter \startbodymatter \startpart[list={Title of Part One}] \startchapter[title={Part One, Chapter One}] Paragraph\\ Part \convertnumber{Parts}{1}\\ Part \convertnumber{Parts}{2}\\ Part \convertnumber{Parts}{3} \stopchapter \startchapter[title={Part One, Chapter Two}] Paragraph \stopchapter \stoppart \startpart[list={Title of Part Two}] \startchapter[title={Part Two, Chapter One}] Paragraph \stopchapter \startchapter[title={Part Two, Chapter Two}] Paragraph \stopchapter \stoppart \stopbodymatter \stoptext
- \not\supseteq with kpfontsby Jinwen on March 6, 2026 at 4:21 am
With kpfonts, \not\supseteq becomes \supsetneq, which is not desirable: Expected result should look like: This appears to be a bug, because \not\subseteq looks fine. However, before the package gets fixed, is there any temporary way to fix this behavior? \documentclass{article} % \usepackage{kpfonts} % \usepackage{unicode-math} \usepackage{kpfonts-otf} \begin{document} \( \not\supseteq \) \end{document}
- Trying to align two different logos using adjustbox, but failedby user516076 on March 6, 2026 at 2:11 am
I tried this solution, but it gives me this result: I wish to have those logos have the same height like this: MWE: \documentclass[12pt,a4paper]{article} \usepackage[a4paper,margin=2cm]{geometry} \usepackage{graphicx} \usepackage{tikz} \usepackage{enumitem} \usepackage{setspace} \usepackage[export]{adjustbox} \pagestyle{empty} \begin{document} %==================== LOGOS ==================== \begin{tabular}{@{}p{0.5\textwidth}@{}p{0.5\textwidth}@{}} \includegraphics[height=2.2cm,valign=t]{newarrohmah.png} & \hfill \includegraphics[height=4cm,valign=t]{cambridge.png} \end{tabular} \vspace{0.4cm} \textbf{Cambridge IGCSE\texttrademark} Teacher : Mr. Shandy \vspace{0.6cm} %==================== CANDIDATE BOX ==================== \begin{tikzpicture} % Candidate name \node[anchor=west] at (0,0) {\small CANDIDATE}; \node[anchor=west] at (0,-0.5) {\small NAME}; \draw (3,-0.7) rectangle (16,-0.1); % Centre number boxes \node[anchor=west] at (0,-2) {\small CENTRE}; \node[anchor=west] at (0,-2.5) {\small NUMBER}; \foreach \x in {3,4,5,6,7} \draw (\x,-2.7) rectangle (\x+1,-2.0); % Candidate number boxes \node[anchor=west] at (9,-2) {\small CANDIDATE}; \node[anchor=west] at (9,-2.5) {\small NUMBER}; \foreach \x in {12,13,14,15} \draw (\x,-2.7) rectangle (\x+1,-2.0); \end{tikzpicture} \vspace{0.8cm} %==================== PAPER HEADER ==================== \begin{tabular}{p{0.7\textwidth}p{0.3\textwidth}} \textbf{MATHEMATICS} Paper 1 Non-calculator & \raggedleft 0862/01 October 2025 1 hour 20 minutes \end{tabular} \vspace{0.4cm} \hrule \vspace{0.4cm} You must answer on the question paper. You will need: HB pencil or (black/dark blue) pen, and/or eraser \vspace{0.6cm} %==================== INSTRUCTIONS ==================== \textbf{INSTRUCTIONS} \begin{itemize}[leftmargin=1.5em, itemsep=2pt] \item Answer \textbf{all} questions. \item Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs. \item Write your name, centre number and candidate number in the boxes at the top of the page. \item Write your answer to each question in the space provided. \item Do \textbf{not} use an erasable pen or correction fluid. \item Do \textbf{not} write on any bar codes. \item You are not allowed to use a calculator. \item You may use tracing paper. \item You must show all necessary working clearly. \item Give non-exact numerical answers correct to 3 significant figures, or 1 decimal place for angles in degrees, unless a different level of accuracy is specified in the question. \item For $\pi$, use either your calculator value or 3.142. \end{itemize} \vspace{0.5cm} %==================== INFORMATION ==================== \textbf{INFORMATION} \begin{itemize}[leftmargin=1.5em] \item The total mark for this paper is 86. \item The number of marks for each question or part question is shown in brackets [ ]. \end{itemize} \vfill \hrule \vspace{0.2cm} \begin{center} This document has \textbf{10 pages} \end{center} \vspace{0.3cm} \begin{tabular}{p{0.5\textwidth}p{0.5\textwidth}} {\small © Arrohmah Bogor 2025} & \raggedleft {\small [Turn Over]} \end{tabular} \end{document} Currently, my paper looks like this: Could someone help me please? If it's done, it might look like both logos will look bigger. So pleasae tell me how to resize it, also. T.I.A. This is the folder that containes the files.
- pgfplots rotation around axisby bbujeya on March 5, 2026 at 11:24 pm
I'm trying to plot a 2D graph and have the students find the volume of solid of revolution. I can use pgfplots to do the bulk of it, but my question is: how do I show the arrows on the axis to demonstrate that we need to rotate around the x or y axes? \documentclass[tikz]{standalone} \usepackage{tikz} \usepackage{tkz-euclide} \usepackage{pgfplots}\pgfplotsset{compat=1.18} \usepackage{siunitx}\usepgfplotslibrary{fillbetween,statistics} \usetikzlibrary{calc,positioning,arrows.meta,patterns,patterns.meta,intersections,shapes.geometric,decorations,shapes.callouts,decorations.pathmorphing,decorations.pathreplacing}\usepackage{amssymb} \begin{document} \begin{tikzpicture} \begin{axis} [width=0.8\linewidth, xmin=-0.5,xmax=16, ymin=-0.2,ymax=5, axis lines=center,axis on top, xlabel=$x$,ylabel=$y$, xticklabels=\empty,yticklabels=\empty] \addplot[name path=cubic,thick,black,samples=50,smooth,domain=-0.5:16]{sqrt(x+1)}; \addplot[name path=line,thick,black,samples=50,smooth,domain=-0.5:16]{4}; \addplot[darkgray,opacity=0.5] fill between[of=cubic and line,soft clip={domain=0:15}]; \end{axis} \end{tikzpicture} \end{document} Thanks for your help/suggestions.
- Fadings beyond the edge of the scopeby karlh on March 5, 2026 at 10:51 pm
As a follow-up to a previous question, how can I prevent TikZ from cutting off the edge of the path if the edge of the object goes beyond the edge of the fading pattern? Here is a minimal working example: \documentclass{article} \usepackage[svgnames]{xcolor} \usepackage{tikz} \usetikzlibrary{fadings} \begin{document} \begin{tikzpicture} \begin{scope} \path [scope fading=east] (1,1) rectangle (3,3); \draw [FireBrick,very thick] (0,0) rectangle (2,2); \end{scope} \draw [dotted] (1,1) rectangle (3,3); \begin{scope}[yshift=-4cm] \path [scope fading=east] (1,1) rectangle (3,3); \draw [Gray,very thick] (-1,-1) rectangle (2,2); \end{scope} \draw [yshift=-4cm,dotted] (1,1) rectangle (3,3); \begin{scope}[yshift=-4cm,xshift=5cm] \path [scope fading=east] (1,-1) rectangle (3,3); \draw [Gray,very thick] (-1,-1) rectangle (2,2); \end{scope} \draw [Gray,very thick,yshift=-4cm,xshift=5cm] (0,2) -- (-1,2) -- (-1,-1) -- (0,-1); \end{tikzpicture} \end{document} which produces, in XPDF, Note that the red one works fine, because the edge of the fading (which extends about 25% beyond the edge of the object) is still 100% transparent there, but the gray one does not work because it extends past the edge of the fading. It should look like the one on the lower right, at least on the left-hand side of the square. Note that it would also be an issue for fadings that don't fade all the way out going off the right of the fading, or for very large radial fadings that fade to transparent well before the edge of the object being faded. If the paths were filled, I could simply fill the left part of the pattern with the solid color and clip without having to re-draw it, but if it's just a draw shading, part of it gets cut off and I don't know how to get it back short of drawing it again. Note: some PDF viewers (including my usual ones, Evince and Papers), do not display any of these images correctly, because they don't handle faded drawn paths correctly. This is a viewer problem, but XPDF seems to do better.
- aligned inside inline math in a tasks cell: is this correct?by Oregon Math Tutor on March 5, 2026 at 8:29 pm
I am building a reusable worksheet framework using the tasks package to lay out multi-step math problems in two columns. Each cell contains a multi-line step-by-step simplification, with the final answer highlighted using \colorbox{yellow}. The MWE compiles and produces the correct visual output — problems are top-aligned within each cell, steps are left-aligned on the = sign, and the final answer is highlighted. My specific questions are: Is $\begin{aligned}[t]...\end{aligned}$ — i.e., aligned hosted inside inline math delimiters — inside a tasks cell an acceptable and stable pattern, or does it carry risks (spacing, engine compatibility, package interaction) that I should be aware of? The [t] option anchors the top of the aligned block to the text baseline, which is essential for correct column alignment in this layout. If the pattern in question 1 is not recommended, is there an alternative that preserves this exact top-alignment behavior inside a tasks cell? Is $...$ or \(...\) the more appropriate delimiter for this specific nesting context, where aligned lives inside the delimiter and \colorbox re-enters math mode inside the last line? I am aware the $ vs \(...\) debate has been discussed generally on TSE, but I am asking specifically whether the nesting context here — \colorbox re-entering math mode inside aligned inside inline math inside a tasks cell — changes the answer. This partial screenshot shows the output: Thanks very much for your assistance! mwe: \documentclass[12pt]{article} \usepackage{mathtools} \usepackage{tasks} \usepackage{xcolor} \settasks{ label-width = 22pt, item-indent = 2.5em, label = (\arabic*), after-item-skip = 2em } \begin{document} \textbf{Simplify.} \begin{tasks}(2) \task $\begin{aligned}[t] & \sqrt{27} \\[1em] & = \sqrt{9}\sqrt{3} \\[1em] & \colorbox{yellow}{$= \mathbf{3\sqrt{3}}$} \end{aligned}$ \task $\begin{aligned}[t] & 3\sqrt{48} \\[1em] & = 3\sqrt{16}\sqrt{3} \\[1em] & = (3)(4)\sqrt{3} \\[1em] & \colorbox{yellow}{$= \mathbf{12\sqrt{3}}$} \end{aligned}$ \end{tasks} \end{document}
- Why LaTeX3 underscore comparison adds a spaceby R. N on March 5, 2026 at 8:10 pm
I would like to create a command that could contain 2 groups of optional arguments which can be given in any order. For example, one group can be to deal with key-value and the other can be to deal with embellishments. These 2 groups are independent so I want to be able to feed the command with one or the other or both in any order. To do so, I created a LaTeX3 command to check if the optional argument is an embellishment, if yes then I apply it, else I give to the key-value part. If there is a better way to do, I will be pleased to know it. But my question is when I apply this process, and especially when I deal with underscores. I know they are treated differently, but I don't why the test if the argument contains an underscore seems to add a space, which should not happen in LaTeX3. Here is a MWE: \documentclass{article} \usepackage{amsmath, mathtools} \ExplSyntaxOn \keys_define:nn { RN / mathFunc }{ optA .code:n = {Acaptured}, unknown .code:n = { \bool_gset_false:N \l_RN_keysCaptured OUPS }, } \tl_new:N \l_RN_tmpa_tl \cs_new:Nn \RN_if_embellishment:nTF { \tl_if_blank:nTF {#1}{ #3 }{ \tl_if_in:nnTF {#1} {^} { #2 }{ % \tl_if_in:nnTF {#1} {_} {#2}{#3} % not working for cases 1, 5 and 8 \tl_set:Nn \l_RN_tmpa_tl {\char_generate:n {`\_}} \tl_if_in:VnTF \l_RN_tmpa_tl {#1}{#2}{#3} % not working for case 5 % \tl_if_in:nVTF {#1} \l_RN_tmpa_tl {#2}{#3} % not working for cases 5 and 8 } } } \NewDocumentCommand{\myinteg}{oom}{ \group_begin: \int%\limits \IfNoValueF { #1 }{ \RN_if_embellishment:nTF { #1 }{ % embellishment so no keys just apply them #1 }{ % deal with other keys \keys_set:nn { RN / mathFunc } { #1 } } } \IfNoValueF { #2 }{ \RN_if_embellishment:nTF { #2 }{ % embellishment so no keys just apply them #2 }{ % deal wiht other keys \keys_set:nn { RN / mathFunc } { #2 } } } #3 \group_end: } \ExplSyntaxOff \begin{document} \begin{align} 1: \myinteg[optA][_{b}]{f} = \int Acaptured_b f \\ 2: \myinteg[^{c}_{b}]{f} = \int_{b}^{c} f \\ 3: \myinteg[_{b}^{c}]{f} = \int_{b}^{c} f \\ 4: \myinteg[^{c}]{f} = \int^{c} f \\ 5: \myinteg[_{b}]{f} \neq \int_{b} f \\ 6: \myinteg[optA]{f} = \int Acaptured f \\ 7: \myinteg{f} = \int f \\ 8: \myinteg[ffes]{f} = \int OUPS f \end{align} \end{document} As you can see with the case 5 the manual expression is different from the output of the command. How can I fix this ?
- \DocumentMetadata and custom enumitem keysby Gargantuar on March 5, 2026 at 5:15 pm
I have used enumitem to customise enumerate lists in the past. For example, %\DocumentMetadata{} \documentclass{article} \usepackage{enumitem} \newtheorem{theorem}{Theorem} \setlist[enumerate]{wide} \makeatletter \SetEnumitemKey{noind}{before*={ \AddToHookNext{cmd/@item/before}{\addtolength{\itemindent}{-\parindent}} \AddToHookNext{cmd/@item/after}{\addtolength{\itemindent}{\parindent}} }} \makeatother \begin{document} \begin{theorem} \begin{enumerate} \item a \item b \end{enumerate} \end{theorem} \begin{theorem} \begin{enumerate}[noind] \item a \item b \end{enumerate} \end{theorem} \end{document} allowed me to pass the noind key to remove indentation of the first \item if the theorem starts with an enumerate list (this style is found, e.g., in the SGA/EGA books by Grothendieck, here with (i), (ii), etc.). However, the new \DocumentMetadata code introduces blocks to modernise the trivlist constructions. With \DocumentMetadata enabled, I get a similar error as in the linked post: ./test.tex:27: Package block Error: Some keys specified on the enumerate environment are (block) unknown. For immediate help type H <return>. ... l.27 \item a The following keys are unknown and their values are ignored: noind Perhaps a misspelling or the current template instance uses special keys. Note that the noind key is not about global customisation, but local indentation. Although blocks now do the reasonable thing of starting the list on a new line inside a theorem, my style actually wants to avoid that (:. Is there a way to define custom keys, which influence the indentation of the first \item?
- Prevent `babel` from interfering with Lua code?by Denis Bitouzé on March 5, 2026 at 3:15 pm
The following MCE works as expected. \documentclass{article} % \usepackage{babel} % \shorthandoff*{~} \begin{document} \directlua{ local n=0 if n~=42 then tex.print("Foo") else tex.print("Bar") end } \end{document} However, if babel is loaded, the ~= operator in the Lua code causes the compilation to fail: [\directlua]:1: 'then' expected near '\'. l.7 } ? It does work if ~= is replaced by == so I suspected the babel shorthands and, indeed, \shorthandoff*{~} did the trick. But I'm not sure this is completely safe so is there a way to prevent babel from interfering with Lua code?
- aerospace test questions [closed]by destine-lee destine-lee on March 5, 2026 at 3:13 pm
\begin{array}{|c|} \hline \begin{minipage}{0.45\textwidth} \begin{center} \begin{tikzpicture}[scale=0.7] \draw (0,0) circle (1.5cm); \draw[thick, blue] (-1.5,0) -- (1.5,0); \fill[brown] (0,-1.5) arc (-90:-270:1.5cm and 0.6cm) -- cycle; \fill[blue] (0,1.5) arc (90:270:1.5cm and 0.6cm) -- cycle; \draw[yellow, very thick] (-0.3,0) -- (0.3,0); \draw[yellow, very thick] (0,-0.1) -- (0,0.1); \node at (0,0.6) {$10^\circ$}; \draw[yellow, very thick] (-0.1,0.6) -- (0.1,0.6); \node at (0,1.2) {$20^\circ$}; \draw[yellow, very thick] (-0.1,1.2) -- (0.1,1.2); \draw[<->, very thick] (2, -0.2) -- (2, 0.2); \node at (2.5, 0) {Bank}; \end{tikzpicture} \end{center} \end{minipage} \\ \hline \text{Attitude Indicator} \\ \hline \end{array}
- tabularx: parbox in multicolumn with height, which is an integer multiple of a table rowby cis on March 5, 2026 at 2:46 pm
I want to insert a multicolumn into a tabularx, with a breakable textbox that has a height of exactly n table rows (i.e., n \baselineskips), where n is an integer multiple. So I used a parbox; and placed an fcolorbox (without spaces) around it to illustrate the dimensions. Why does here a gap occur, and how do I eliminate the gap? PS: To clarify, it's important (for the background work) that the box has a height of exactly n (e.g. n=6) \baselineskip, without gap that makes an extra height (in opposite to an optical correction). MWE: \documentclass[paper=a5]{scrarticle} \usepackage[ margin=12mm, showframe=false, ]{geometry} \usepackage{tabularx} \usepackage{tikz} \begin{document} \section{Table with Titlebox} \pgfmathtruncatemacro\TitleRows{6} \pgfmathsetlengthmacro\Titleheight{\TitleRows*\baselineskip} \newcommand\MyTitle{% \begingroup \setlength{\fboxsep}{0pt}% \setlength{\fboxrule}{\arrayrulewidth}% \fcolorbox{red}{yellow!22}{% fcolorbox for better view \parbox[t][\Titleheight][t]{\dimexpr\hsize-2\fboxrule\relax}{% Breakable titlebox, which should have an heigth from exactly \TitleRows \verb+\baselineskip+s. }% }% \endgroup} %\noindent\MyTitle %\mytablefont \noindent % Verhindert Einzug der gesamten Tabelle \begin{tabularx}{\textwidth}{|X|c|c|} \hline Column 1 & Column 2 & Column 3 \\ \hline \multicolumn{3}{|@{} p{\dimexpr\textwidth-2\arrayrulewidth} @{}|}{% \MyTitle } \\ \hline A & B & C \\ \hline \end{tabularx} \end{document}
- Using marginnote with landscapeby richard on March 5, 2026 at 1:58 pm
A manuscript I am typesetting to be published includes a long, wide table that I think would be best formatted as a multi-page longtable environment inside a landscape environment. The printed book will use \marginnote to give the manuscript page number. This works fine, except on the landscape page where the \marginnote overlaps the text. Here is a MWE showing the problem (which manifests without the longtable): \documentclass[a4paper,oneside]{book} \usepackage{marginnote} \usepackage{pdflscape} \usepackage{lipsum} \newcommand\pg{\marginnote{\textbf{Page}}} \begin{document} \pg \lipsum[1] \lipsum[2][1-4] \pg \lipsum[2][5-] \begin{landscape} \pg \lipsum[3] \end{landscape} \end{document} Is there any way to make a \marginnote work inside a landscape environment? The marginnote manual says: The marginnote package needs to know the real width of the text area to find the right margin. While some environments (e.g., of the framed package) change \textwidth, marginnote defines its own text width macro. If you change the text area after \begin{document} you should add \edef\marginnotetextwidth{\the\textwidth} after changing the text area. You may want to do this globally using \xdef instead of \edef. Most users will never need to change \marginnotetextwidth. I've tried adding this line (both with \edef and with \xdef) inside the landscape environment, but it makes no difference. Setting it to \the\linewidth shifts the \marginnote somewhat to the right, but it still overlaps the text. Hardcoding a \marginnotetextwidth of about 332mm inside the landscape environment broadly works in this test example, but I don't understand why, as this is substantially larger than the dimensions of the A4 paper (210mm × 297mm). In cases it matters, I'm using xelatex, but it also happens with pdflatex.
- Tikz error on a not-so-old file (once working)by user126154 on March 5, 2026 at 9:00 am
I have an old latex file that in 2019 was perfectly ok. Today (in 2026) I try to compile the source and I get an error ERROR: Package tikz Error: Cannot parse this coordinate. The point in the file where it seems to be an error (according to emacs) is the following scope environment: \foreach\a in{(-30.5,4),(-13,9),(-16.5,-7.5),(34,0),(53,0),(72,0)} { \begin{scope}[shift={\a}] \draw (0,0) to[out=30, in=150] (4,0); \draw (-1,.5) to[out=-30, in=-150] (5,.5); \end{scope} } The weird thing is that file was completely fine and compiling some years ago! I isolated the problem creating a test file \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach\a in{(10,2), (5,-3)} { \begin{scope}[shift={\a}] \draw (0,0) to (2,2); \end{scope} } \end{tikzpicture} \end{document} and I get the same error. So, my question is What's wrong now, and how I can fix it in the current version of tikz?
- Padded page number with hyperrefby Myvh on March 5, 2026 at 8:09 am
My goal is to have zero-padded page numbers in the footer and in the table of contents. I use the code from this answer. However, it breaks with the hyperref package, only when the total page number has one digit, with the following error: test.tex: error: 86: Use of \??? doesn't match its definition. \newpage. I know that the padding is not needed in this case, but I would like the code to be more robust and also to understand why it breaks in that case. Here is a minimal working example. You can comment out/in \manypages to toggle between the code that breaks or not. \documentclass{article} \usepackage{lastpage} \usepackage{fancyhdr} \usepackage{hyperref} \hypersetup{ colorlinks = true, allcolors = blue } % From https://tex.stackexchange.com/a/730655/228589 \ExplSyntaxOn \NewDocumentCommand{\paddedcounter}{m} { \AtBeginDocument { \cs_if_exist:cF {maxdigits#1} { \cs_gset:cpn {maxdigits#1} {8} } } \AtEndDocument { \iow_now:ce {@mainaux} { \token_to_str:N \maxdigits{#1}{\fp_eval:n{logb(\value{#1}+0.1)+1}} } } \cs_gset:cpn {the#1} { \padded{#1} } } \NewDocumentCommand{\maxdigits}{mm} { \cs_gset:cpn {maxdigits#1}{#2} } \NewExpandableDocumentCommand{\padded}{m} { \prg_replicate:nn { \use:c { maxdigits#1 } - \tl_count:e { \arabic{#1} } } { 0 } \arabic{#1} } \ExplSyntaxOff \paddedcounter{page} \pagestyle{fancy} \fancyhead{} \renewcommand{\headrulewidth}{0pt} \fancyfoot[C]{\thepage\ / \pageref*{LastPage}} \newcommand{\manypages} { \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage \section{Some section} \newpage } \begin{document} \thispagestyle{fancy} \begin{center} {\Huge Some title} \end{center} \tableofcontents \newpage \manypages \end{document}
- Drawing a tank consisting of a cylinder topped with a hemisphere of the same radiusby Dimitrios ANAGNOSTOU on March 4, 2026 at 2:25 pm
I’m working on a visualization to accompany a math problem: "A water tank consists of a cylindrical part with radius r and height h, topped with a hemispherical dome. The tank must be built to hold 600 m³ when full. (...)" After a lot of searching and experimenting, here is my current TikZ attempt: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node (a) [cylinder, shape border rotate=90, draw, minimum height=15mm, minimum width=7.5mm] {}; \draw [<->] ([xshift=5pt]a.before bottom) -- ([xshift=5pt]a.after top) node [midway, right] {$h$}; \draw [<->] ([yshift=-5pt]a.bottom) -- ([yshift=-5pt]a.bottom -| a.before bottom) node [midway, below] {$r$}; % Define origin \coordinate (O) at (a.center); % Define h and r \def\h{15mm} \def\r{3.75mm} % Move to center (0,h/2,0) \coordinate (C) at ($(O)+(0,\h/2)$); % Hemicircle (upper half) \draw (C) ++(-\r,0) arc (180:0:\r); %% Coordinate system (centered at node center) %\draw[-latex, dashed] (a.center) -- ++(1.8,0) node[right] {$x$}; %\draw[-latex, dashed] (a.center) -- ++(0,1.8) node[above] {$y$}; %\draw[-latex, dashed] (a.center) -- ++(-1.2,-1.2) node[below left] {$z$}; % %\node[left] at (O) {$O$}; \end{tikzpicture} \end{document} My questions: How can I make the back part of the hemisphere (as indicated by the red arrow above) a dashed curve, like a true 3D effect? Is it possible to add some shading or filling to better suggest depth, without complicating my code?
- Luatex - Coloring Harakaby Mario Fischer on March 4, 2026 at 6:08 am
I want to colour the harakat (diacritics) of a text in Pashto. I use Luatex, and I want to switch this function on and off. It should look like I tried this code: \documentclass{article} \usepackage{fontspec} \usepackage{xcolor} \usepackage{luacolor} \usepackage[bidi=basic]{babel} % Setup Arabic language \babelprovide[import, main]{arabic} % THE FIX: Use Renderer=Node instead of Harfbuzz \babelfont{rm}[Renderer=Node]{Amiri} % 1. The Lua Script \directlua{ harakat_attr_val = nil local luacolor_attr = luatexbase.attributes['luacolor'] local function color_harakat(head) if not harakat_attr_val then return head end for item in node.traverse_id(node.id("glyph"), head) do local char = item.char -- Unicode range for Arabic harakat (0x064B to 0x065F) -- and the superscript Alef (0x0670) if (char >= 0x064B and char <= 0x065F) or char == 0x0670 then node.set_attribute(item, luacolor_attr, harakat_attr_val) end end return head end % Add the filter so it runs before the font shaper luatexbase.add_to_callback("pre_linebreak_filter", color_harakat, "color_harakat") } % 2. Custom command to safely set the Harakat color \makeatletter \newcommand{\setHarakatColor}[1]{% \begingroup \color{#1}% \directlua{ harakat_attr_val = tex.attribute[luatexbase.attributes['luacolor']] }% \endgroup } \makeatother \begin{document} \begin{center} \Huge % Tell LuaTeX to color all following harakat Red \setHarakatColor{red} بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ \vspace{1cm} % Switch to blue! \setHarakatColor{blue} بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ \end{center} \end{document} But it is not coloring. What might be the problem, or is there an easy option in Luatex?
- TikZ: How to add a node where a path gets clippedby Edoardo Serra on March 3, 2026 at 3:07 pm
I am designing a square (or “squarish” actually) map protractor in TikZ. So far, I have managed to draw the degree ticks along the four sides by clipping radial lines between two closed paths using the even odd rule like I saw in this answer. The ticks are generated in a \foreach loop. To avoid drawing long ticks on top of short ones, I separated them into two loops using a conditional test. I am not sure whether this separation is actually necessary for correct SVG export/printing, but that is how I implemented it. Below is a MWE: \documentclass[tikz]{standalone} %,convert={outfile=\main.svg} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{intersections, pgfplots.fillbetween} \pgfdeclarelayer{pre main} \pgfdeclarelayer{main} \pgfsetlayers{pre main, main} \usetikzlibrary{shapes} \begin{document} %all of this is needed to easily clip between two closed paths using even odd rule \makeatletter \def\@appendnamedsoftpath#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\@temppatha\expandafter\expandafter\expandafter{\expandafter\@temppatha\@temppathb}% \pgfsyssoftpath@setcurrentpath\@temppatha } \def\@appendnamedpathforactions#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\def\expandafter\@temppatha\expandafter{\csname @temppatha\expandafter\endcsname\@temppathb}% \let\tikz@actions@path\@temppatha } \tikzset{ use path for main/.code={% \tikz@addmode{% \expandafter\pgfsyssoftpath@setcurrentpath\csname tikz@intersect@path@name@#1\endcsname }% }, append path for main/.code={% \tikz@addmode{% \@appendnamedsoftpath{#1}% }% }, use path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions\expandafter\let\expandafter\tikz@actions@path\csname tikz@intersect@path@name@#1\endcsname}% }, append path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions \@appendnamedpathforactions{#1}}% }, use path/.style={% use path for main=#1, use path for actions=#1, }, append path/.style={% append path for main=#1, append path for actions=#1 } } \makeatother \begin{tikzpicture} \pgfmathsetmacro\bigside{7} \pgfmathsetmacro\smallsidedelta{0.5} %cuts \draw[rounded corners=12pt, name path=outside] (0,0) rectangle (\bigside,\bigside); \draw[dotted, rounded corners=12pt, name path=inside] (\smallsidedelta,\smallsidedelta) rectangle (\bigside-\smallsidedelta,\bigside-\smallsidedelta); %remove before cutting or printign. Just as reference grid %backside print \tikzfillbetween[of=inside and outside] {white}; %print on transparent plastic so this is needed for better readability %frontside print \pgfmathsetmacro\degreesmallticksize{0.2} \pgfmathsetmacro\degreemidticksize{0.35} \pgfmathsetmacro\outerradius{sqrt(2*\bigside/2*\bigside/2)} \path[rounded corners=12pt, name path=degrees short] (\degreesmallticksize,\degreesmallticksize) rectangle (\bigside-\degreesmallticksize,\bigside-\degreesmallticksize); \path[rounded corners=12pt, name path=degrees mid] (\degreemidticksize,\degreemidticksize) rectangle (\bigside-\degreemidticksize,\bigside-\degreemidticksize); \begin{scope} [even odd rule] %small ticks \clip[use path=outside, append path=degrees short]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=0 \draw[thin] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} %had to add a second scope and for loop since the clipped area is different \begin{scope} [even odd rule] %mid ticks \clip[use path=outside, append path=degrees mid]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=1 \draw[thick] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} \end{tikzpicture} \end{document} And the output is the following: I would now like to add a label at the inner end of each thick (5°) tick, displaying the corresponding degree value (0–355), like this: Now a few nuances: The numbers must always face towards the inside, with the exception, if possible, of the bottom row of numbers from 135° to 225°. When numbers get big, they don't have enough space to fit unless the labels become too small to read (actual printing size of the protractor will be something like 7x7 or 8x8cm). So they need to be shifted in such a way that they fit. 355 in the provided image is a clear example of what I mean. I can consider shifting them radially as well, but they need to stay to the outside of the dotted line, which I can make a little smaller. I really don't know where to start and didn't manage to find anything online. Thank you for your time!