Hot
- Has \subnode broken or am I doing something daft?by cfr on September 16, 2025 at 10:56 pm
The following code compiles without error but gives unexpected (to me) results. In particular, the labels never 'settle'. As far as I can tell, LaTeX perpetually reports that the labels may have changed. The positions of the nodes jump from place-to-place (sometimes on different pages) accordingly. Now I know \subnode[]{}{} works - or did work. So either I am doing something very silly or something has broken (probably very recently) or both. \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark,fit} \begin{document} \begin{tikzpicture} \node {a \subnode{a}{sub} node}; \node [fit=(a),draw,inner sep=0pt,] {}; \end{tikzpicture} \end{document} This is essentially copy-pasted from tikzmark's manual, but I cannot get it to work. Certainly tikzmark does not seem to have been updated recently. However, pgf/tikz is from 2025-08-29 v3.1.11a (3.1.11a), so perhaps something has changed there. Another suspect may be LaTeX if anything to do with \mathchoice might have changed recently, since \subnode uses this internally.
- Drawing vertical and horizontal vectors along a Bézier curve (without local rotation)by lukewarn on September 16, 2025 at 10:26 pm
I’m trying to annotate a quadratic Bézier* curve in TikZ with vectors. Right now I can draw normal vectors (red arrows) at multiple points along the curve using the decorations.markings library. Here is a minimal working example: \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.markings,calc,arrows.meta} % <-- arrows.meta added \begin{document} \begin{tikzpicture} % Quadratic Bézier control points \coordinate (QB1) at (0,0); \coordinate (QB2) at (0,3); \coordinate (QB3) at (8,3); % Convert quadratic to cubic control points \path let \p1 = (QB1), \p2 = (QB2), \p3 = (QB3), \p4 = ({(1/3)*\x1 + (2/3)*\x2},{(1/3)*\y1 + (2/3)*\y2}), \p5 = ({(2/3)*\x2 + (1/3)*\x3},{(2/3)*\y2 + (1/3)*\y3}) in coordinate (QB_aux1) at (\p4) coordinate (QB_aux2) at (\p5); % The curve \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); % Normal vectors using arrows.meta syntax \draw[ postaction={ decorate, decoration={ markings, mark=between positions 0. and 1. step 0.1 with { \draw[color=red, -{Latex[length=1mm]}] (0,0) -- (0,0.5); } } } ] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); \end{tikzpicture} \end{document} Now, in addition to the red arrows (normals), I would like to draw vertical and horizontal arrows at the same positions. However, it seems that TikZ rotates every arrow into the local coordinate system of the decoration. As a result, I cannot find a way to get all arrows to stay vertical/horizontal in the global picture. Also, I don’t want the red vectors to become the vectorial sum of the horizontal and vertical components — they are all independent drawings. Question: How can I place these vertical and horizontal arrows at each marked position along the Bézier curve, aligned with the global axes, rather than with the curve’s local frame? * For some reason, if I use \draw[thick,black] (QB1) .. controls (QB2) .. (QB3); instead of \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); the curve doesn't look like a quadratic Bèzier.
- Ao recompilar aparece a primeira página do PDFby Marcos André Duarte on September 16, 2025 at 9:10 pm
Ao recompilar um documento o overleaf aparece a primeira página do PDF, gostária de saber como manter na página atual do PDF ao recompilar o documento.
- Tikz & Boxes - How can I draw boxes around word(s) inside Tikz nodes using the framed environment without defining new nodes?by user2379123 on September 16, 2025 at 9:10 pm
This is my code: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes, positioning, arrows.meta, fit} \usepackage{standalone} \begin{document} \begin{tikzpicture}[every node/.style={draw, rectangle, minimum width=5cm, minimum height=1.5cm, rounded corners=2mm}] \node[align=center] (a) {\bfseries Title\\ Word1 Word2}; \end{tikzpicture} \end{document} I will get this result: Sometimes it could be helpful to draw boxes/frames around text inside a Tikz node. I want to achieve following result: Do you know an easy way to obtain this goal?
- Cannot use a centered dot as active characterby Nowhere man on September 16, 2025 at 8:48 pm
I wanted to have a better looking centered dot in words for gendered-neutral expressions in French, and the simplest solution that suited me was replacing it by $\cdot$: un$cdot$e dévelopeur$\cdot$se. I wanted to make it more readable by making the centered dot itself an active character: \catcode`·=\active \def·{$\cdot$} So I can write un·e dévelopeur·se. But I get this error: ! Missing number, treated as zero. <to be read again> \protect l.26 \catcode`· =\active ? ! Emergency stop. If I replace the centered dot character · by the vertical bar |, it works perfectly: \catcode`|=\active \def|{$\cdot$} un|e dévelopeur|se Is there a way to make this work with the centered dot character?
- LaTeX refusing to build aligned equations with a fractionby Philip Kearns on September 16, 2025 at 8:20 pm
I have a set of aligned equations one of which has a fraction: \documentclass[10pt]{article} \usepackage{amsmath} \title{General document} \author{Philip Kearns} \begin{document} \maketitle \begin{align} g_1 &= g - \frac{{g^-2 - i}{-2g^-3}} \\ g_1 &= g - (-0.5g + 0.5ig^3) \\ g_1 &= 1.5g - 0.5ig^3 g_1 &= g (1.5 - 0.5ig^2) \end{align} \end{document} But LaTeX doesn't want to build it: This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2025/MacPorts 2025.74524_1) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./tmp.pk.tex LaTeX2e <2024-11-01> patch level 2 L3 programming layer <2025-01-18> (/opt/local/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2024/06/29 v1.4n Standard LaTeX document class (/opt/local/share/texmf-texlive/tex/latex/base/size10.clo)) (/opt/local/share/texmf-texlive/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/opt/local/share/texmf-texlive/tex/latex/amsmath/amstext.sty (/opt/local/share/texmf-texlive/tex/latex/amsmath/amsgen.sty)) (/opt/local/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty) (/opt/local/share/texmf-texlive/tex/latex/amsmath/amsopn.sty)) (/opt/local/share/texmf-texlive/tex/latex/l3backend/l3backend-pdftex.def) (./tmp.pk.aux) ! Missing } inserted. <inserted text> } l.16 \end{align} ? I tried various combinations of escaping the braces, but it just results in the braces being displayed instead of being interpreted.
- Why can't I use \StrLeft for this macro?by haifisch123 on September 16, 2025 at 7:47 pm
I'd like to have a macro which returns the first two letters of a weekday given a certain date (DD.MM.YYYY). For example "16.09.2025" would be "Tu". \documentclass{article} \usepackage{datetime} \usepackage{xstring} % input has the form "DD.MM.YYYY" % outputs first two letters of the weekday of a given date \newcommand{\strToWeekday}[1]{ \StrBefore{#1}{.}[\myDay]% \StrBehind{#1}{.}[\myYearAndMonth]% \StrBefore{\myYearAndMonth}{.}[\myMonth]% \StrBehind{\myYearAndMonth}{.}[\myYear]% \dayofweekname{\myDay}{\myMonth}{\myYear}[\myWeekday]% \StrLeft{\myWeekday}{2} } \begin{document} \strToWeekday{11.05.2023} % should return Th \strToWeekday{13.05.2023} % should return Sa \strToWeekday{16.09.2025} % should return Tu \end{document} Splitting the string, and getting (the long form of) the weekday works fine. But I couldn't manage to get only the first 2 letters of this longform. Thanks in advance for any help.
- Modified \bigcup and \bigcapby Jairo Bochi on September 16, 2025 at 6:40 pm
I'd like to define some modified \bigcap and \bigcup commands so that I could easily write code such as the following one, without having to adjust things by hand: \documentclass[12pt]{article} \begin{document} The intersection of a nested decreasing sequence of sets $A_1 \supseteq A_2 \supseteq \dots$ is denoted \[ \downarrow \hspace{-15pt} \bigcap_{n=1}^\infty A_n \, . \] Similarly, the union of a nested increasing sequence of sets $B_1 \subseteq B_2 \subseteq \dots$ is denoted $\uparrow \hspace{-10pt} \bigcup_{n=1}^\infty B_n$. \end{document}
- Rust basic projects or Leetcode problems first for beginner? [closed]by Muhammad Danyal Khan on September 16, 2025 at 6:00 pm
What a beginner must focus on in rust? Leetcode or basic projects like CLI tools etc.? Actually I want to deep dive in rust, so please!
- Defining a verbatim environment as a pair of commands (e.g., using c argspec), with optional argumentby Karl Berry on September 16, 2025 at 4:55 pm
I'm wondering if it's possible to use the new c arg spec (or any other method) in LaTeX to define a verbatim environment as a pair of commands. I also want the starting command to take an optional argument. My attempt, following the example in ltnews41, fails: \documentclass{article} \NewDocumentEnvironment{tubtyping}{!O{} c} {\begin{verbatim}#2 \end{verbatim} } {} \def\starttyping{\begin{tubtyping}} \def\stoptyping{\end{tubtyping}} \begin{document} \starttyping[foo] foo \stoptyping \starttyping bar \stoptyping \end{document} Not surprisingly, it gets the error Runaway argument? bar\obeyedline \stoptyping\obeyedline \end{document}\obeyedline \obeyedline \ET C. ! File ended while scanning use of \@xverbatim. I presume the verbatim environment can't recognize the \end{verbatim} since it's already been tokenized in the definition. I get similar errors with commands defined using traditional optional arguments (\newcommand\starttyping[1][]), etc., since (it seems) looking ahead for the [ freezes the tokens. I'm not worried about end of line behavior, having text on the \start or \stop lines, etc. It would just be helpful to have the basic idea work. This is with current (as of 2025-09-16) pdflatex-dev, LaTeX2e <2025-06-01> patch level 1 and L3 programming layer <2025-08-13>. I saw the previous question Defining a new environment extending a verbatim environment but it's not about L3. If anything in fancyvrb, listings, or any other verbatim package offers this functionality, I'd be happy to hear about it. I don't need to define it myself, I just couldn't find anything that provides it. P.S. I should mention, an alternative approach would be a way to change the end-verbatim string from \end{verbatim} to \stoptyping. Then \starttyping could take the optional arg and start the verbatim env, and the env could end normally. As far as I know the end-verbatim string cannot be changed, though.
- How to invert the order of "Figure" and the number in a caption?by David Nemeskey on September 16, 2025 at 4:12 pm
I am sure someone, somewhere has asked this question before, but I could not find it. I am generating a Beamer document from a pandoc markdown file. The slides are in Hungarian, so I simply switched to lang=hu. The figure captions I got (coming from babel, I guess) are in the same order as the English ones, which is not how we caption things in Hungarian: English: Figure 1: xyz "Hungarian": ábra 1: xyz Should be: 1. ábra: xyz Is there a way to change the order of the number and the label as in the last line? I am sure there is, as I have seen examples for it in publications I am positive were typeset with LaTeX. However, even the caption package seems to handle it as a single unit. (As observed by @javier-bezos below, Beamer seems to be the culprit, since we get the correct form in a regular article. There is an MWE in the accepted answer.)
- Warning when using xeCJK with XeLaTeX on Overleafby CanonNi on September 16, 2025 at 3:03 pm
I'm writing a Chinese document in Overleaf. According to the documentation, I should use the xeCJK package and compile with XeLaTeX, which is what I did: \documentclass{article} \usepackage{xeCJK} \begin{document} 一些文字 \end{document} The text compiles and displays correctly, but I get the following warning: Package xeCJK Warning: Fandol is being set as the default font for CJK text. Please make sure it has been properly installed. Do I need to fix anything, or is it safe to just ignore the warning? Thanks.
- Adding headline to beamer \newenvironment doesn't work, any idea why?by Cptn Bluebear on September 16, 2025 at 12:22 pm
I tried to create a \newenvironment for a beamer template. I have the following code for the environment: \newenvironment{publikationsliste}{ \setbeamertemplate{headline}{ \begin{tikzpicture}[remember picture,overlay] %adds header background \node[below right,inner sep=0pt] at (current page.north west) { \includegraphics[width=\paperwidth]{\headlineImagePath} }; %adds header title \node[below right, inner sep=0pt, xshift=0cm,yshift=-0.25cm] at (current page.north west){ \hspace{20mm}\large \textcolor{black}{\insertsection} }; \end{tikzpicture} } \setbeamertemplate{frametitle}{ \begin{tikzpicture}[remember picture,overlay] \node[right,inner sep=0pt, yshift=1.1cm] at (current page.west) { \hspace{6mm} \Large \textcolor{blue}{\insertframetitle} }; \end{tikzpicture} } }{ % Ende der Umgebung und Setzen des Standardhintergrunds zurück \setbeamertemplate{background}{} \setbeamertemplate{frametitle}{} } In the document I create the frame with: \begin{publikationsliste} \begin{frame}[plain]{Hello} \end{frame} \end{publikationsliste} However, the created slide contains only the the frametitle and doesn't show the headline section. I'm not sure what's the problem, as I'm using the same \setbeamertemplate{headline}{...} for the standard frame layout and therefor it works fine. I think that the headline might not be created, as I can't even see in the \newenvironment the text node with the header title, or that the headline is created somewhere outside the frame. Does anyone have an idea, what I might doing wrong?
- After compiling handout in beamer I can't compile slides again [closed]by Hana on September 16, 2025 at 11:53 am
I made slides (in overleaf by xelatex) and they showed as expected. After it, I added handout option to beamerclass, and compiled handout. Then I removed the option again, but am not able to get slides compiled. The first line of my document looks like this: \documentclass[unknownkeysallowed]{beamer} I work in overleaf, so first I cleared cached files, then I made a new project, then I copied the TEX file to my computer and ran the command xelatex manually, but still can't get the slides. What should I check/correct?
- How to draw the Ketamine molecular structure using ChemFig?by Marco Fanelli on September 16, 2025 at 11:27 am
How to draw the Ketamine molecular structure using ChemFig? Question I'm trying to draw the molecular structure of Ketamine (C₁₃H₁₆ClNO) using the chemfig package in LaTeX. I'm having trouble properly positioning the substituents on the benzene ring and connecting the cyclohexanone ring. What I've tried Here's my current attempt: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{*6(=-(-[:30](=[:90]O)-[:330]HN-[:30])=-(-Cl)=)} \end{document} Expected result
- XeTeX main_thesisonly prints a part of my chapter. Multibib prints [?] in the outputby Anna on September 16, 2025 at 10:20 am
I'm using XeLaTeX to write my PhD Thesis. The main file only prints 23 pages of the first chapter even though i wrote a lot more. The multibib isn't printed, only signaled as [?] in the output and isn't shown at the end of the fil. How can I resolve these issues? this is the code: \documentclass[12pt, oneside, openright]{book} \pagestyle{plain} \usepackage[a4paper,top=3cm,bottom=3cm,left=3.5cm,right=3.5cm]{geometry} \usepackage[hang]{footmisc} \usepackage{graphicx} \usepackage{multibib} % Attivazione delle nuove bibliografie per multibib \newcites{ed}{Edizioni } \newcites{sec}{Bibliografia secondaria} \newcites{alc}{Studi su Alciato} \usepackage{epstopdf} \usepackage{setspace} \onehalfspacing \usepackage{etoolbox} \usepackage{soul} \usepackage{xcolor} \setulcolor{red} \AtBeginEnvironment{quote}{\par\singlespacing\small} \setlength{\parindent}{2em} \usepackage[ colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue ]{hyperref} \usepackage{lmodern} \usepackage{polyglossia,fontspec,xunicode} \usepackage{libertine} \setmainfont{Times New Roman}[ BoldFont = {Times New Roman Bold}, ItalicFont = {Times New Roman Italic}, BoldItalicFont = {Times New Roman Bold Italic}, SmallCapsFeatures = {Letters=SmallCaps} ] \urlstyle{same} \setmainlanguage[babelshorthands=true]{italian} \setotherlanguage[variant=polytonic]{greek} \newfontfamily\greekfont[Scale=MatchLowercase]{Times New Roman} \usepackage[md]{titlesec} \titleformat{\chapter}{}{}{0em}{\LARGE} \usepackage[series={A,B,C,D},noend,noeledsec,nofamiliar,noledgroup]{reledmac} \Xarrangement[A]{paragraph} \Xarrangement[C]{paragraph} \Xarrangement[D]{paragraph} \Xlemmaseparator[C]{~:} \Xlemmafont[C]{\itshape} \Xlemmaseparator[D]{ } \renewcommand{\thefootnote}{\arabic{footnote}} \makeatletter \renewcommand{\@makefnmark}{\textsuperscript{\@thefnmark}} \renewcommand{\@makefntext}[1]{% \noindent \hangindent=2em \hangafter=1 \hbox to 2em{\@thefnmark\hss}#1% } \makeatother \begin{document} \title{titolo tesi} \author{Anna} \frontmatter \maketitle %\tableofcontents \mainmatter \include{cap1} % --- BIBLIOGRAFIE MULTIPLE CON MULTIBIB --- \bibliographystyleed{apalike} \bibliographyed{ed} \bibliographystylesec{apalike} \bibliographysec{sec} \bibliographystylealc{apalike} \bibliographyalc{alc} \end{document}
- Custom `\partchapter` Command for Dividing Chapters into Parts in LaTeX Report Classby Student on September 16, 2025 at 9:30 am
I am writing a set of lecture notes using the report document class and want to divide each chapter into parts, with sections and subsections within each part. Since the standard \part command is above the chapter level, I created a custom \partchapter command using the titlesec package to act as a division within a chapter, styled similarly to chapters but at a lower level. Below is a minimal working example (MWE) of my setup: \documentclass[12pt,a4paper]{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath,amssymb,amsthm} \usepackage{xcolor} \usepackage{titlesec} \usepackage{tcolorbox} \usepackage[colorlinks=true,pagebackref=true]{hyperref} \usepackage{geometry} \usepackage{fancyhdr} % Page setup \usepackage[a4paper,margin=2.5cm]{geometry} \pagestyle{fancy} \fancyhf{} \fancyhead[L]{\sffamily\small\nouppercase{\leftmark}} \fancyhead[R]{\sffamily\bfseries\thepage} \fancyfoot[R]{\sffamily\footnotesize Foundations of Mathematics (213-Math-3)} \renewcommand{\headrulewidth}{0.8pt} \renewcommand{\footrulewidth}{0.8pt} \fancypagestyle{plain}{% \fancyhf{} \fancyfoot[R]{\sffamily\footnotesize Foundations of Mathematics (213-Math-3)} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0.8pt} } % Chapter styling \titleformat{\chapter}[display] {\bfseries\Large\color{black}} {\filleft\MakeUppercase{\chaptertitlename} \Huge\thechapter} {1ex} {\vspace{0.5ex}\titlerule\vspace{0.5ex}\filcenter} [\vspace{0.5ex}\titlerule] \titlespacing*{\chapter}{0pt}{-5pt}{30pt} % Define partchapter \newcounter{partchapter}[chapter] \renewcommand{\thepartchapter}{\thechapter.\arabic{partchapter}} \titleformat{\partchapter}[display] {\bfseries\large\color{black}} {\filleft Part \thepartchapter} {1ex} {\vspace{0.5ex}\titlerule\vspace{0.5ex}\filcenter} [\vspace{0.5ex}\titlerule] \titlespacing*{\partchapter}{0pt}{15pt}{20pt} \newcommand{\partchapter}[1]{% \refstepcounter{partchapter}% \titleformat{\partchapter}[display] {\bfseries\large\color{black}} {\filleft Part \thepartchapter} {1ex} {\vspace{0.5ex}\titlerule\vspace{0.5ex}\filcenter} [\vspace{0.5ex}\titlerule] \section*{#1} \addcontentsline{toc}{partchapter}{\protect\numberline{\thepartchapter}#1} } % Theorem environments \theoremstyle{definition} \newtheorem{definition}{Definition}[section] \newtcolorbox{definitionbox}[1]{ colback=lightblue, colframe=blue, boxrule=2pt, arc=5pt, title={#1}, fonttitle=\bfseries\large, coltitle=white, colbacktitle=blue } \begin{document} \tableofcontents \setcounter{tocdepth}{2} \makeatletter \let\l@partchapter\l@section \makeatother \chapter{Infinite Sequences and Series} \partchapter{Sequences} In this part, we explore the fundamental concepts of infinite sequences. \section{Definition of Sequences} A sequence is an ordered list of numbers indexed by natural numbers. \begin{definitionbox}{Definition: Sequence} A sequence is a function \( a: \mathbb{N} \to \mathbb{R} \), where \( a(n) = a_n \). \end{definitionbox} \subsection{Examples of Sequences} Consider the arithmetic sequence \( a_n = 2n + 3 \). \partchapter{Series} In this part, we discuss infinite series and their convergence properties. \section{Definition of Series} An infinite series is the sum of an infinite sequence. \subsection{Convergence Tests} We explore tests such as the ratio test and the root test. \end{document} My attempt did not work, and I need your help to divide my chapter into parts. I will then work on each part using \section, \subsection, and so on.
- Vertical dashed lines in tikz. Figure from Proofs Without Wordsby Richard on September 16, 2025 at 9:08 am
I’m trying to recreate a figure from Roger B. Nelsen’s Proofs Without Words: Exercises in Visual Thinking—specifically “Sums of Squares V” (Integer Sums, p. 81). My code gets everything right except the vertical dashed lines inside each unit square. Can these be drawn when using rectangle ++(1,1), or should I use a different approach? \documentclass[]{article} \usepackage [utf 8]{inputenc} \usepackage{soul} \usepackage {ulem} \usepackage{amsmath , bm} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{quotes,angles} \usetikzlibrary {arrows.meta} \usetikzlibrary{math} \usetikzlibrary {babel} \usetikzlibrary{calc} %for coordinate calc \usepackage{tikz,ifthen} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm,yscale=-1] % neutralize \i and \j only within this block \begingroup \let\i\relax \let\j\relax %First rectangle \foreach \i in {-1} \foreach \j in {0} \draw (\i,\j) rectangle ++(1,1); %Second rectangle \foreach \i in {0,1}{ \foreach \j in {0,1}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Third rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fourth rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fifth rectangle \foreach \i in {5,6,7,8}{ \foreach \j in {0,1,2,3}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Sixth rectangle \foreach \i in {9,10,11,12,13}{ \foreach \j in {0,1,2,3,4}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=4\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi\fi } } \endgroup \end{tikzpicture} \end{document}
- Nodes within tcolorbox that are not recognizedby antonio de la rosa on September 16, 2025 at 8:21 am
Good morning: I am trying to reproduce the table at the end of page 394 of the manual. Essentially, I have summarized it to build an arrow that goes from the first tcbhightmath to the second, all within a tcolorbox. So far, I have not succeeded because the nodes are not recognized. I have tried with overlay, with after={code} and with tikz in different positions, inside and outside of the tcolorbox. It still doesn't work, so I appreciate any help. My last code is: \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \usepackage[many]{tcolorbox} % Estilo de resaltado en fórmulas \tcbset{highlight math style={ enhanced, colframe=blue!70!black, colback=blue!10, boxrule=1pt, arc=2pt, outer arc=2pt, fontupper=\normalsize, drop fuzzy shadow }} % Hacer que TikZ recuerde los nodos \tikzset{remember picture} \begin{document} \begin{tcolorbox}[enhanced, colback=white] \begin{align*} \tcbhighmath[remember as=fx]{f(x)} &= \int_{1}^{x} \frac{1}{t^2}\,dt \end{align*} \end{tcolorbox} \vspace{2cm} % solo para separar las cajas en el ejemplo \begin{tcolorbox}[enhanced, colback=white] \begin{align*} f(x) &= \tcbhighmath[remember as=resultado]{1 - \frac{1}{x}} \end{align*} \end{tcolorbox} % Flecha entre las dos cajas \begin{tikzpicture}[remember picture, overlay] \draw[red, thick, ->, bend left] (fx.south) to (resultado.north); \end{tikzpicture} \end{document}
- Article class in font size 22pt [duplicate]by Garulfo on September 16, 2025 at 7:50 am
I need to produce a document in class article, in which the normalsize of the font is 22 pt, so that the fonts of the sections, subsections and so on are coherently adapted. In this document will be also mathematic parts. I tried several packages, and also the extarcticle class, but with no success... Anyone have an idea? Thanks a lot!
- How to save and reuse a calculated distanceby Lucy on September 16, 2025 at 5:50 am
I want to draw two arcs in TikZ. Right now I’m using \path let to calculate the radius, but I’d like to store this value and reuse it later, so I don’t have to write the starting points every time. In particular, I want to calculate the distance 𝐴𝑆1 once, save it, and then use it as the radius when defining other points on the arc. I guess I should use \pgfmathsetmacro for this, but I’m not sure how. What is the best way to save a value (for example, the distance between two points) and reuse it in multiple \draw commands? I would like use for example \coordinate (K1) at (140:\n3). \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[czech]{babel} \usepackage[T1]{fontenc} \usepackage{amsmath,amsfonts,amssymb,mathrsfs} \usepackage[cmyk]{xcolor} \usepackage{pgfplots} %grafy s použitím \begin{axis} ... \end{axis} \pgfplotsset{compat=newest} % 1.15 pro geogebru, potřeba pro vykrelsení grafů \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} \usetikzlibrary{babel,arrows,intersections,patterns,calc,angles,through} \pagestyle{empty} % % % \begin{document} % %%%DEFINE COLOR \definecolor{modra}{cmyk}{1,0,0,0} \definecolor{cerna}{cmyk}{0,0,0,1} \definecolor{bila}{cmyk}{0,0,0,0} % \begin{tikzpicture}[scale=1] \def\delka{2.1} \def\uhel{72} \coordinate (A) at (0,0); \coordinate (B) at (\delka,0); \coordinate (S) at ($(A)!1/2!(B)$); % \draw[-] (A) -- (B); \path[name path=rr] (A) -- (\uhel-90:\delka); \draw[dash pattern=on 6pt off 2pt on 1pt off 2pt,name path=osa,cerna!80] ($(S)!1.25cm!270:(A)$) -- ($(S)!1.25cm!90:(A)$) coordinate[very near end] (o); \path[name intersections={of=rr and osa,by=S1}]; \draw (S1) node {$+$}; % %%%arcs \draw[thick,shift={(S1)}] let \p1 = (A), \p2 = (S1), \n3 = {veclen(\x1-\x2,\y1-\y2)} in (180-15:\n3) arc (180-15:360+15:\n3); \draw[thick,shift={(S1)}] (140:\n3) arc (140:400:\n3); % %%%I use \path let \p2 = (S1) in coordinate (S2) at (\x2, {- \y2}); \draw (S2) node {$+$}; \draw[thick,shift={(S2)}] let \p4 = (A), \p5 = (S2), \n6 = {veclen(\x4-\x5,\y4-\y5)} in (180+15:\n6) arc (180+15:-15:\n6); \draw[fill=blue!25] (A) circle (2pt); \draw[fill=blue!25] (B) circle (2pt); % % \end{tikzpicture} % \end{document}
- Using \add@accent to add a grave accent for a font that lacks the combining diacritic adds a left single quote insteadby Jigsaw on September 16, 2025 at 5:26 am
I'm writing a document using Minion Pro, and I need to typeset a character with a grave accent. Unfortunately, the character I want to typeset doesn't exist as a single glyph in Minion Pro. To make matters worse, Minion Pro seems lack combining diacritics altogether, as they show up as crossed rectangles. For example, the following MWE produces the subsequent result: \documentclass{article} \usepackage{fontspec} \setmainfont{Minion Pro} \begin{document} \`r \end{document} I've attempted to fix this by using \add@accent, but it doesn't work, instead adding a left single quote above the letter, instead of the desired grave accent: \documentclass{article} \usepackage{fontspec} \setmainfont{Minion Pro} \begin{document} \makeatletter \add@accent{`^^^^0060}{r} \makeatother \end{document} I can fix this by not using Minion Pro, which gives the look I want: But ideally I'd want to use Minion Pro, and grab something like the grave accent over e, but use it over r instead: Is there a way for me to do something like this, or something that could at least approximate it (e.g., using Minion Pro for the character, and pulling the accent mark from a similar font that has the combining diacritic)?
- \ifx in tabular macro fails with “Incomplete \ifx” when argument is emptyby Hesper on September 16, 2025 at 12:41 am
I am creating my CV with LaTeX on Overleaf. I defined a custom command \cvpub in my .cls file to typeset publication entries. It takes 8 arguments (tag, authors, title, venue, year, conference, DOI, award). Here is the definition: \newcommand{\cvpub}[8]{% \noindent \begin{tabular}{@{}p{2em}@{\hspace{1em}}p{0.85\linewidth}}% \textcolor{black}{#1} % Tag & #2 \\ % Authors & \textbf{#3} \\ % Title & \textit{#4}, #5 #6 \\ % Venue + Year \ifx&% If DOI is empty \ifx& % If Award is empy % Both DOI and Award are empty: do nothing \else % If Award is not empty (and DOI is not empty) & \textbf{\textcolor{black}{#8}} \\ % Award \fi \else % If DOI is not empty \ifx&% If Award is empty & \textnormal{doi: #7} % DOI \else %If DOI is not empty and Award is not empty & \textnormal{doi: #7}, \textbf{\textcolor{black}{#8}} \\ % DOI, Award \fi \fi \end{tabular}% } When I use \cvpub in cv.tex, if the DOI exists but the award does not, it causes an error. For example, in the following code from cv.tex, P1 and P2 work correctly, but P3 does not. What’s particularly confusing is that the DOI shows up twice in P3. Output PDF: Code: \cvpub % Works well {P1} {Author, Author, Author} %Authors {Title} %Title {Journal name} %Venue {2025} %Year {(Conference))} %Conference tag {} %DOI {Award} %Award \cvpub % Works Well {P2} {Author, Author, Author} %Authors {Title} %Title {Journal name} %Venue {2025} %Year {(Conference))} %Conference tag {} %DOI {} %Award \cvpub{P3} % Does Not Work {Author, Author, Author} %Authors {Title} %Title {Journal name} %Venue {2025} %Year {(Conference))} %Conference tag {10.1111/XXXX.1234.56789} %DOI {} %Award %Line 94 Overleaf errors: Incomplete \ifx; all text was ignored after line 94. Missing } inserted. Extra alignment tab has been changed to \cr. Extra \fi. Underfull \hbox (badness 10000) in paragraph at lines 94--94 Overfull \hbox (88.24603pt too wide) in paragraph at lines 94--94 Question: Why does case P3 (DOI present but Award empty) fail? How should I revise this macro to make it works in all three cases (DOI only, Award only, or both)?
- Pressure representation: additions to a graph from https://tikz.net/fluid_dynamics_laminar/by Sebastiano on September 15, 2025 at 8:16 pm
I have modificated a bit this code from this link https://tikz.net/fluid_dynamics_laminar/ \documentclass[border=3pt,tikz]{standalone} \usepackage{physics} \usepackage{tikz} \usepackage[outline]{contour} % glow around text \usetikzlibrary{patterns,decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc} \tikzset{>=latex} \contourlength{1.1pt} \colorlet{mydarkblue}{blue!40!black} \colorlet{myblue}{blue!70!black} \colorlet{myred}{red!65!black} \colorlet{myorange}{orange!90!black!90} \colorlet{vcol}{green!45!black} \colorlet{watercol}{blue!80!cyan!10!white} \colorlet{darkwatercol}{blue!80!cyan!80!black!30!white} \colorlet{metalcol}{blue!25!black!30!white} \tikzstyle{piston}=[blue!50!black,top color=blue!30,bottom color=blue!50,middle color=blue!20,shading angle=0] \tikzstyle{water}=[draw=mydarkblue,rounded corners=0.1,top color=watercol!90,bottom color=watercol!90!black,middle color=watercol!50,shading angle=20] \tikzstyle{horizontal water}=[water,top color=watercol!90!black!90,bottom color=watercol!90!black!90,middle color=watercol!80,shading angle=0] \tikzstyle{metal}=[draw=metalcol!10!black,rounded corners=0.1,top color=metalcol,bottom color=metalcol!80!black,shading angle=10] \tikzstyle{vvec}=[->,very thick,vcol,line cap=round] \tikzstyle{force}=[->,myred,very thick,line cap=round] \tikzstyle{width}=[{Latex[length=4,width=3]}-{Latex[length=4,width=3]}] \def\tick#1#2{\draw[thick] (#1)++(#2:0.12) --++ (#2-180:0.24)} \begin{document} % PRESSURE \begin{tikzpicture}[x={(1cm,0)},y={(0.55cm,0.40cm)},z={(0,1cm)}] \def\L{1.8} % cube side \def\H{1.2} % total height \def\d{0.8} % total distance \def\N{7} % number of layers \def\t{\H/\N} % layer thickness %\draw[dark water] (0,0,0) -- (\L,0,0) -- (\L,\L,0) -- ( 0,\L,0) -- cycle; \def\layer#1#2#3#4{ \draw[#1] (#2+\L,0,#3) --++ (0,\L,0) --++ (0,0,-#4) --++ (0,-\L,0) -- cycle; \draw[#1] (#2,0,#3) --++ (\L,0,0) --++ (0,0,-#4) --++ (-\L,0,0) -- cycle; \draw[#1] (#2,0,#3) --++ (\L,0,0) --++ (0,\L,0) --++ (-\L,0,0) -- cycle; } \layer{metal}{0}{0}{0.6*\t} \foreach \i [evaluate={\x=(\i-1)*\d/(\N-1); \ya=\i*\H/\N; \yb=(\i-1)*\H/\N;}] in {1,...,\N}{ \layer{water}{\x}{\ya}{\t} } \layer{metal}{\d}{\H+0.6*\t}{0.6*\t} \draw[force] (0.75*\L+\d,0.7*\L,\H+0.3*\t) --++ (1.2,0,0) node[above=1,right=-2] {$\vb{F}_{\parallel}$}; \draw[force,<-] (0.75*\L+\d,0.7*\L,\H+0.3*\t) --++ (0,0,1.2) node[above right] {$\vb{F}_{\perp}$}; \draw[vvec] (\L+\d,0.4*\L,\H-0.5*\t) --++ (1,0,0) node[below=0,right=-1] {$\vb{v}$}; \node at (\d+0.45*\L,0.5*\L,\H+0.6*\t) {$A$}; \draw[->,thick] (-0.1*\L,0,-0.1*\H) --++ (0,0,2*\H) node[above=-1] {$z$}; \draw[->,thick] (-0.1*\L,0,-0.1*\H) --++ (2*\L,0,0) node[above] {$x$}; \draw[->,thick,opacity=0.5] (-0.1*\L,0,-0.1*\H) --++ (0,0.5*\L,0) node[right] {$y$}; \tick{-0.1*\L,0,0}{0} node[left=-1] {0}; \tick{-0.1*\L,0,\H}{0} node[left=-1] {$h$}; \end{tikzpicture} \end{document} I still need to add vector F, the angle arc, and the label. Could someone help me? Thank you.
- How to kern letters and put them higher or lower depending on the previous letter?by lukascbossert on September 15, 2025 at 8:09 pm
I want to generate a title in which E are following an R or a T. Since the font Trajan has a quite wide R and Tthis looks odd: My aim is to put the first E after the R a little bit higher and smaller - it should not be above the upper line. Same but opposite for the second E after the T. That E should be a bit smaller and "under" the T. \RequirePackage{snapshot} \documentclass[ english, a6paper, ]{scrartcl} \usepackage{fontspec,graphicx} \usepackage{trajan} \newcommand\myresize[1]{\resizebox{\linewidth}{!}{\MakeUppercase{\texttrjn{#1}}}} \begin{document} \myresize{R\kern -.3em esilient T\kern -.2em echnologies} \end{document}
- Fix cleveref in TeXLive 2025by BadAtLaTeX on September 15, 2025 at 5:29 pm
Like others I have run into cleveref problems and found only this solution by Ulrike Fischer to be helpful. Consulting the cleveref documentation I found that I need to do something like the following: mwe.tex adapted from the aforementioned solution % !TeX program = pdflatex % !TeX encoding = UTF-8 \documentclass[11pt, a4paper]{article} \usepackage[colorlinks, pdftitle={}, pdfproducer={pdfLaTeX}, pdfpagemode=None, bookmarksopen=true, bookmarksnumbered=true, backref=page]{hyperref} %%% Theorems and references %%% \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsthm} % \usepackage[amsmath,thmmarks]{ntheorem} \usepackage[capitalise]{cleveref} \theoremstyle{plain} % \newcommand{fixcref}[1]{% % \AddToHook{env/#1/begin}{\crefalias{theorem}{#1}}% % \crefname{#1}{#1}{#1s}% % \crefformat{#1}{##2~##1##3}% % % \Crefformat{#1}{\#2Theorem~\#1\#3}%??? % \crefrangeformat{#1}{#1s~##3##1##4 to~##5##2##6}% % % \Crefrangeformat{#1}{Theorems~\#3\#1\#4 to~\#5\#2\#6}%??? % \crefmultiformat{#1}{#1~##2##1##3}{ and~##2##1##3}{, ##2##1##3}{ and~##2##1##3}% % } \newtheorem{theorem}{Theorem}[section] \newtheorem*{theorem*}{Theorem} \newtheorem{definition}[theorem]{Definition} \newtheorem{assumption}[theorem]{Assumption} % \newtheorem{example}[theorem]{Example} % more to come ... % declare alias for cleveref \AddToHook{env/theorem/begin}{\crefalias{theorem}{theorem}} \AddToHook{env/defintion/begin}{\crefalias{theorem}{definition}} \AddToHook{env/assumption/begin}{\crefalias{theorem}{assumption}} % % \fixcref{example} \crefname{theorem}{theorem}{theorems} \crefformat{theorem}{#2theorem~#1#3} \Crefformat{theorem}{#2Theorem~#1#3} \crefrangeformat{theorem}{theorems~#3#1#4 to~#5#2#6} \Crefrangeformat{theorem}{Theorems~#3#1#4 to~#5#2#6} \crefname{assumption}{assumption}{assumptions} \crefformat{assumption}{#2assumption~#1#3} \Crefformat{assumption}{#2Assumption~#1#3} %%%%% \begin{document} \begin{theorem}\label{th:1} a theorem \end{theorem} \begin{theorem*}\label{th:2} anon theorem \end{theorem*} \begin{theorem}\label{th:3} a theorem \end{theorem} \begin{theorem}\label{th:4} a theorem \end{theorem} \begin{assumption}\label{as:1}\end{assumption} \begin{assumption}\label{as:2}\end{assumption} \begin{assumption}\label{as:3}\end{assumption} \noindent Abc \Cref{th:1} \\ Abc \cref{th:1} \\ Abc \Cref{as:1} \\ Abc \cref{as:1} \\ \noindent def \Cref{th:1,th:3} \\ def \cref{th:1,th:3} \\ def \Cref{th:1,th:3,th:4} \\ def \cref{th:1,th:3,th:4} \\ def \Cref{as:1,as:2} \\ def \cref{as:1,as:2} \\ \noindent ghi \Cref{th:1,as:2,as:3} \\ ghi \cref{th:1,as:2,as:3} \\ ghi \Cref{th:1,th:3,th:4,as:1,as:2,as:3} \\ ghi \cref{th:1,th:3,th:4,as:1,as:2,as:3} \\ \end{document} Note that: capitalisation does not work (only as defined in the format and then not working in ranges) the length of the necessary defintions of cref-formats Open Questions: Is there an option to shorten the necessary calls into the command \fixcref ? (Doesn't compile currently) How can I fix capitalise not working? Do I have to define \Cref and \cref to be both either/or ? related for the newcommand: How are macro parameters with repeated hashes in front (e.g. ##1 or ###1) resolved? edit: I just noticed that the answer here (again by Ulrike Fischer) reduces the work of manual definition and works with capitalise, though it does not work with ranges and such. https://tex.stackexchange.com/a/730164
- Get coordinates of a voltage label (circuitikz)by Workoft on September 15, 2025 at 1:54 pm
I'm trying to draw a circle around a voltage label and then an arrow from that circle pointing somewhere else. I can't figure out how to get the coordinates of the label. I know I can just place the circle by trial-and-error or draw the voltage label as a separate node altogether, but those are just workarounds. I feel there should be a simpler, more robust way of doing this. As a MWE, consider the code below. How do I draw a circle around the label v without manually figuring out the exact position? \documentclass{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz} \draw (0,0) to[open, v=$v$, voltage=straight] (2,0); \end{circuitikz} \end{document}
- How to double chapter numbers and let hyperref do its work correctlyby Christophe on September 15, 2025 at 9:40 am
I have the following MWE with the goal to double some chapter numbers (don't ask me why, please). The problem is obviously that the links in the toc do not work anymore (hyperref). How to make these links work correctly? Or how should I do to double some chapter numbers? Thank you! \documentclass{memoir} \usepackage{hyperref} \begin{document} \tableofcontents \newpage \chapter{One} \section{First} Blabla. \section{Second} Blabla. \setcounter{chapter}{0} \chapter{One again} \section{Third} Blabla. \section{Fourth} Blabla. \end{document}
- I would like to place [marks] just after Question number (1.) in exam class using \questionby Saurabh Kumar on September 15, 2025 at 5:24 am
I am using Exam Class to set the question paper. Using \question [5] places the marks at the far right of the question. I would like to add the question in the following template. 1. [5] Solve the following questions: (a) Define digital systems. Also define the levels of implementation of a digital system. [2marks] (b) Represent the number (-13.45) in IEEE double-precision floating point format. Give the final answer in Hexadecimal format. [3 Marks] MWE \documentclass[11pt,a4paper,addpoints,answers]{exam} % import packages \usepackage[utf8]{inputenc} % special characters \usepackage[a4paper,textheight=25cm,textwidth=19cm,top=2cm,footskip=1cm]{geometry} % paper size % Placement of marks \bracketedpoints \pointsinrightmargin \setlength{\rightpointsmargin}{20.0mm} \extrawidth{-15.0mm} % main document content \begin{document} % start of the questions \begin{questions} \question Solve the following questions: \begin{parts} \part Define digital systems. Also define the levels of implementation of a digital system. [2 Marks] \part Represent the number (-13.45) in IEEE double-precision floating point format. Give the final answer in Hexadecimal format. [3 Marks] \end{parts} \end{questions} \end{document}
- tikz plot missing half of the graphby underflow on September 14, 2025 at 11:21 pm
I want to plot y = x sin(1/x) for x between +/-1. I split the graph into two halves to avoid the singularity at the origin, and I was able to plot the right half but not the left half. Minimal (non)working example: \documentclass{amsart} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[->] (-3.5,0) -- (3.5,0) node[right] {$x$}; \draw[->] (0,-1) -- (0,1.1) node[left] {$y$}; \draw[domain=0.01:1, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1 / \x r)}); \draw[domain=-1:-0.01, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1 / \x r)}); \draw[domain=-1:-0.01, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1/ \x r) } ); \end{tikzpicture} \end{document} Why happened to the left half? Thanks for your help!