• Book design with TikZ
    by Francesco Sieni on November 7, 2025 at 10:25 am

    there's a way to desgin a book cover like this one? MWE The only thing i managed to do were the frames \documentclass{book} \usepackage[paperwidth=115mm, paperheight=195mm]{geometry} \usepackage{tikz} \usepackage{tikzpagenodes} \usetikzlibrary{calc} \begin{document} \thispagestyle{empty} %external frame \tikz[overlay,remember picture]\draw($(current page.north east)+(-1.0cm,-1.0cm)$)--($(current page.north west)+(1.0cm,-1.0cm)$)--($(current page.south west)+(1.0cm,1.0cm)$)--($(current page.south east)+(-1.0cm,1.0cm)$)--cycle; %inside \tikz[overlay,remember picture]\draw($(current page.north east)+(-1.1cm,-1.1cm)$)--($(current page.north west)+(1.1cm,-1.1cm)$)--($(current page.south west)+(1.1cm,1.1cm)$)--($(current page.south east)+(-1.1cm,1.1cm)$)--cycle; \end{document} It doesn't matter if the color of the page (in this case black) because then I would like to invert it (i.e. white page and black frames,) Can you help me? Thank you very much!

  • How to make Textfield font match page font?
    by Sarius on November 7, 2025 at 10:15 am

    so for work I wanted to create a pdf logbook template with fillable fields, so i can quickly create a new logbook entry. For that I wanted to use the hyperref package with textfields etc. During testing I noticed that the font in the textfields doesnt match the actual text. Through some research I found that this is apparently not an easy solve, and so far I wasnt able to find a solution. I am not using a custom font, I just want the fields to use the Computer Modern Font that the text uses. I have found the option to use the format parameter, but no matter what I put as the text font, I cant get it to be Computer Modern ('Courier' works, but 'Verdana', 'Helvetica', 'Computer Modern', 'cmr12' or 'cmunrn' dont, and i couldnt find out why or how). This only needs to work on one computer, and as far as I understand other questions concerning this the font needs to be either embedded in the document or locally available, so if theres any way to locally install the font, that would be fine, but from what I understand it should be possible to just embed the Computer Modern Font and then it should work. An MWE: \documentclass[12pt]{scrartcl} \usepackage{hyperref} \begin{document} \begin{huge} \begin{center} \textbf{Logbook entry} \raisebox{-0.25\baselineskip}{\begin{Form} \TextField[name=fieldentrynumber, value=XXX, format={var f = this.getField('fieldentrynumber'); f.textFont='CMR12'}, charsize=21pt, height=25pt, width=47pt]{}%This is supposed to have the number of the entry \end{Form}} \end{center} \end{huge} \fontname\font %this gives cmr12 as the current font, which is why i use it in line 9 \end{document}

  • Is excludeonly still working? (TeXlive 2025)
    by Markus Nißl on November 7, 2025 at 8:38 am

    I came across excludeonly with this question: Is there an \exclude option? Is excludeonly still working? I'm using 2003/03/14 v1.0 with TeXlive 2025. This next minimal example has file b.tex in the generated output. I only want files a.tex and c.tex in the output. \documentclass{article} \usepackage{excludeonly} \excludeonly{b} \begin{document} \include{a} \include{b} \include{c} \end{document} What am I doing wrong? Or what am I misunderstanding?

  • How do I reproduce these arrows that point to an equation and give a subtext?
    by Gurvir Birk on November 7, 2025 at 5:59 am

    So I did find an answer here: Arrow pointing to subscript in equation. I used it to painstakingly produce the following: \begin{proof} Set \(b>0\). For all x>0, let \(L(xb)\) and \(L(x)\) have the same derivative: \[\frac{d}{dx}[L(xb)]=\frac{1}{xb}b \tikzmark{a}=\frac{1}{x}=\frac{d}{dx}[L(x)].\] \begin{tikzpicture}[remember picture,overlay] \draw[<-] ([shift={(2pt,-2pt)}]pic cs:a) |- ([shift={(-10pt,-15pt)}]pic cs:a) node[anchor=east] {$\text{chain rule}$} \end{tikzpicture} Therefore the two functions differ by some constant \textit{C}: \[L(xb)=L(x)+C. \tag{\footnotesize{Theorem 4.2.4}}\] We can evaluate \textit{C} by setting \(x=1\): \[L(b)=L(1 \cdot b)=L(1)+C\tikzmark{b}=C.\] \begin{tikzpicture}[remember picture,overlay] \draw[<-] ([shift={(2pt,-2pt)}]pic cs:b) |- ([shift={(-10pt,-15pt)}]pic cs:b) node[anchor=east] {L(1)=0} \end{tikzpicture} \noqed \end{proof} But I wanted a faster method. Is there a snippet of some sort that I can make out of this so it's just faster? Also, here's the result: I'm not sure where that \qed on the left is coming from, I did use \noqed. Also, I'd appreciate some help on arrow alignment. The desired sketch is as below:

  • How do I center my proof qed's with my final line of text?
    by Gurvir Birk on November 6, 2025 at 9:44 pm

    I'm not very good at LaTeX. I've been asking people online and using Grok a lot to try and make my first professional typeset PDF. I'm basically copying a textbook chapter. I want my QED to be centered with the last line of text, and not offshoot a little down. Also, some space between the QED and the final text would be appreciated. I'm using \qedhere to get the QED here. I have the following for custom commands in my preamble: % CUSTOM BLUE QED SYMBOL (hollow square + filled blue square behind, same size, offset SE) \newcommand{\customqed}{% \tikz[baseline=(hollow.base), inner sep=0pt, outer sep=0pt]{ % Filled blue square (behind, same size as hollow) \node[minimum size=6pt, fill=exampleblue, inner sep=0pt] (filled) {}; % Hollow square (on top, offset SE) \node[minimum size=6pt, draw=exampleblue, line width=0.8pt, fill=white, anchor=south east, at=(filled.south east), xshift=-1.2pt, yshift=1.2pt, inner sep=0pt] (hollow) {}; }% } \renewcommand{\qed}{\hfill\customqed} % Allow manual override of QED \newcommand{\noqed}{\renewcommand{\qed}{}} % Removes QED for this env only % Define the proof environment \makeatletter \renewenvironment{proof}[1][\proofname]{\par \pushQED{\customqed}% \normalfont \topsep6\p@\@plus6\p@\relax \trivlist \item[\hskip\labelsep \color{theoremblue}\bfseries #1]% \ignorespaces }{% \popQED\endtrivlist\@endpefalse } \makeatother So if there's something wrong there or if there's something more I can add to get what I want I would appreciate knowing what that is.

  • Is there a package to split tables with large number of columns over many pages?
    by bliako on November 6, 2025 at 9:04 pm

    I have square matrix numerical data whose size can vary from 4x4 to 100x100 and possibly more. If using longtable or tabularray and in landscape view, I can present 20, 30 rows at most. Ideally I would like to use a package which takes a block similar to longtable's and produces a few tables with square subsets of the data. For example if my data is 40x40, it can produce 4 tables of size 20x20 and float them one after the other in the document, possibly over many pages. I would like to be able to customise the 1st row and 1st column. I already produce these latex tables using Perl and templates and I guess I could do that through Perl. But it would be more modular if all formatting is done in LaTeX. I am using xelatex. I can even use LuaLaTeX but I would prefer not as not to complicate too much my project's dependencies. Is there such a package? EDIT, after reading about pgfplotstable from @JohnKormylo's comment, I managed to filter out both columns and rows and so I am presenting the same data in 4 different tables with different rows/cols filtered out. Alas, the above are done manually or via my behind-the-scenes template system which produces the latex code. Ideally there must be a way to create a command which takes parameters: which columns to keep, which rows to discard and the formatting and "outputs" the table. And then loop over all the rows in groups of 20 and call the command. I don't think I can manage that. Anyone? p.s. pgfplotstable is very powerful and separation of data and view is such a great concept. makes things much easier. \begin{document} \pgfplotstableread[ col sep=&, row sep=\\, header=true ]{ % this data was inserted here by the template system Αρ&1&2&3&4&5&6&7&8\\ 1&--&0.60&0.12&0.19&0.06&0.67&0.91&0.02\\ 2&0.76&--&0.98&0.43&0.26&0.60&0.24&0.96\\ 3&0.87&0.93&--&0.08&0.63&0.33&0.63&0.24\\ 4&0.72&1.00&0.17&--&0.22&0.72&0.46&0.24\\ 5&0.32&0.45&0.49&0.92&--&0.57&0.77&0.42\\ 6&0.72&0.64&0.15&0.67&0.61&--&0.95&0.59\\ 7&0.34&0.91&0.03&0.83&0.35&0.32&--&0.17\\ 8&0.39&0.46&0.46&0.87&0.48&0.22&0.59&--\\ }\mydata % boilerplate \pgfplotstableset{ begin table=\begin{longtable}, end table=\end{longtable}, } \pgfplotstableset{ every head row/.style={output empty row}, every head row/.style={ before row=\toprule, output content/.style={\bfseries \textbf{#1}}, after row=\bottomrule\endfirsthead, }, every head row/.style={ before row=\toprule, output content/.style={\bfseries \textbf{xxx#1}}, after row=\bottomrule\endhead, }, % How can I \textbf and add vertical line for 1st column only???? % every first column/.style={ % column type/.append style={@{\textbf{\pgfplotstablecellcontent}}} % } %every first col/.style={{\bfseries \textbf{#1}}, column type/.add={|}{} }, %column type={|>{\bfseries}l|l}, % every first col/.style={column type={|>{\bfseries}l|l}} } % Automate creating these N tables, % either via the template % system (easy) or via a LaTeX command: \pgfplotstabletypeset[ columns={[index]0,[index]1,[index]2,[index]3,[index]4}, %columns/0/.style={string type,column type=l}, string type, string replace*={--}{--}, skip rows between index={4}{9} ]{\mydata} \pgfplotstabletypeset[ columns={[index]0,[index]5,[index]6,[index]7,[index]8}, %columns/0/.style={string type,column type=l}, string type, string replace*={--}{--}, skip rows between index={4}{9} ]{\mydata} \pgfplotstabletypeset[ columns={[index]0,[index]1,[index]2,[index]3,[index]4}, %columns/0/.style={string type,column type=l}, string type, string replace*={--}{--}, skip rows between index={0}{4} ]{\mydata} \pgfplotstabletypeset[ columns={[index]0,[index]5,[index]6,[index]7,[index]8}, %columns/0/.style={string type,column type=l}, string type, string replace*={--}{--}, skip rows between index={0}{4} ]{\mydata} \end{document}

  • "Hanging" corners on Tikz diagram
    by pwesterbaan on November 6, 2025 at 7:23 pm

    I'm creating a diagram of an open box using Tikz: \documentclass[margin=5pt, convert={density=1000, size=10000}]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \pagecolor[RGB]{255,255,255} \begin{document} % H-------G % /| /| % / | / | % / E----/--F % / / / / % D-------C / % | / | / % |/ |/ % A-------B \begin{tikzpicture}[scale=0.9, declare function={ wdth=4.35; hgt=2; x_offset=2.75; y_offset=2.75; brace_spacing=0.15;}, draw=black, text=black] \coordinate (A) at (0,0); \coordinate (B) at (wdth,0); \coordinate (C) at (wdth,hgt); \coordinate (D) at (0,hgt); \coordinate (E) at ($(A)+(x_offset, y_offset)$); \coordinate (F) at ($(B)+(x_offset, y_offset)$); \coordinate (G) at ($(C)+(x_offset, y_offset)$); \coordinate (H) at ($(D)+(x_offset, y_offset)$); \draw[fill=black!15, line width=1pt] (A) -- (B) -- (F) -- (E) -- cycle; \draw[line width=1pt] (E) -- (F) -- (G) -- (H) -- cycle; \draw[fill=white, line width=1pt] (A) -- (E) -- (H) -- (D) -- cycle; \draw[fill=white, line width=1pt] (B) -- (F) -- (G) -- (C) -- cycle; \draw[fill=white, line width=1pt] (A) -- (B) -- (C) -- (D) -- cycle; \draw[dotted] (A) -- (E) -- (F); \end{tikzpicture} \end{document} The problem I'm having is that the lines protrude where the corners meet (likely because my line width=1pt). How do I draw this diagram without the "hanging" bits at the corners?

  • Creating synthetic data for testing various long tables
    by bliako on November 6, 2025 at 5:16 pm

    I need to tabulate some matrix data of dimensions NxN where N can be 4 to 100. For N>20 (N>35 in landscape) the table must span in several pages. Edit: I forgot to say that the data consists of only real numbers. I would like to have control in producing these numbers wrt their number of digits etc. I am unsure as to what table package to use, so I am trying to test with some synthetic data. But I have problem creating it, in tabular form. For example: \documentclass[a4paper,12pt]{article} \usepackage{lscape} \usepackage{longtable} \usepackage{pgffor} \usepackage{array} \begin{document} \newcommand{\N}{40} % data size % test to see a row is created correctly: % A -> & % N -> \\ \foreach \i in {1,...,\N} { \i=\ifnum\i<\N A \else N \fi } \begin{landscape} \begin{longtable}{*{40}{c|}} \hline % Generate header row \foreach \i in {1,...,\N} { \i \ifnum\i<\N && \else \\ \fi } % <<< line 23 \hline \endfirsthead % % Repeat header on subsequent pages \foreach \i in {1,...,\N} { \i \ifnum\i<\N && \else \\ \fi } \hline \endhead \foreach \i in {1,...,\N} { \foreach \i in {1,...,\N} { 1.2 \ifnum\i<\N && \else \\ \fi } } \end{longtable} \end{landscape} \end{document} But, it complains about: ! Missing \endgroup inserted. <inserted text> \endgroup l.23 } (line 23 is marked in my code above). I created a row at the beggining to check the correct number of '&' and '\'. Isn't the row correct?

  • Which environment should I use when defining MetaFun functions in multiple places in a ConTeXt document
    by Jasper on November 6, 2025 at 5:03 pm

    I have tried to read 2.16 of the MetaFun manual, but am still having trouble understanding which environment to use when defining functions in multiple places in a document. I've heard that my approach is wrong, and want to correct it. \starttext \startMPinclusions def myfunc = draw fullcircle scaled 1cm withcolor black ; enddef ; \stopMPinclusions% \dorecurse{2}{\startMPpage myfunc ; \stopMPpage}% \startMPinclusions def myfunctwo = draw fullcircle scaled 1cm shifted (1cm,0) withcolor black ; enddef ; \stopMPinclusions% \dorecurse{2}{\startMPpage myfunc ; myfunctwo ; \stopMPpage} \stoptext

  • extra vertical spacing using \DocumentMetadata{}
    by leobb on November 6, 2025 at 4:30 pm

    Recently I did a full update in my texlive 2025 installation. And the line \DocumentMetadata{} is now introducing a extra vertical space in the \begin{center} ... \end{center} environment. The following mwe \DocumentMetadata{} \documentclass[a4paper]{article} \begin{document} some text \begin{center} line 1 line 2 line 3 \end{center} some text \end{document} See the extra vertical spacing between "line 1", "line 2" and "line 3" Now, if I comment or remove the \DocumentMetadata{} there is no extra space: Before the update, this did not happened. Is this a bug or a feature? How can I remove the extra space while using \DocumentMetadata{}?

  • Does the amsmath package interfere with the tufte-handout document class? [duplicate]
    by Peter Klaren on November 6, 2025 at 3:26 pm

    As of recent (yesterday) Figure numbering and referring is erratic in the tufte-handout when the amsmath package is loaded: Figures are labeled/numbered in sequential order, text references refer to the (sub)section they are in. Commenting out the amsmath package in the MWE below shows the correct numberings. Any ideas what can cause this? Peter Klaren \documentclass[twoside]{tufte-handout} \setcounter{secnumdepth}{2} \usepackage{amsmath, amsfonts} \begin{document} \section{Section I} \section{Section II} \section{Section III} As shown in Fig. \ref{fig:a} and Fig. \ref{fig:b} in Subsection \ref{sec:1}, and Fig. \ref{fig:c} in Section \ref{sec:2}. \subsection{Subsection III-1}\label{sec:1} \begin{figure} \centering \rule{3cm}{3cm} \caption{First figure} \label{fig:a} \end{figure} \begin{figure} \centering \rule{3cm}{3cm} \caption{Second figure} \label{fig:b} \end{figure} \section{Section IV}\label{sec:2} \begin{figure} \centering \rule{3cm}{3cm} \caption{Third figure} \label{fig:c} \end{figure} As shown in Fig. \ref{fig:a} and Fig. \ref{fig:b} in Subsection \ref{sec:1}, and Fig. \ref{fig:c} in Section \ref{sec:2}. \end{document}

  • Want to use LaTeX for Students
    by GowriSaro on November 6, 2025 at 6:03 am

    The students don’t have knowledge of TeX but they want to use it. I heard that BakomaTeX has a facility to use LaTeX even the user doesn’t have knowledge of TeX, but I wasn’t able to use it. (The actual problem is that I’m not able to get much information regarding BakomaTeX.) Please refer me to any free LaTeX tool which is more user friendly, so that it’s more likely that the students are going to use it. I can train the students to the basic level of TeX, but what I’m looking for is something based on the WYSIWYG principle, like BakomaTeX.

  • Possible bug in TeX?
    by Igor Liferenko on November 6, 2025 at 3:48 am

    If paragraph is started implicitly and begins with a group, \everypar is executed inside group. Is it a feature? \hsize=12em \parindent=0pt \everypar={\hangindent=20pt } \indent{T}he quick brown fox jumps over the lazy dog. \par \noindent{T}he quick brown fox jumps over the lazy dog. \par {T}he quick brown fox jumps over the lazy dog. \bye

  • How to remove chapter 0 in frontmatter book class
    by Uncle C on November 5, 2025 at 7:31 pm

    I would like to get this style Currently my MWE is \documentclass[openany,fleqn]{book} \usepackage{tikz} \usepackage{titlesec} \usepackage{xcolor} \usepackage[margin=2cm,width=176mm,height=250mm]{geometry} \usetikzlibrary{calc} % ------------------------------------------------- % Chapter heading macro % ------------------------------------------------- \newcommand{\chapterheader}[1]{% \begin{tikzpicture}[remember picture, overlay] % Full-width background bar \fill[black] (-5,0) rectangle (\paperwidth,3.3); \fill[gray!30] (3,0) rectangle (\paperwidth,3.3); % Diamond with chapter number (slightly lowered) \coordinate (C) at (3,.1); \path[fill=white, draw=gray, line width=0.4pt, rotate around={45:(C)},rounded corners=5pt] ($(C)+(-1.15,-1.15)$) rectangle ($(C)+(1.15,1.15)$); % Chapter number \node[text=red, font=\bfseries\fontsize{46}{48}\selectfont] at (C) {\thechapter}; % "Chapter" label (rotated along the diamond) \node[rotate=45, anchor=west, text=white, font=\Large\bfseries, opacity=0.95] at (1.2,0.25) {CHAPTER}; % Title text (right side, strong sans serif) \node[anchor=west, text=black, font=\bfseries\fontsize{30}{32}\selectfont] at (5,0.95) {\parbox[t]{0.7\textwidth}{#1}}; \end{tikzpicture}% \vspace{2.2cm}% } % ------------------------------------------------- % Apply to \chapter % ------------------------------------------------- \titleformat{\chapter}[display] {\normalfont} {} {0pt} {\chapterheader} \titlespacing*{\chapter}{0pt}{0pt}{1cm} % ------------------------------------------------- \begin{document} \frontmatter \tableofcontents \mainmatter \chapter{Algebra} \section{Numerical Concepts} \section{Equations and Inequalities} \section{Partial Fractions} \section{Permutations and Combinations} \section{Series} \section{Complex Numbers} \end{document} Which is giving Thanks in advance

  • TikZ - Define the line style of multiple pens with different colors and widths
    by myhsia on November 5, 2025 at 5:33 pm

    I would like to define the TikZ line style like the following to draw the line within one \draw command, i.e, \draw [mystyle] (A) -- (B); The MWE \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw (0,0) rectangle (6,3); \draw [orange!25, line width = 12pt] (1,1) -- (2,2) -- (4.5,1.5); \draw [orange, line width = 6pt] (1,1) -- (2,2) -- (4.5,1.5); \draw (1,1) -- (2,2) -- (4.5,1.5); \end{tikzpicture} \end{document}

  • Iterated plot with TikZ, PGFPlots and foreach loop
    by Dominique on November 5, 2025 at 4:31 pm

    I'm trying to plot an illustration of the fixed point method in which a function is evaluated repeatedly in a loop. The result should be a staircase or spiral plot on top of the plot of the function itself. I've read here about the use of \edef inside a foreach loop. The following MWE should show what I'm trying to do, but it seems to only perform a single iteration. Notes: the loop variable isn't used inside the loop. perhaps it's an illusion that only single iteration is performed and the real issue is that \xprev and \xnext aren not updated at each pass through the loop. I tried placing the updates inside the \edef, but that gives an undefined control sequence error. I also tried \pgfplotsinvokeforeach instead of \foreach, but only obtained other errors. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \pgfmathdeclarefunction{g}{1}{\pgfmathparse{#1^2 - 2}} \begin{tikzpicture} \begin{axis} [ xmin = -2.5, xmax = 2.5, ymin = -3, ymax = 3, axis x line = center, axis y line = center, domain=-2.5:2.5, samples=300, ] \addplot[ultra thick] {g(x)}; % graph of g \addplot[thin] {x}; % diagonal \def\xstart{-0.75} \pgfmathsetmacro{\xprev}{\xstart}; \pgfmathsetmacro{\xnext}{g(\xprev)}; \draw[thick, blue] (\xstart, 0) -- (\xstart, \xnext) -- (\xnext, \xnext); \foreach \i in {1, 2, 3}{ \pgfmathsetmacro{\xprev}{\xnext} \pgfmathsetmacro{\xnext}{g(\xprev)} % x <- g(x) \edef\plotoneiter{% \noexpand% \draw[thick, blue] ({\xprev}, {\xprev}) -- ({\xprev}, {\xnext}) -- ({\xnext}, {\xnext}); }\plotoneiter% } \end{axis} \end{tikzpicture} \end{document} Thanks in advance for any hints! EDIT: Here is a quick sketch of what I'm trying to achieve:

  • caption package not recognising KOMA classes
    by PHL on November 5, 2025 at 3:53 am

    The following MWE \documentclass{scrartcl} \usepackage{caption} \begin{document} Test \end{document} gives the error Package caption Warning: Unknown document class (or package), (caption) standard defaults will be used. See the caption package documentation for explanation. The same happens for scrbook. Standard classes like article work well. The documentation of the caption package mentions that it does support Koma classes. So the above might be a bug. I am interested in any workaround.

  • Illustrating a homeomorphism with asymptote
    by Ted Black on November 4, 2025 at 9:22 pm

    I have tried to reproduce the following figure using asymptote: This figure is a sketch of the transformation f that produces this homeomorphism rather than an actual transformation. The best I can do is using the following code settings.render=8; import tube; import three; import graph3; size(10cm,0); currentprojection = orthographic(0,-1,.5,up=Z); currentlight=light(lightgray,(0,-2,2)); usepackage("physics"); triple f(real t) { return (0, 0, (t>0?4:1)*t); } path3 line = graph(f, -1, 1.5, operator..); real R = 2. ; transform T(real t) { real z = (2*R)/25*t-R; real s = (t>12.5?1+.25*sin(pi*(t-12.5)/12.5)^2:1); return scale(s*sqrt(R*R-z*z)); } draw(tube(line,unitcircle,T),material(gray+opacity(.75), emissivepen = gray),render(merge=true)); transform T(real t) { real z = (2*R)/25*t-R; real s = (t>12.5?1+.25*sin(pi*(t-12.5)/12.5)^2:1); write(string(t)+","+string(s)); return scale(sqrt(R*R-z*z)); } triple f(real t) { return (0, 0, 2*t); } path3 line = graph(f, -1, 1, operator..); draw(shift(-7X+2Z)*tube(line,unitcircle,T),material(gray+opacity(.75), emissivepen = gray),render(merge=true)); path3 pp = (-5.95X+4Z) .. (-3.95X+5.5Z) .. (-1.95X+4Z); draw(Label("$\vb*{f}$",position=.95,align=N),pp,Arrow3); label("$S_1$",-0.5Z-5.5X); label("$S_2$",-0.5Z+2.5X); which produces The approach I used is to use the tube routine for generating a sphere by applying a scale transformation sqrt(R^2-z^2) to a unitcircle (as z changes from -R to R). Then the shape on the right combines a different transformation when z is negative than when z is positive. The homeomorphism sketched in the first figure is not as simple. The transformation applied to a unitcircle shrinks it for z negative and stretches it for z positive. But there is also a rotation of the normal to the circle (looks like a rotation around the y-axis) and for positive z the circle scales up and then scales down. I have tried to combine a scaling transformation with a shift but if I write something like shift((t/12.5)*X+(t/12.5)*Y)*scale(sqrt(R*R-z*z)) or rotation(t*5,Y)*scale(sqrt(R*R-z*z)) I get an error. Would be great if someone could offer some pointers so that I can either improve or rewrite completely this attempt.

  • Insteresting case that $...$ inside `cases` environment would exit the math-mode?
    by Explorer on November 4, 2025 at 5:10 pm

    I have the following code: \documentclass{article} \usepackage{amsmath} \begin{document} $ \begin{cases} a & b \\ c & $$math$text$math$$ \end{cases} $ \end{document} It gives: The outer $...$ exit the math-mode, and the two seperate $...$ change maths into math mode again. I happened to find this phenomenon, but I don't know why. Getting into the sources code of amsmath.sty, I could simplified it: \documentclass{article} \begin{document} $ \begin{array}{@{}l@{\quad}l@{}} a & b \\ c & $$math$text$mathaa$$ \end{array} $ \end{document} It gives the same: For references: % line 1116~1126 amsmath.sty \renewenvironment{cases}{% \matrix@check\cases\env@cases }{% \endarray\right.% } \def\env@cases{% \let\@ifnextchar\new@ifnextchar \left\lbrace \def\arraystretch{1.2}% \array{@{}l@{\quad}l@{}}% } It's no so easy for me to trace back what happened inside \array: latexdef \array \array: macro:->\let \@acol \@arrayacol \let \@classz \@arrayclassz \let \@classiv \@arrayclassiv \let \\\@arraycr \let \@halignto \@empty \@tabarray I wanna to know what cause this "feature", and should somebody make use if this feature to input text in cases? Compare with: $ \begin{cases} a & b \\ c & $text$ %<- here `$text$` make "text" exit the math mode \end{cases} $ and $ \begin{cases} a & b \\ c & \text{text} \end{cases} $ The former one save five characters' input.

  • How can I detect when an \item in an itemize environment breaks into multiple lines in LaTeX?
    by nowox on November 4, 2025 at 2:53 pm

    I'm experimenting with LaTeX internals to detect when a list item in an itemize environment wraps onto more than one line. My goal is to eventually adjust the layout (for example, switch to a multicols layout) so that each item fits on a single line automatically. As a first step, I’m trying to detect when an item’s text breaks across lines. Here’s the minimal example I'm testing: \documentclass{article} \usepackage{fontspec} \makeatletter \newif\ifWI@pending \newcommand\WI@maybeWarn{% \ifWI@pending \ifnum\prevgraf>1 \PackageWarning{warnitemize} {A list item broke across \the\prevgraf\space lines}% \fi \WI@pendingfalse \fi } \newenvironment{warnitemize} {% \begin{itemize}% % 1) each \item arms the flag \let\WI@origitem\item \def\item{\WI@pendingtrue\WI@origitem}% % 2) hook: end of an item's paragraph \let\WI@orig@endparenv\@endparenv \def\@endparenv{% \WI@orig@endparenv % let LaTeX finish the paragraph \WI@maybeWarn % then test \prevgraf }% } {% \WI@maybeWarn \end{itemize}% } \makeatother \begin{document} \begin{warnitemize} \item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vel lectus at elit imperdiet laoreet. Aliquam eget mi sit amet lacus varius facilisis. Pellentesque pharetra mauris non dolor vehicula molestie eu non dolor. Duis ligula est, convallis eget nibh a, tincidunt semper velit. Sed commodo euismod orci ac vulputate. Nam tempor arcu ex. \item Second item court. \item Third item \\ with forced line break. \end{warnitemize} \end{document} However, this doesn’t trigger any warning, even though the first item clearly wraps to multiple lines in the output. Question How can I reliably detect (during compilation) that a paragraph inside an \item has wrapped onto more than one line? Is there a way to measure the item’s box width or height before it is shipped out? I’m compiling with LuaLaTeX on Ubuntu (TeX Live 2024).

  • How can I prevent blank pages from being shipped out?
    by schtandard on November 3, 2025 at 7:10 pm

    I have a document containing some blank pages (mostly due to chapters starting on odd pages). I want to also create a version where these blank pages are missing in the PDF, with everything else being identical to the original. Note that the blank pages shall not be simply skipped by TeX (in the sense that chapters may start on any page), in particular, they shall be counted as usual, just missing in the PDF. I imagine an approach where, at an appropriate instance during shipout, a check is performed determining if the page being shipped out is empty, and if so, throwing it away, not shipping anything out, but stepping all counters as usual. Unfortunately, I have never dabbled in the shipout routine and have no idea how to realize this idea. Here is an MWE for clarification and testing. The desired output should have only six pages, with pages ii, iv, 2, 5 and 6 missing. The table of contents shall still be on page iii (now the second page), chapters 1 and 2 shall still start on pages 1 and 3 (now the third and fourth page) and the thanks section shall still be on page 7 (now the sixth page). \documentclass{scrbook} \usepackage{hyperref} \usepackage{lipsum} \title{The Truth} \author{Windston Smith} \date{April 4th, 1984} \begin{document} \frontmatter \maketitle \tableofcontents \mainmatter \chapter{one} \lipsum[1-3] \chapter{two} \lipsum \cleardoubleevenpage \cleardoubleoddpage \backmatter \chapter*{thanks} \lipsum[1] \end{document}

  • Unknown keys for enumerate and itemize with \DocumentMetadata
    by murray on November 3, 2025 at 6:48 pm

    Each of the enumerate and itemize environments below create an "unknown key" error on compilation with the `\DocmentMetadata command shown but are OK when that command is commented out. The errors occur with or without the \usepackage{enumitem}. They occur no matter whether I compile with pdfLaTeX or LuaLaTeX. (They occur if I use documentclass memoir instead of article.) This seems to be a new phenomenon, because the same (real book-length) document in which I use such environments compiled before now. The issue is obliquely mentioned in the section "Normalizing key names for block environments" in Usse 42 of LaTeX News (https://www.latex-project.org/news/latex2e-news/ltnews42.pdf). But I don't see in that news any documentation on how to handle such keys now. Why is this happening and what's the workaround? \NeedsTeXFormat{LaTeX2e}[2025-11-01] \DocumentMetadata{% lang=en-US, tagging=off } \documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[% label={\arabic*:}, wide, itemsep=0pt,topsep=0pt, labelsep=0.75ex, ] \item Construct integers from natural numbers. \item Construct rationals from integers \end{enumerate} Suppose: \begin{itemize}[itemsep=-2pt] \item $0 \in E$; and \item $n + 1 \in E$ whenever $n \in E$. \end{itemize} \end{document}

  • Number sign/hash (#) not allowed in environment defined with listings
    by Zeping Lee on November 3, 2025 at 8:31 am

    The number sign ("#") raises an error in an environment defined with \lstnewenvironment of listings package. This is possibly related to the recent changes in LaTeX2e kernel ( 2025-11-01) because the CI of my citeproc-lua package breaks without any modifications. LaTeX2e <2025-11-01> L3 programming layer <2025-10-24> Package: listings 2024/09/23 1.10c (Carsten Heinz) \documentclass{article} \usepackage{listings} \lstnewenvironment{bash}{% \lstset{language = bash}% }{} \begin{document} \begin{lstlisting}[language=bash] make install # This works \end{lstlisting} \begin{bash} make install # This doesn't work \end{bash} \end{document} Error: ./tmp.tex:13: You can't use `macro parameter character #' in horizontal mode. l.13 make install # This doesn't work

  • I want a command which can take two arbitrary ellipses, and shade the region between them, bounded by their mutual tangents
    by Jasper on November 2, 2025 at 9:31 pm

    I want a command which can take two arbitrary ellipses, and shade the region between them, bounded by their mutual tangents. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (-5,0) ellipse[x radius = 1, y radius = pi]; \fill ({sqrt(2)},e) ellipse[x radius = {sqrt(pi)}, y radius = {sqrt(e^sqrt(pi))}]; \end{tikzpicture} \end{document}

  • Proper way to represent a cuboid in math mode
    by Stephen on November 2, 2025 at 4:02 pm

    It is well known that in LaTeX $ABCD$ is different from $\mathit{ABCD}$ as the former represents the multiplication of four variables while the latter represents some single object such as a rectangle. In solid geometry, suppose there is a cuboid ABCD-A1B1C1D1. Which one of the following is preferred/recommended? From the output it seems that \mathit is unnecessary for A1B1C1D1. \documentclass{article} \begin{document} \begin{itemize} \item $\mathit{ABCD}$-$\mathit{A_1B_1C_1D_1}$ \item $\mathit{ABCD}$-$\mathit{A_{\mathnormal{1}}B_{\mathnormal{1}}C_{\mathnormal{1}}D_{\mathnormal{1}}}$ \item $\mathit{ABCD}$-$A_1B_1C_1D_1$ \end{itemize} \end{document}

  • How to use right-to-left alignment in drop caps in Context?
    by Aryeh Zapinsky on November 2, 2025 at 3:35 pm

    Problem When trying to set up drop-cap for the first word of a paragraph, the characters do not maintain the right-to-left alignment. Questions How do you align Right-to-Left in the setupintial command? How do you setupinitial for words that include other characters, like Hebrew words that include vowels? How do you setupinitial by using spaces to delimit the words? Code examples and images of output \setupdirections[bidi=on] \setupinitial[n=2, text={וְעַל}, method=auto ] \placeinitial וְעַל הַכֹּל יְהֹוָה אֱלֺהֵֽינוּ אֲנַֽחְנוּ מוֹדִים לָךְ וּמְבָרְ֒כִים אוֹתָךְ יִתְבָּרַךְ שִׁמְךָ בְּפִי כָּל־חַי תָּמִיד לְעוֹלָם וָעֶד כַּכָּתוּב וְאָכַלְתָּ וְשָׂבָֽעְתָּ וּבֵרַכְתָּ אֶת־יְהֹוָה אֱלֺהֶֽיךָ עַל־הָאָֽרֶץ הַטּוֹבָה אֲשֶׁר נָתַן־לָךְ בָּרוּךְ אַתָּה יְהֹוָה עַל־הָאָֽרֶץ וְעַל־הַמָּזוֹן: The above illustrates that with the default of Left-to-Right alignment, the empty space is created on the left side of the page, but the words are printed on the right. When adding setup align, the space is created for the initial on the right side of the paragraph, but the initial is placed over the words in the paragraph: \setupalign[r2l] The above illustrates that the empty space is created in the correct place, but the drop-cap word is overlayed on the paragraph text itself and the characters are in reverse order still. With the addition of a non-Hebrew character, such as ,, the Hebrew characters are arranged in the proper Right-to-Left order with the corresponding vowels in the correct place. However, the empty space is not created correctly, the comma (,) is placed over the other characters, and the inclusion of the non-Hebrew character is problematic. \setupinitial[n=2, text={,וְעַל}, method=auto ] Version ConTeXt ver: 2025.08.21 23:32 LMTX fmt: 2025.9.2 int: english/english Background Trying to make a bencher page with drop-caps similar to the following image. Other notes I assume something needs to change in tex/texmf-context/tex/context/base/mkiv/typo-drp.mkiv or tex/texmf-context/tex/context/base/mkiv/typo-drp.lua, but I'm not sure where or what. Or maybe the approach should be more aligned with custom lua code like this answer, https://tex.stackexchange.com/a/531391/417053. Hebrew Font: https://fonts.google.com/noto/specimen/Noto+Sans+Hebrew?selection.family=Alef:wght@400;700|Frank+Ruhl+Libre:wght@300..900|Heebo:wght@100..900|Noto+Sans+Hebrew:wght@100..900|Noto+Serif+Hebrew:wght@100..900 Minimal file: \definefontfeature[minimal][default][ script=hebr ] \definefontfamily[hebrew] [rm] [notosanshebrew] [features=minimal] \setupbodyfont[hebrew, 20pt] \setupalign[r2l] \starttext \setupinitial[n=2, text={וְעַל}, method=auto, ] \placeinitial וְעַל הַכֹּל יְהֹוָה אֱלֺהֵֽינוּ אֲנַֽחְנוּ מוֹדִים לָךְ וּמְבָרְ֒כִים אוֹתָךְ יִתְבָּרַךְ שִׁמְךָ בְּפִי כָּל־חַי תָּמִיד לְעוֹלָם וָעֶד כַּכָּתוּב וְאָכַלְתָּ וְשָׂבָֽעְתָּ וּבֵרַכְתָּ אֶת־יְהֹוָה אֱלֺהֶֽיךָ עַל־הָאָֽרֶץ הַטּוֹבָה אֲשֶׁר נָתַן־לָךְ בָּרוּךְ אַתָּה יְהֹוָה עַל־הָאָֽרֶץ וְעַל־הַמָּזוֹן: \stoptext Thanks in advance for any suggestions and help!

  • List of symbols with page number by symbol location
    by Emad kareem on November 1, 2025 at 8:42 pm

    List of symbols with page numbers based on symbol position I'm using the code below to create a list of symbols consisting of the symbol, description, and page number. The problem is that the page number displayed is the number where the list appears, and it doesn't show the actual page numbers based on the symbol position, as shown in the attached image. \documentclass[12pt,a4paper]{report} \usepackage{geometry} \geometry{margin=1in} \usepackage{nomencl} \usepackage{fancyhdr} \usepackage{etoolbox} \usepackage{setspace} \usepackage{amsmath,amssymb} \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} \pagestyle{fancy} \fancyhf{} \fancyfoot[C]{\thepage} \renewcommand{\headrulewidth}{0pt} %--------------------------------- %--------------------------------- \makenomenclature \renewcommand{\nomname}{\centering\Large\bfseries List of Symbols} \setlength{\nomitemsep}{1\parsep} \newlength{\symbolwidth} \setlength{\symbolwidth}{3.2cm} \renewcommand{\nomlabel}[1]{\makebox[\symbolwidth][l]{#1} --- } \renewcommand{\nomentryend}{\dotfill\makebox[2em][r]{\thepage}} \patchcmd{\thenomenclature}{\section*{\nomname}}{% \chapter*{\nomname}% \addcontentsline{toc}{chapter}{List of Symbols}% \markboth{List of Symbols}{List of Symbols}}{}{} \begin{document} \chapter*{Abstract} \printnomenclature \chapter{Introduction} Example, $\lambda 1$ \nomenclature{$\lambda 1$}{example 1} \chapter{Ex 2} Example, $\lambda 2$ \nomenclature{$\lambda 2$}{example 2} \chapter{Ex 3} Example, $\lambda 3$ \nomenclature{$\lambda 3$}{example 3} \end{document} I use build.bat @echo off set FNAME=min echo 1) Running pdflatex (1st pass)... pdflatex -interaction=nonstopmode %FNAME%.tex echo. echo 2) Running makeindex for nomenclature... makeindex %FNAME%.nlo -s nomencl.ist -o %FNAME%.nls echo. echo 3) Running pdflatex (2nd pass)... pdflatex -interaction=nonstopmode %FNAME%.tex echo. echo Done. Check %FNAME%.pdf pause What is the problem with the correct page number not appearing? Please help.

  • Passing a macro as the argument to an arbitrary arg-spec
    by Grass on November 1, 2025 at 2:55 pm

    MWE: \documentclass{article} \usepackage{mathtools} \begin{document} \ExplSyntaxOn \tl_new:N \g__mymodule_env_name_tl \tl_new:N \g__mymodule_env_args_tl % Defaults \tl_set:Nn \g__mymodule_env_name_tl { matrix } \keys_define:nn { mymodule/math } { ,env .tl_set:N = \g__mymodule_env_name_tl ,env-args .tl_set:N = \g__mymodule_env_args_tl } \NewDocumentCommand{\mat}{ O{} m }{ \keys_set:nn { mymodule/math } { #1 } \begin{\g__mymodule_env_name_tl}\g__mymodule_env_args_tl #2 \end{\g__mymodule_env_name_tl} } \NewDocumentEnvironment{funnymatrix}{ s O{} m }{ \begin{matrix} \text { (Star:~\bool_if:nTF { #1 } { T } { F }) (Optional:~#2) (Mandatory:~#3) } }{ \end{matrix} } \ExplSyntaxOff \section{Current output} Environment \verb|matrix|: \[\mat{1}\] Environment \verb|matrix*| with optional argument: \[\mat[env=matrix*,env-args=[l]]{1}\] Environment \verb|funnymatrix| with a star, mandatory and optional argument: \[\mat[env=funnymatrix,env-args=*[optional]{mandatory}]{1}\] \section{Desired output} Environment \verb|matrix|: \[\mat{1}\] Environment \verb|matrix*| with optional argument: \[\begin{matrix*}[l] 1 \end{matrix*}\] Environment \verb|funnymatrix| with a star, mandatory and optional argument: \[\begin{funnymatrix}*[optional]{mandatory} 1 \end{funnymatrix}\] \end{document} Edit Skillmon and egreg's solutions work very nicely, but they both seem to give a fatal error when compiling \mat[env=NiceArray,env-args={cc|cc}[baseline=line-3]]{1 & 1 & 1 & 1} (with the package nicematrix). How can either solution be modified such that this works?

  • Why are entries in pmatrix not horizontally centered?
    by user1362373 on November 1, 2025 at 2:05 pm

    Based on Section 4.4 in the "Short Math Guide for LaTeX", I expect entries in pmatrix to be horizontally centered, but this is not what I see. Consider the following MWE: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{displaymath} \begin{pmatrix} x_1 \\ \vdots \\ x_{n-1} \\ x_n \end{pmatrix} \end{displaymath} \end{document} This gives The entry $x_{n-1}$ is clearly not centered. Why is that and how can I fix it? Edit: Here's the output of the \listfiles command (posted here rather than in comments for legibility): article.cls 2025/01/22 v1.4n Standard LaTeX document class size10.clo 2025/01/22 v1.4n Standard LaTeX file (size option) amsmath.sty 2025/06/16 v2.17y AMS math features amstext.sty 2024/11/17 v2.01 AMS text amsgen.sty 1999/11/30 v2.0 generic functions amsbsy.sty 1999/11/29 v1.2d Bold Symbols amsopn.sty 2022/04/08 v2.04 operator names l3backend-pdftex.def 2025-10-09 L3 backend support: PDF output (pdfTeX)

  • pgfplots: declare function and parameters globally
    by PatrickT on November 1, 2025 at 12:11 am

    As I was intent on moving function declarations further up, so as to use them in multiple files, I noticed something unexpected. The first code plots a thin black line. The second code plots thick blue dots. I asked a well-known LLM and got a plausible explanation together with a hallucination. Do you have a suggestion to declare functions higher up while preserving the style? See a motivation further down. Example 1 \documentclass[border=3pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \tikzset{define functions/.style={% declare function={ A = 1.0; a = 0.5; f(\x) = A*\x^a; }, }, } \begin{document} \begin{tikzpicture} \begin{axis}[ domain=0:100, samples=100, ] \addplot[define functions] {f(x)}; \end{axis} \end{tikzpicture} \end{document} Example 2 \documentclass[border=3pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \tikzset{define functions/.style={% declare function={ A = 1.0; a = 0.5; f(\x) = A*\x^a; }, }, } \pgfplotsset{ every axis plot/.append style={define functions}, } \begin{document} \begin{tikzpicture} \begin{axis}[ domain=0:100, samples=100, ] % [define functions] not used here \addplot {f(x)}; \end{axis} \end{tikzpicture} \end{document} LLM talking now: Example 1 \addplot[define functions] {f(x)}; You explicitly attach the define functions style only to that plot. No other styles are affected. PGFPlots uses the default plot style, which is a thin black line (black, line width 0.4pt). Example 2 \pgfplotsset{every axis plot/.append style={define functions}} \addplot {f(x)}; You append the define functions style to every plot. But here’s the subtlety: every axis plot applies before the default plot style is applied, and declare function is a key that is not strictly separate from plotting keys. What happens internally: PGFPlots interprets your appended style as including both the function declaration and the style from the first plot in your style list. Because of key expansion order, the default line style is overridden. The plot falls back to the first "unknown" style PGFPlots sees for drawing, which is often the blue mark=* style (used for points), producing thick blue dots. Why this happens every axis plot is applied before \addplot options are merged. declare function is technically a "style key" in the PGFPlots system. PGFPlots sees a style (from every axis plot) that contains no explicit draw key, so it falls back to its default marker style (mark=*, thick, blue). When you attach [define functions] directly to \addplot, the default line style is preserved, so you get a thin black line. How to fix it You need to combine your define functions style with the standard line style: if you want to keep PGFPlots defaults but still append: \pgfplotsset{ every axis plot/.append style={define functions, /pgfplots/line} } Me speaking again: No this doesn't work and nor do the several other suggestions I received. Motivation: I would save different parameter values in distinct files and load them with, say \input{func1.tex}, so I can share code across multiple figures. The syntax used in declare function is natural, unlike an alternative like \pgfmathdeclarefunction{f}{1}{\pgfmathparse{1.0*#1^(0.5)}}. I'm not averse to trying something radically different from my current approach, including using LuaTeX or Python.