Hot
- How to save x,y,w,h of answer boxes on a quizby Dov on March 7, 2026 at 5:17 pm
I am trying to generate a quiz where I can generate a file answers.txt containing the id of each question, the x,y location on the page, the width,height and the answer. The macro side effects are brutal and I have no idea what is going on. The following minimal non-working example shows the error. I can try to save out the location of each one, but if I try to also print out width,height that give an error. \documentclass{article} \usepackage{xparse} \usepackage{tikz} \usepackage{zref-savepos} \newwrite\ansfile % Answer box size \newlength{\answ} \newlength{\ansh} \setlength{\answ}{36pt} \setlength{\ansh}{18pt} \newcounter{question} \newcounter{ansbox} % Parallel arrays stored as token lists \newtoks\AnsIDs \newtoks\AnsX \newtoks\AnsY \newtoks\AnsW \newtoks\AnsH \newtoks\AnsText \NewDocumentCommand{\question}{mm}{% \stepcounter{question}% \par\noindent\textbf{Q\thequestion\ (#1 pts)} #2\quad } \NewDocumentCommand{\ans}{m}{% \stepcounter{ansbox}% \edef\labelname{Q\thequestion-A\theansbox}% \zsavepos{\labelname}% \tikz[baseline]{\draw (0,0) rectangle (\answ,\ansh);}% % store in arrays \AnsIDs=\expandafter{\the\AnsIDs \labelname,}% \AnsX=\expandafter{\the\AnsX \zposx{\labelname},}% \AnsY=\expandafter{\the\AnsY \zposy{\labelname},}% \AnsW=\expandafter{\the\AnsW \strip@pt\answ,}% \AnsH=\expandafter{\the\AnsH \strip@pt\ansh,}% \AnsText=\expandafter{\the\AnsText #1,}% } \AtBeginDocument{% \immediate\openout\ansfile=answers.txt } \AtEndDocument{% % write arrays to file \def\IDList{\the\AnsIDs}% \def\XList{\the\AnsX}% \def\YList{\the\AnsY}% \def\WList{\the\AnsW}% \def\HList{\the\AnsH}% \def\TList{\the\AnsText}% \newcount\i \i=0 \loop \ifnum\i<\value{ansbox} % extract first item from each comma list \edef\currID{\expandafter\@firstofone\expandafter{\expandafter\@car\IDList\@nil}}% \edef\IDList{\expandafter\@gobble\IDList}% \edef\currX{\expandafter\@firstofone\expandafter{\expandafter\@car\XList\@nil}}% \edef\XList{\expandafter\@gobble\XList}% \edef\currY{\expandafter\@firstofone\expandafter{\expandafter\@car\YList\@nil}}% \edef\YList{\expandafter\@gobble\YList}% \edef\currW{\expandafter\@firstofone\expandafter{\expandafter\@car\WList\@nil}}% \edef\WList{\expandafter\@gobble\WList}% \edef\currH{\expandafter\@firstofone\expandafter{\expandafter\@car\HList\@nil}}% \edef\HList{\expandafter\@gobble\HList}% \edef\currA{\expandafter\@firstofone\expandafter{\expandafter\@car\TList\@nil}}% \edef\TList{\expandafter\@gobble\TList}% % write to file \immediate\write\ansfile{\currID\space \currX\space \currY\space \currW\space \currH\space \currA}% \advance\i by 1 \repeat \immediate\closeout\ansfile } \begin{document} \question{10}{What is $2+2$?} \ans{4} \question{5}{What is $3+5$?} \ans{8} \end{document}
- Change English parenthesis for Chinese parenthesis in equation numbersby M. Logic on March 7, 2026 at 1:51 pm
An MWS is as follows. \documentclass{ctexart} \usepackage{amsmath} \makeatletter %change English parenthesis for Chinese parenthesis \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} %\newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} \makeatother \begin{document} 测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字。我们有如下结论: \begin{equation} y=x^2+7x+9\text{。} \end{equation} 测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字。 \end{document} To change English parenthesis for Chinese parenthesis in equation numbers, I revised the definition of \tagform@ is amsmath. While since there are some spaces after the Chinese parenthesis, the Chinese parenthesis are not aligned to the right side. So is there anyway to fix this?
- this user-defined tagging command breaks with `\labelcref` for `\documentclass{book}`by jonnybolton16 on March 7, 2026 at 11:01 am
This is a follow-up to this question. I have a user-defined command which allows numbering & referencing of a single line in a starred, multiline equation environment, replacing the need to use an un-starred environment with \nonumber at the end of every other line. My first-attempt definition caused problems around ordering when using \labelcref, which the original question sucessfully resolved. The solution was the following command: \makeatletter \newcommand*\my@make@df@tag@@[1]{% \cref@old@make@df@tag@@{#1}% \let\cref@old@df@tag\df@tag \expandafter\gdef\expandafter\df@tag\expandafter{% \cref@old@df@tag \def\cref@currentlabel{% [equation][\arabic{equation}][]#1% }% }% }% \newcommand*\my@make@df@tag@@@[1]{% \cref@old@make@df@tag@@@{#1}% \let\cref@old@df@tag\df@tag \expandafter\gdef\expandafter\df@tag\expandafter{% \cref@old@df@tag \toks@\@xp{\p@equation{#1}}% \edef\cref@currentlabel{[equation][\arabic{equation}][]\the\toks@}% }% }% \newcommand{\TAG}[1]{% \refstepcounter{equation}% \begingroup \let\make@df@tag@@\my@make@df@tag@@ \let\make@df@tag@@@\my@make@df@tag@@@ \tag{\theequation}% \endgroup \label{#1}% }% \makeatother (credit to @Ulrich Diez for the solution and @Ziv for the appendix patch). This command worked perfectly with the \documentclass{article} used in the original question's MWE. Unfortunatley, I have since found that with \documentclass{book} the previous bug returns. Is there a patch to the original solution, or a new solution, that will fix this?
- font size reduction is only being applied to text being lowered in fractionsby Nate on March 7, 2026 at 7:15 am
Since the following line: is going too close to the right margin of the page, I changed the text size of the four larger-text fractions from normal to footnotesize: $$\cos(\alpha) = \frac{\frac{1}{2\tan(36^\circ)}}{\frac{3+\sqrt{5}}{4}} = \begin{footnotesize}\frac{\raisebox{-2pt}{1}}{2\tan(36^\circ)}\bm{\cdot}\frac{\raisebox{-2pt}{4}}{3\!+\!\sqrt{5}} = \frac{\raisebox{-2pt}{4}}{2(3\!+\!\sqrt{5})\!\tan(36^\circ)}\end{footnotesize} \rightarrow m\angle\alpha = \arccos\!\raisebox{-3pt}{$\Bigl($}\!\begin{footnotesize}\frac{\raisebox{-2pt}{4}}{2(3\!+\!\sqrt{5})\!\tan(36^\circ)}\end{footnotesize}\!\raisebox{-3pt}{$\Bigr)$} \approx\!58.2825^\circ$$ But the only characters that were reduced were the numerators I lowered closer to the fraction bar. To shrink the text in the denominators, should I put them inside raisebox too and just "raise" them 0pt? Or is it better to just put the whole thing in single-$ math mode and just use \dfrac instead of \frac since it doesn't really need to be centered anyway (since it takes up the entire width)? Edit: Changing $$ $$ to \[ \] didn't help.
- Number of slide at the beginning (OpTeX slides)by juanuni on March 7, 2026 at 6:47 am
I am working with optex 1.17, which comes with TeXLive 2023. I am creating slides, but I am having a problem with the counter at the beginning, on the cover slide. The slide number appears near the lower right corner. How can I make it disappear? Am I doing something wrong? How can I customize the slide number design for the following slides? \fontfam[Fira] \slides \wideformat \load[colors] \def\author#1{\def\theauthor{#1}} \author{Titor} % Redefinimos \tit y \subtit para que solo guarden el texto % pero NO generen una página extra. \def\tit #1{\def\thetit{#1}} \def\subtit #1{\def\thesubtit{#1}} \tit{My slide} \subtit{first intent} \def\azul{\pdfliteral{0.408 0.824 0.875 rg}} \def\gris{\pdfliteral{0.4706 0.5098 0.5412 rg}} \def\negro{\pdfliteral{0 g 0 G Q}} % 2. CARÁTULA MANUAL (Sin margen) \puttext -150mm 0mm {% \vbox to 0pt{ \offinterlineskip \vskip -50mm \vbox{ {\azul\hrule height 90mm width 500mm} {\gris\hrule height 185mm width 500mm} } \vss }% } % 3. CONTENIDO USANDO LAS MACROS NEUTRALIZADAS \null \vskip -1cm %\centerline{ {\setfontsize{at45pt}\caps\rm \pdfliteral{1 1 1 rg} \thetit}%} \vskip 1.5cm %\centerline{ {\setfontsize{at19pt}\caps\it \pdfliteral{0 g} \theauthor}%} \vskip 1cm %\centerline{ {\setfontsize{at20pt}\caps\rm \pdfliteral{0.408 0.824 0.875 rg} \thesubtit}%} \vskip 2cm % {\setfontsize{at15pt}\caps\rm \pdfliteral{0 g}Presented by} \vskip 0cm {\setfontsize{at19pt}\caps\rm \pdfliteral{0 g}Me} \vfill \pg+ % 4. REGISTRO Y CONFIGURACIÓN PARA EL RESTO DE SLIDES \negro \pgbackground={} \def\HeadColor{\pdfliteral{0 g}} \pg; %%%%%%%%%%%%%%%%%%%%%%%%%5 %%%%%%%%%%%%%%%%sec title bar \newdimen\framebarheight \framebarheight=1.2cm \let\oldprintsec=\_printsec \def\_printsec#1{% % barra superior absoluta \puttext -20mm 0mm {% \vbox to0pt{ \offinterlineskip \vskip -16mm \vbox{ {\gris\hrule height 17.5mm width 500mm} %{\gris\hrule height 185mm width 500mm} } \vss } } % acercar el título a la barra \vskip-1.4cm %%%%%%%%%%%%%%%%%%%%custom sec \hbox to\hsize{ \hskip -2.5mm {\azul\setfontsize{at25pt}\caps\rm #1} \hfil \vbox to10mm{ \vfil \hbox{\picw=10mm \inspic{logo.png}} \vfil } \hskip 2.5mm } \par \vskip 6mm } %%%%%%%%%%%%%%%%%%%%%%% %\bigskip %%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%custom bullets \def\BulletColor{0.408 0.824 0.875} \_sdef{_item:X}{% {\pdfliteral{\BulletColor\space rg}\_raise.2ex\_fullrectangle{.8ex}}% \pdfliteral{0 0 0 rg}% \kern.5em } \_sdef{_item:x}{% {\pdfliteral{\BulletColor\space rg}\_raise.3ex\_fullrectangle{.6ex}}% \pdfliteral{0 0 0 rg}% \kern.4em } %%%%%%%%%%%%%%%%%%%%%%%%%% %\pageno=1 %\def\pgfoot{\hfil\the\pageno} \sec Useful links * Wikipedia: \url{https://wikipedia.org} * DuckDuckGo: \url{https://duckduckgo.org} \pg.
- WCAG errors for latex document with equationby Kelly O. Homan on March 7, 2026 at 5:24 am
The following MWE is indicated to produce an accessible PDF, using lualatex in TeXLive-2026, however it produces 26 adaptable failures when checked on the axesCheck web tool. \DocumentMetadata{ lang=en-US, pdfstandard=ua-2, tagging=on, tagging-setup={math/setup={mathml-AF,mathml-SE}} } \documentclass{article} \usepackage{unicode-math} \begin{document} \title{Accessible \LaTeX} \author{I. M. Author} \date{\today} \section{Accessible Math Example} The quadratic formula is: \begin{equation} x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \end{equation} \end{document} I have tried the compilation with and without the unicode-math package and the result is the same. Removal of the equation produces a PDF that is WCAG-compliant, using the same web tool. A foo-luamml-mathml.html file is produced from the lualatex compilation of foo.tex and, when opened in a browser, appears to correctly render the equation. Nonetheless, the issue is to produce a WCAG-compliant PDF. The above MWE also follows the example shown on the LaTeX Tagging Project web page. The downloaded PDF from that example also fails the WCAG-compliance check. What am I missing or misunderstanding?
- Confusions with the new babel-german v3.0by Jinwen on March 7, 2026 at 4:12 am
I am a little bit confused with the new babel-german v3.0, where the naming convention has a breaking change: post-1996 convention is now the default one. Is it OK to still use ngerman in current documents? Would it be different with using the new german option? Should the replacement of ngerman be german or german-de/german-germany? The documentation suggests that "it is always advisable to use a more precise option such as german-de". Thus perhaps it should be safer and more stable to use german-de instead of german. For package authors passing/detecting language options, should there be any caution with this new change? (For example, shall one need to detect the version and apply different rules separately?) Thanks so much!
- Passing multiple ConTeXt arguments to luacode interfaces.implement?by Gary on March 7, 2026 at 3:36 am
How can two values be passed to the luacode's interfaces.implement from the call \ConvertParts \currentlistentrynumber \sc\currentlistentrytitle? The \currentlistentrynumber is passed successfully but I can't get the title to go, unless make both arguments hard-coded values. Thank you. \startluacode interfaces.implement { name = "ConvertParts", public = true, protected = true, arguments = { "string", "string" }, actions = function (nbr,title) local rep = {"First","Second","Third"} context.startframed({ align="center",frame="on",offset="none",toffset="10mm",boffset="10mm",width="broad" }) context("Part " .. rep[tonumber(nbr)] .. ".") context.par() context("Where is it?") context(title) context.stopframed() end, } \stopluacode \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] \startsetups [PartsTOCsu]% \ConvertParts \currentlistentrynumber \sc\currentlistentrytitle \stopsetups \define[1]\ConvertPartNbr{% \convertnumber{Parts}{#1}{.} } \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
- 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
- Use of `\minted@cachedir` has stopped to workby projetmbc on March 6, 2026 at 10:43 pm
This structural organization causes a failure in a previously working solution base on redefining \minted@cachedir. Here is what is happening on macOS with MacTeX 2026. 1st compilation: no issues, but no PDF output, which is normal when using the import package. 2nd compilation: it gets stuck and displays the following message. ERROR MESSAGE ------------- ./test/code.tex:18: Package minted Error: => ./test/code.tex:18: Cannot locate file "test/ main.listing" (kpsewhich faile d). See the minted package documentation for explanation. Type H <return> for immediate help. ... l.18 \end{tdoccode} ? H This error message was generated by an \errmessage command, so I can't give any explicit help. Pretend that you're Hercule Poirot: Examine all clues, and deduce the truth by order and method. ? Here are the codes used. * main.tex + test * code.tex % main.tex % !TEX TS-program = lualatex \documentclass{tutodoc} \usepackage{import} \usepackage{minted} \makeatletter \renewcommand{\minted@cachedir}{\detokenize{_minted-xtra-cache}} \makeatother \usepackage[subpreambles = true]{standalone} \begin{document} \subimport{test/}{code.tex} \end{document} % test/code.tex % !TEX TS-program = lualatex \documentclass{tutodoc} \begin{document} \begin{tdoccode}{lua} palAccent = { {0.4980392157, 0.7882352941, 0.4980392157}, {0.7450980392, 0.6823529412, 0.831372549}, {0.9921568627, 0.7529411765, 0.5254901961}, -- Other RBG colors. } \end{tdoccode} \end{document}
- Transfering a Project to a journals specific style [closed]by 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", } aromatic-compounds.eps https://drive.google.com/file/d/1faCOOvd5xcVAF_KZqhx7vAI0Mqh7pmF6/view?usp=sharing 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.
- 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.
- 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.
- 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}
- 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!