• \IfPackageLoadedT doesn't allow empty lines
    by Gargantuar on May 17, 2025 at 6:27 am

    Why doesn't \IfPackageLoadedT allow empty lines inside its argument? Suppose I have: \documentclass{article} \IfPackageLoadedT{amsmath}{ \newcommand{\foo}{} } \begin{document} a \end{document} This throws the error (line 6 being the empty line): Runaway argument? { \newcommand {\foo }{} ./test.tex:6: Paragraph ended before \IfPackageLoadedT was complete. <to be read again> \par l.6 However, after removing the empty line, the document compiles as usual. Note that this doesn't happen with the variants \IfPackageLoadedTF and \IfPackageLoadedF.

  • Adding a custom component in circuitikz and using it within different files
    by אילון הלוי on May 16, 2025 at 1:41 pm

    I am new to using latex and found-out recently of the library circuitikz. I would like to know how to create and edit custom components within this library, and also how to import them into circuits from other files. (usepackage or anything alike...) The component I would like to add in my circuit:

  • Problem with sideways-text alignment in table with multirow
    by Michał Sikorski on May 16, 2025 at 10:26 am

    Halo, I have a problem with the alignment of sideways text in a table with a multirow. Here is my code: \documentclass{article} \usepackage{tcolorbox} \usepackage{graphicx} \usepackage{array,multirow,graphicx} \usepackage{float} \usepackage{booktabs} \usepackage{rotating} \usepackage{tabularx} \usepackage{longtable} \begin{document} \begin{table}[H]\def\arraystretch{1.5} \begin{tabular}{cccccccccccccc} \multirow{2}{*}{\begin{sideways} Item nr.\end{sideways}} & \multirow{2}{*}{\begin{sideways} Sub-item nr. \end{sideways}} & \multirow{2}{}{\begin{sideways} Question \end{sideways}} & \multicolumn{6}{c}{} & \multirow{2}{*}{\begin{sideways} New sub-item nr. \end{sideways}} } \\ & & & \multicolumn{6}{c}{Rounds of survey} & & \\ & & & R1 & R2 & R3 & R4 & R5 & CA \\ \midrule & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \end{tabular} \end{table} \end{document} And here is the output: I would like the sideways text to align with the midrule. I was not able to find a solution that would not mess up the ``Rounds of survey'' multicolumn. Any idea how to do it? Thank you very much in advance for your kind help!

  • Weird spacing in tabular, Beamer
    by Albs51 on May 16, 2025 at 9:55 am

    I'm working on a presentation in beamer and some weird spacing is happening inside a table. This is the code I'm using and below a screenshot of the result. \documentclass[aspectratio=169,xcolor=dvipsnames]{beamer} \usetheme{SimpleDarkBlue} \usepackage{babel} \usepackage{amsmath} \usepackage{hyperref} \usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables \usepackage{tabularx} \usepackage{array} \newcommand{\G}{\mathcal{G}} \newcommand{\R}{\mathbb{R}} \begin{document} \newcolumntype{P}[1]{>{\hspace{0pt}}p{#1}} \begin{frame}{Relatività Generale e Newton-Cartan a confronto} Riassumendo, le differenze principali tra Newton-Cartan e la relatività generale sono:\\ \newcommand{\ColWidth}{0.3\linewidth} \resizebox{14cm}{!}{ \begin{tabular}{P{\ColWidth} P{\ColWidth} P{\ColWidth}} & \textbf{Newton-Cartan} & \textbf{Relatività Generale} \\ \hline \hline Fisica contenuta in: & $\begin{cases} R_{00}=4\pi G\rho \\ \frac{d^2x^k}{d\lambda^2}+\frac{\partial \Phi}{\partial x^k}\Big(\frac{dt}{d\lambda}\Big)^2=0 \end{cases}$ & $ \begin{cases} R_{\mu\nu}-\frac{1}{2}g_{\mu\nu}R=8\pi T_{\mu\nu} \\ \ddot x^k + \Gamma^k_{ij}\dot x^i\dot x^j=0 \end{cases} $\\ Struttura geometrica dello spaziotempo, presente \textit{a priori}: & \begin{enumerate} \item Tempo universale $t:\G\rightarrow\R$ \item Derivata covariante $\nabla$ \item Metrica spaziale (sulle space-slices) ma \textit{non una metrica spaziotemporale} \end{enumerate} & Metrica spaziotemporale da cui segue la connessione $\rightarrow$ RG è teoria \textit{metrica}\\ \end{tabular} } \end{frame} \end{document} This is what happens when I run the code. What I don't like is the weird misalignments with the second system of equations and the enumerate environment in the third row:

  • Package fontspec Error: The font "--" cannot be found
    by Niranjan on May 16, 2025 at 8:32 am

    Following this answer, I managed to get specific fonts in specific sizes, but here is another problem: \documentclass{article} \usepackage{fontspec} \setmainfont[% IgnoreFontspecFile,% UprightFeatures = {% SizeFeatures = {% {% Size = {-8},% Color = {red},% Font = {NewCM08-Book.otf}% },% {% Size = {8},% Color = {green},% Font = {NewCM08-Book.otf}% },% {% Size = {9-},% Color = {blue},% Font = {NewCM10-Book.otf}% }% }% },% ItalicFeatures = {% SizeFeatures = {% {% Size = {-8},% Color = {red},% Font = {NewCM08-BookItalic.otf}% },% {% Size = {8},% Color = {green},% Font = {NewCM08-BookItalic.otf}% },% {% Size = {9-},% Color = {blue},% Font = {NewCM10-BookItalic.otf}% }% }% }% ]{NewCM10-Book.otf} \begin{document} hello world \footnotesize hello world \tiny foo \normalsize\itshape hello world \footnotesize hello world \tiny foo \end{document} Adding IgnoreFontspecFile results in this cryptic error I am not able to understand. The weirder part is that the output is exactly as expected. No problem there. The .fontspec files are also successfully ignored, the log confirms. See the output:

  • What does `\mathalpha` mean in unicode-math?
    by Andrew Stacey on May 15, 2025 at 8:37 pm

    Looking through unicode-math-table.tex, the characters are defined via commands like: \UnicodeMathSymbol{"1D7BC}{\mbfitsanssigma}{\mathalpha}{mathematical sans-serif bold italic small sigma}% I'm trying to understand this, in particular the third argument. The possibilities for this argument are: \mathaccent \mathaccentoverlay \mathaccentwide \mathalpha \mathbin \mathbotaccent \mathbotaccentwide \mathclose \mathfence \mathop \mathopen \mathord \mathover \mathpunct \mathrel \mathunder Some of these I recognise, such as \mathord and \mathbin, and I know that these are used to determine the spacing between characters (amongst other things). But according to TeX by Topic, the options are just ord, op, bin, rel, open, close, punct, and inner. And the luatex manual also implies that these are the only categories (from Section 7.5.2 Pairwise Spacing which lists all the primitives that control the spacing between classes). So what do the rest represent and how are the interpreted with regard to spacing? I picked \mathalpha as an example, but also because it's the least comprehensible in the above list: I can imagine that the accents simply inherit their spacing from whatever the base character is, similarly with the over and under. But it feels like \mathalpha should just be \mathord. Why is it not?

  • Generate plural forms of labels referenced with fancyref
    by user26918948 on May 15, 2025 at 1:32 pm

    Can I somehow generate the plural forms if multiple labels are referenced with fancyref? \documentclass[12pt,a4paper]{ltxdoc} \usepackage{fancyref} \begin{document} \begin{equation} \label{eq:pythagoras} a^2 + b^2 = c^2 \end{equation} \begin{equation} \label{eq:trivial} a = a \end{equation} \fref{eq:trivial} \fref{eq:pythagoras} leads to \enquote{equation (2) equation (1)} \hspace{-1.4em}but I need \enquote{equations (2) and (1)} \end{document}

  • Horizontal line in xlop multiplication get smashed with numbers
    by Rukmini Okky on May 15, 2025 at 4:42 am

    I have used the following code using xlop package. \documentclass{article} \usepackage{xlop,multicol,enumerate} \begin{document} \begin{multicols}{3} \begin{enumerate} \item {\opmul[style=display,voperation=center, displayintermediary=all]{31}{10}} \item {\opmul[style=display,voperation=center,hfactor=decimal, displayintermediary=all]{43.1}{100}} \item{\opmul[style=display,voperation=center,hfactor=decimal, displayintermediary=all]{1.367}{1000}} \end{enumerate} \end{multicols} \end{document} But I got result like this where horizontal line is not properly aligned. What should I do?

  • Cannot parse list of arguments with ProcessList
    by Franz on May 14, 2025 at 7:36 pm

    I try to create a PDF with a table that explains the macros that I use. Here is a simple example that almost works: \documentclass{standalone} \NewDocumentCommand{\asarg}{ O{} }{ {#1} } \NewDocumentCommand{\notation}{% m % name of the command % O{} % arguments for the command >{\SplitList{;}}O{} % arguments for the command m % domain of the mathematical object m % description of the mathematical objetct }{\texttt{\string#1} & \ensuremath{#1\ProcessList{#2}{\asarg}} & \ensuremath{#3} & #4 \\} \newcommand{\amatrix}{A} \newcommand{\id}[1]{I_{#1}} \newcommand{\squarematrices}[2]{M(#1; #2)} \newcommand{\matrices}[3]{M(#1, #2; #3)} \begin{document} \begin{tabular}{cccl} \notation{\matrices}[n; m; R]{???}{The space of matrices with \(n\) columns, \(m\) rows and entries from \(R\).} \notation{\amatrix}{\matrices{n}{m}{R}}{A matrix.} \notation{\squarematrices}[n; R]{???}{The set of square matrices with \(n\) row/columns and entries from \(R\).} % \notation{\id}[n]{\squarematrices{n}{R}}{The identity matrix.} \end{tabular} \end{document} The argument for the matrices macro are however not correctly parsed and including the id macro results in an error. Can someone help?

  • Is TeX output supposed to be vector or raster?
    by Shaikh Ammar on May 14, 2025 at 7:22 pm

    I have heard that Metafont produces rasterized fonts. However, if I run the command tex on a plain text file containing this font is not rasterised!!! I get a dvi output where even after zooming pretty far in Skim, the text doesn't seem pixellated at all. Is it still raster but somehow really well optimised or did Metafont switch to vector fonts somewhere down the line? For comparison, I looked at some font samples on CTAN of fonts produced using Metafont, and they do seem to get pixellated when I zoom in. I also found a source code manual of LaTeX, where they also get pixellated when zoomed in. Digital versions of Donald Knuth's books also seem to be using vector fonts. I am assuming he uses TeX without any 3rd party modifications. What is going on here? Does Metafont have the support to make vector fonts as well. I am using TeX 3.141592653 (TeX Live 2024) The font samples I referenced were from here https://ctan.org/pkg/bookhands. Interestingly, while the others fonts in the file do get pixellated, Computer Modern doesn't.

  • Command that cycles through multiple colors for question boxes [in loop]
    by Fábio dej on May 14, 2025 at 12:09 pm

    I have defined five different colored question boxes using tcolorbox in LaTeX: orange, red, pink, green, and yellow. Currently, I have separate commands for each color (e.g., \questa, \questb, etc.). I want to simplify this and create a single command, such as \quest, that cycles through the colors in a loop. How can I implement this cycling behavior to automatically alternate colors without manually specifying each color? \documentclass{exam} \usepackage[most]{tcolorbox} \usepackage{lipsum} \usepackage{xcolor} % For custom color blending % Custom QUESTION boxes with specific colors \newcommand{\questa}{% orange box \renewcommand{\thequestion}{\begin{tcolorbox}[enhanced, colframe=white, boxrule=1pt, colback=orange, arc=14pt, auto outer arc, boxsep=4pt, width=4.5cm, halign=center, coltext=white, fontupper=\bf\large, drop fuzzy shadow, colbacklower=black!10] QUESTION \arabic{question} \end{tcolorbox}} \question\phantom{text}\par } \newcommand{\questb}{% red box \renewcommand{\thequestion}{\begin{tcolorbox}[enhanced, colframe=white, boxrule=1pt, colback=red, arc=14pt, auto outer arc, boxsep=4pt, width=4.5cm, halign=center, coltext=white, fontupper=\bf\large, drop fuzzy shadow, colbacklower=black!10] QUESTION \arabic{question} \end{tcolorbox}} \question\phantom{text}\par } \newcommand{\questc}{% pink box \renewcommand{\thequestion}{\begin{tcolorbox}[enhanced, colframe=white, boxrule=1pt, colback=pink, arc=14pt, auto outer arc, boxsep=4pt, width=4.5cm, halign=center, coltext=white, fontupper=\bf\large, drop fuzzy shadow, colbacklower=black!10] QUESTION \arabic{question} \end{tcolorbox}} \question\phantom{text}\par } \newcommand{\questd}{% green box \renewcommand{\thequestion}{\begin{tcolorbox}[enhanced, colframe=white, boxrule=1pt, colback=green, arc=14pt, auto outer arc, boxsep=4pt, width=4.5cm, halign=center, coltext=white, fontupper=\bf\large, drop fuzzy shadow, colbacklower=black!10] QUESTION \arabic{question} \end{tcolorbox}} \question\phantom{text}\par } \newcommand{\queste}{% yellow box \renewcommand{\thequestion}{\begin{tcolorbox}[enhanced, colframe=white, boxrule=1pt, colback=yellow, arc=14pt, auto outer arc, boxsep=4pt, width=4.5cm, halign=center, coltext=white, fontupper=\bf\large, drop fuzzy shadow, colbacklower=black!10] QUESTION \arabic{question} \end{tcolorbox}} \question\phantom{text}\par } \begin{document} \begin{questions} \questa \lipsum[2] \questb \lipsum[2] \questc \lipsum[2] \questd \lipsum[2] \queste \lipsum[2] \end{questions} \end{document}

  • Vertical Misalignment in Multicolumn Equations
    by Arthur De Queiroz Tavares Borg on May 14, 2025 at 6:09 am

    I am using the following code, which previously generated three side-by-side equations successfully. However, when reusing the same code, the equations are now vertically misaligned. I have verified that no required packages are missing. The code that worked before was also used with the IEEEtran document class. \begin{multicols}{3} \begin{equation} \label{eq::tensaodepolo} v_{gh_j} = v_{h_j0} + v_{g0} \end{equation} \hspace{-8mm} % Reduces horizontal space \begin{equation} \label{eq::ilo} v_{hs_j} = v_{h_{j0}} - v_{s_{j0}} \end{equation} \hspace{-8mm} % Reduces horizontal space \begin{equation} \label{eq::zh} e_{l_{jk}} = v_{a_{j0k}} - v_{b0_{jk}} \end{equation} \end{multicols} .png

  • `.initial:n` leads to an error when after `.inherit:n`?
    by zpding on May 13, 2025 at 8:44 pm

    This code originally from Inheritance of keys in expl3: \documentclass{article} \begin{document} \ExplSyntaxOn \keys_define:nn { a } { A .tl_set:N = \l__A_tl } \keys_define:nn { } { b .inherit:n = a, } \keys_define:nn { b } { B .tl_set:N = \l__B_tl, B .default:n = {DEFAULT}, % --> works B .initial:n = {INITIAL}, % --> error } \keys_set:nn { b } { A = x } \ExplSyntaxOff \end{document} output log: ! LaTeX Error: The key 'b/B' is unknown and is being ignored. For immediate help type H <return>. ... l.15 } why does .initial:n lead to an error when after a .inherit:n ?

  • Build a `tabularray` content with LaTeX3
    by projetmbc on May 13, 2025 at 7:42 pm

    What is the problem in the following code which says Misplaced alignment tab character &. \l_cookbook_orsteps_tblr_tl ->A&B\\n? \documentclass[12pt]{article} \usepackage{tabularray} \begin{document} \ExplSyntaxOn \tl_new:N \l_cookbook_orsteps_tblr_tl \tl_clear:N \l_cookbook_orsteps_tblr_tl \tl_put_right:Nn \l_cookbook_orsteps_tblr_tl { A } \tl_put_right:Nn \l_cookbook_orsteps_tblr_tl { & } \tl_put_right:Nn \l_cookbook_orsteps_tblr_tl { B } \tl_put_right:Nn \l_cookbook_orsteps_tblr_tl { \\ } \tl_put_right:Nn \l_cookbook_orsteps_tblr_tl { n } \begin{tblr}{cells = {mode = math}} \tl_use:N \l_cookbook_orsteps_tblr_tl \end{tblr} \ExplSyntaxOff \end{document}

  • Creating unit circle depicting sin, cos and tan values
    by Dimitrios ANAGNOSTOU on May 13, 2025 at 6:08 pm

    I am trying to create the following figure. Here is my attempt. \documentclass[margin=1cm]{standalone} \usepackage{tikz} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[scale=4] % Axes \draw[->] (-1.5,0) -- (1.8,0) node[right] {axe des cosinus}; \draw[->] (0,-1.5) -- (0,1.5) node[above] {axe des sinus}; \draw[->, thick] (1,-1.8) -- (1,1.8) node[above right] {axe des tangentes}; % Cercle unité \draw[red, thick] (0,0) circle(1); % Angles principaux \foreach \x/\y in { 30/\frac{\pi}{6}, 45/\frac{\pi}{4}, 60/\frac{\pi}{3}, 90/\frac{\pi}{2}, 120/\frac{2\pi}{3}, 135/\frac{3\pi}{4}, 150/\frac{5\pi}{6}, 180/\pi, 210/-5\frac{\pi}{6}, 225/-\frac{3\pi}{4}, 240/-\frac{2\pi}{3}, 270/-\frac{\pi}{2}, 300/-\frac{\pi}{3}, 315/-\frac{\pi}{4}, 330/-\frac{\pi}{6}, 0/0} { \draw[gray] (0,0) -- ({cos(\x)}, {sin(\x)}); \node[fill=white] at ({0.8*cos(\x)}, {0.8*sin(\x)}) {$\y$}; } % Lignes horizontales pour les valeurs de sinus \draw[dashed] ({cos(30)},0) -- ({cos(30)}, {sin(30)}); \draw[dashed] ({cos(45)},0) -- ({cos(45)}, {sin(45)}); \draw[dashed] ({cos(60)},0) -- ({cos(60)}, {sin(60)}); % % Projections vers l’axe des tangentes (1, y/x) \draw[dashed] (1,0) -- (1,{tan(30)}); \draw[dashed] (1,0) -- (1,{tan(45)}); \draw[dashed] (1,0) -- (1,{tan(60)}); % Lignes pointillées depuis les points sur le cercle vers l’axe des tangentes \foreach \a in {30,45,60} { \draw[dashed] ({cos(\a)}, {sin(\a)}) -- (1, {tan(\a)}); } % Valeurs des tangentes \node at (1.1, {tan(30)}) {$\frac{1}{\sqrt{3}}$}; \node at (1.1, {tan(45)}) {$1$}; \node at (1.1, {tan(60)}) {$\sqrt{3}$}; \node at (1.1, {-tan(30)}) {$-\frac{1}{\sqrt{3}}$}; \node at (1.1, {-tan(45)}) {$-1$}; \node at (1.1, {-tan(60)}) {$-\sqrt{3}$}; \end{tikzpicture} \end{document} Any help to get something closer to the attached image will be greatly appreciated. Thanks.

  • Customizing the section title (Name of section No of section)
    by Dimitrios ANAGNOSTOU on May 13, 2025 at 2:15 pm

    \documentclass[twocolumn,10pt]{article} \usepackage[margin=1cm,bmargin=1.4cm]{geometry} % little margins \usepackage{xcolor}% better than color \usepackage{hyperref,bookmark} \usepackage{lipsum} % dummy text \colorlet{authorcolor}{red!80} \colorlet{sectioncolor}{blue!80} \makeatletter \renewcommand\@maketitle{% custom maketitle \textcolor{authorcolor}{\Large \bfseries\@title}\par \smallskip \textsc{Teacher:} \@author\ at \@date\par \smallskip \hrule \bigskip } \newcommand{\sectitle@format}[1]{#1\bfseries\color{sectioncolor}} \renewcommand{\section}{\@startsection {section}% % the name {1}% % the level {0mm}% % the indent {-0.5\baselineskip}% % the before skip {0.5\baselineskip}% % the after skip {\sectitle@format{\Large}}% % the style } \makeatother % \title{My title} \author{Joe Dupont} \date{\today} \begin{document} \maketitle \section{Student} \lipsum[1] \section{Student} \lipsum[2] \section{Student} \lipsum[3] \end{document} How can one change the appearance of section title from 1 Student, 2 Student, etc to Student 1, Student 2, etc? Thanks in advance!

  • Is there a way to locally override the extra space before a colon in a tcolorbox title when using French babel?
    by cjorssen on May 13, 2025 at 1:18 pm

    I am typesetting a document in French with the babel package and using tcolorbox for boxed environments. I have noticed that the colon in my box title is flanked by an unusually large space (as enforced by French typographical rules). In my case, this seems excessive and I suspect it may actually be a bug in how tcolorbox handles French spacing around punctuation. Here is a minimal example: \documentclass{article} \usepackage{tcolorbox} \usepackage[french]{babel} \begin{document} \begin{tcolorbox}[halign title = center, title = {Foo : bar}] Test \end{tcolorbox} \end{document} I would like to reduce the space between “Foo” and the colon only in this title, without altering the global French punctuation spacing rules elsewhere in my document. Is there a known workaround or key in tcolorbox to fine-tune or disable the French spacing around the colon in the title? If not, could this behavior be considered a bug in tcolorbox, and if so, is there an established fix or patch?

  • How to draw variations of tikz pictures without copy and pasting?
    by Kenya on May 13, 2025 at 5:47 am

    I want to create the following tikz images: For now, I've just copy and pasted variations of the code below: \begin{tikzpicture}[scale=0.5] \tikzstyle{vertex}=[circle,draw,minimum size=10pt,inner sep=0pt] \node[vertex] (S-8) at (1.34,-2.98) [minimum size=15pt, fill=white] {$*1$}; \node[vertex] (S-9) at (1.34,-1.34) [minimum size=15pt, fill=gray] {}; \node[vertex] (S-10) at (2.98,-1.34) [minimum size=15pt, fill=gray] {}; \node[vertex] (S-11) at (4.61,-1.34) [minimum size=15pt, fill=gray] {}; \node[vertex] (S-12) at (4.61,-2.98) [minimum size=15pt, fill=white] {$*1$}; \node[vertex] (S-13) at (4.61,-4.61) [minimum size=5pt, fill=white] {}; \node[vertex] (S-14) at (2.98,-4.61) [minimum size=5pt, fill=white, label={-90: \Large $0$}] {}; \node[vertex] (S-15) at (1.34,-4.61) [minimum size=5pt, fill=white] {}; \draw (S-8) -- (S-9);\draw (S-8) -- (S-15);\draw (S-9) -- (S-8);\draw (S-9) -- (S-10);\draw (S-10) -- (S-9);\draw (S-10) -- (S-11);\draw (S-11) -- (S-10);\draw (S-11) -- (S-12);\draw (S-12) -- (S-11);\draw (S-12) -- (S-13);\draw (S-13) -- (S-12);\draw (S-13) -- (S-14);\draw (S-14) -- (S-13);\draw (S-14) -- (S-15);\draw (S-15) -- (S-8);\draw (S-15) -- (S-14); \end{tikzpicture} It works, but there has to be a more elegant solution so I can make more of these pictures.

  • XeLaTeX exits prematurely when I use the code "$\widehat{ß}$"
    by Baskar on May 12, 2025 at 2:20 pm

    When compiling the following code with XeLaTeX: \documentclass{article} \usepackage{xparse, unicode-math} \begin{document} $\widehat{ß}$ $\widehat{æ}$ \end{document} the PDF is not generated, and XeLaTeX exits prematurely with the following error: Missing character: There is no ß ("DF) in font cmmi10! ! Internal error: bad native font flag in `map_char_to_glyph' It fails to proceed beyond this point. Would you like me to suggest a fix or workaround for this issue as well?

  • Spacing before and after text operators
    by Michael F on May 12, 2025 at 10:14 am

    I would like to define custom text operators in math mode, such as "if", "then", "catch". These operators should always be preceded and succeeded by some space. Surrounding my operators with \mathrel brings me already quite close to what I want to achieve; however, when there is an equals sign (=) before an operator, there is no space between the two. MWE: \documentclass{minimal} \usepackage{amsmath} \begin{document} \newcommand{\relname}[1]{\mathrel{\operatorname{#1}}} \newcommand{\ite}[3]{\relname{if} #1 \relname{then} #2 \relname{else} #3} $\ite{a}{b}{c}$ (good) $x = \ite{a}{b}{c}$ (bad --- insufficient space after "=") % https://tex.stackexchange.com/questions/680197/no-spacing-after-binary-operator-after-math-operator \renewcommand{\relname}[1]{\mathop{}\!\mathrel{\operatorname{#1}}} $\ite{a}{b}{c}$ (bad --- too much space before "if") $x = \ite{a}{b}{c}$ (good) % https://tex.stackexchange.com/questions/46402/defining-a-prefix-operator-with-space-before-its-argument \renewcommand{\relname}[1]{\mathinner{\operatorname{#1}}} $\ite{a}{b}{c}$ (too cramped) $x = \ite{a}{b}{c}$ (too cramped) \end{document}

  • Tabularray Alternative Row Style every 3rd/nth Row
    by Harry on May 12, 2025 at 7:52 am

    Is it possible to style every 'third' (or nth) row? MWE: \documentclass{article} \usepackage{tabularray} \begin{document} \begin{longtblr}[ caption = {nth row styling}, label = {}, ]{ colspec = {X[l] r r r r r r r r}, row{1} = {font=\bfseries}, vline{1,2,3,5,7,9,10}, hlines, } \SetCell[r=2,c=1]{c,t} Exercise & \SetCell[c=8]{c} Difficulty~Levels \\* & & \SetCell[c=2]{c} 1 && \SetCell[c=2]{c} 2 && \SetCell[c=2]{c} 3 && \SetCell[c=1]{c} $\Sigma$ \\ \hline \SetCell[r=3,c=1]{l,t} Align top & core & 3 & 2 & 1 & 6 & 0 & 0 & 0 \\ & add & 2 & 3 & 4 & 9 & 1 & 2 & 3 \\ & ext & 2 & 3 & 4 & 9 & 1 & 2 & 3 \\ \SetCell[r=3,c=1]{l,t} % << key line Align top & core & 3 & 2 & 1 & 6 & 0 & 0 & 0 \\ & add & 2 & 3 & 4 & 9 & 1 & 2 & 3 \\ & ext & 2 & 3 & 4 & 9 & 1 & 2 & 3 \\ \end{longtblr} \end{document} Output: Desired output: Row draws between core, add, ext (i.e. these two draws) to be dashed (or not drawn). I will be programatically adding rows to this table, so won't work to manually specify these rows.

  • Displaying mathematical symbols in Chinese environment
    by 青山漫步 on May 12, 2025 at 12:38 am

    When typesetting some manuscripts with mathematical formulas using the Texlive2025 distribution, if the system's default Chinese font definitions are used, an error occurs during compilation, indicating that the mathematical symbols are undefined. Here is a minimal test environment. Does anyone have good solutions? \usetypescriptfile[mscore] %\usebodyfont[mschinese,rm,12pt] \setupbodyfont[mschinese,rm,12pt] \starttext {\rm The programs } {\ss in this article } \im{z=f(x,y)} {\tt using Python} \startformula \int_{0}^{2 \pi} f(x) \dd x \stopformula \stoptext Below is the log file. system > system > ConTeXt ver: 2025.02.28 18:12 LMTX fmt: 2025.3.10 int: english/english system > system > 'cont-new.mkxl' loaded open source > level 1, order 1, name 'D:/texlive/2025/texmf-dist/tex/context/base/mkxl/cont-new.mkxl' system > beware: some patches loaded from cont-new.mkiv close source > level 1, order 1, name 'D:/texlive/2025/texmf-dist/tex/context/base/mkxl/cont-new.mkxl' system > 'cont-sys.mkxl' loaded open source > level 1, order 2, name 'D:/texlive/2025/texmf-dist/tex/context/texlive/cont-sys.mkxl' close source > level 1, order 2, name 'D:/texlive/2025/texmf-dist/tex/context/texlive/cont-sys.mkxl' system > files > jobname './contextversion', input './contextversion.tex', result './contextversion' fonts > latin modern fonts are not preloaded languages > language 'en' is active open source > level 1, order 3, name './contextversion.tex' open source > level 2, order 4, name 'D:/texlive/2025/texmf-dist/tex/context/fonts/mkiv/type-imp-mscore.mkiv' close source > level 2, order 4, name 'D:/texlive/2025/texmf-dist/tex/context/fonts/mkiv/type-imp-mscore.mkiv' files > library > files > library > file 'type-imp-cambria.mkiv' should be in the installed distribution files > library > tex error > tex error on line 25 in file ./contextversion.tex: Math error: parameter 'operatorsize' with id 9 in style 0 is not set <macro> \endgroup \Ustopmathmode <macro> \stopforceddisplaymath \egroup \ifcase \c_strc_formulas_frame_mode \else \strc_math_number_check_offsets \fi \ifcase \c_strc_formulas_frame_mode \strc_math_number_check \or \strc_math_number_check_outside \else \strc_math_number_check_inside \fi \str <macro> \endgroup \strc_formulas_endstrut \stopinnermath \afterdisplayspace \egroup <macro> \strc_formulas_place_number \strc_formulas_flush_number \dostarttaggednodetail \t!formulacontent \dotagregisterformula {\number \c_strc_formulas_n }\!!zerocount \csname \e!stop \formulaparameter \c!alternative \v!formula \endcsname \dostoptagged \dos <line 3.25> \stopformula 15 16 17 \usetypescriptfile[mscore] 18 %\usebodyfont[mschinese,rm,12pt] 19 \setupbodyfont[mschinese,rm,12pt] 20 21 \starttext 22 {\rm The programs } {\ss in this article } \im{z=f(x,y)} {\tt using Python} 23 \startformula 24 \int_{0}^{2 \pi} f(x) \dd x 25 >> \stopformula 26 27 \stoptext 28 Sorry, but I can't typeset math unless various parameters have been set. This is normally done by loading special math fonts into the math family slots. Your font set is lacking at least the parameter mentioned earlier.

  • Knuthian environment and Xparse
    by yannisl on May 12, 2025 at 12:17 am

    Consider the following code which creates a delimited command that creates a "Knuthian environment". In days bygone the argument against this type of construction was it could consume to much memory. (Not really a concern now). How can I replace this code with xparse but keep the delimiters. I don't want to write \begin...\end. I am aware of the +b specifier. The command will load a latin->Greek transliterator. It is fine for very long texts to have have a LaTeX style environment, but in many cases is only a few words. Note the example just bold faces the text to avoid posting the longer code with the transliterator. \documentclass{article} \usepackage{xcolor} \usepackage{lipsum} \long\def\GR#1\GR {% \begingroup \bfseries #1 \endgroup } \begin{document} \GR \lipsum[1-2]\GR \GR Some words only\GR and more \GR \color{blue}some other words \GR \end{document}

  • Add new glyph into an existing math font
    by Stephen on May 11, 2025 at 2:39 am

    I want to create a new glyph (parallel and equal to) into the Cambria Math font. So I proceed as follows: Copy Cambria Math.ttf Open it via fontforge Create a glyph in slot U+2427 (I don't know where is the proper place to put this new glyph into) Change the font name and font family name into CambriaMath-New and Cambria Math New respectively Generate new font CambriaMath-New.otf to the desktop Install it via fontbook Create mwe to test the font: % Compiler: lualatex \documentclass{article} \usepackage{unicode-math} \setmathfont{Cambria Math New} \begin{document} $\alpha$ \end{document} However, unicode-math complains that The first font loaded by unicode-math must be an (unicode-math) OpenType Math font (with script=math). and then uses Latin Modern Math instead. What should I do so that I can use the new font successfully? Thanks. Update Due to copyright reason, I tested again with latinmodernmath.otf, but the same result happened. Update I created a separate font called demo and put the glyph into slot U+E006 since it's in Unicode private use srea. After installing the demo font in my system, I tested the following example: \documentclass{article} \usepackage{unicode-math} \setmathfont{Cambria Math} \newcommand{\peq}{\mathrel{\hbox{\fontspec{demo}\char"E006}}} \begin{document} $\ell_1\peq\ell_2$ \end{document} I'm sure this is not the best practice. Any suggestions are welcome.

  • \usepackage{emoji} not working?
    by catwithlonghair on May 11, 2025 at 12:48 am

    This is the code i have: \documentclass[12pt]{article} \usepackage{emoji} \begin{document} \subsection{wow} \emoji{leaves} idk anymore dude \end{document} This is all that i have written. But every time i recompile i get an error saying the \emoji{} doesn't do anything? And in my document it just says "leaves". I used this example document that i found on this overleaf website. Do i have to download a file? What did i miss?

  • Pgfplots tick label values are incorrect
    by UkuNano on May 10, 2025 at 7:45 pm

    I have the x axis of my data in volts, but I want to show it in millivolts, therefore I want to multiply the tick label numbers by 1000 while positioning the labels correctly relative to my data. I have arrived at the following code, which does format the numbers correctly, but the numbers themselves are incorrect. \documentclass[tikz, border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=0.003600, xmax=0.003660, ymin=0.0, ymax=0.06, xtick={0.003600, 0.003610, 0.003620, 0.003630, 0.003640, 0.003650, 0.003660}, xticklabel={ \pgfmathparse{round(1000*\tick*1000)/1000} \pgfmathprintnumber[fixed, fixed zerofill, precision=3]{\pgfmathresult} }, scaled x ticks=false ] \end{axis} \end{tikzpicture} \end{document} The values should be 3.600, 3.610, 3.620, 3.630, 3.640, 3.650, 3.660. But instead they are 3.601, 3.616, 3.616, 3.632, 3.647, 3.647, 3.662. The numbers also repeat which is very weird. How could I make the numbers be correct? Or is there a completely different approach to achieve my original goal?

  • Make a square frame of equal size around some distinct characters
    by Jack on May 10, 2025 at 4:30 pm

    In order to display cards (AKQJT98765432) in a frame I have macro Fbox. The frames should be quadratic and all of the same size, adapted to the fontsize. I encounter 2 problems: The ‘Q’ has a depth that makes its frame higher. I can think of 2 solutions, but neither works correct: Do a combination of raising the ‘Q’ a bit and diminishing its size a little Increase the frame of the others to the size of the ‘Q’ For the first it would be necessary to test if a ‘Q’ is to be processed (but also for other purposes I need to test on #1). This leads to another problem (expansion?) Both \Fbox{Q} and \Fbox{\myqueen} work as expected. But \Fbox{\MyQueen} doesn't. I appreciate any help to solve this \documentclass{article} \usepackage{xspace} \def\myqueen{Q} \def\DoSomething#1{#1} \NewDocumentCommand{\MyQueen}{s t!}{% \bgroup% \IfBooleanTF{#1}{% \IfBooleanTF{#2}{Q}{Queen}% }{% \IfBooleanTF{#2}{q}{queen}% }% \egroup% \xspace% }% MyQueen \def\Fbox#1{% \setlength{\fboxsep}{0.2ex}% set inner space \setlength{\fboxrule}{0.1ex}% set line width \fbox{% \makebox[\height]{% \rule{0mm}{0.75em}% set box height \if#1Q\DoSomething{Q}\else#1\fi }% makebox }% fbox }% Fbox \begin{document} \Huge \Fbox{A}\Fbox{Q}\Fbox{9}\\ \Fbox{\myqueen}\\ \Fbox{\MyQueen*!} \end{document}

  • Why l3keys don't expand key-values?
    by Explorer on May 10, 2025 at 4:20 pm

    The question raised from this MWE: \documentclass{article} \def\myzihao{5} \usepackage[zihao=\myzihao,fontset=fandol]{ctex}%failed with not expansion % \usepackage[zihao=5,fontset=fandol]{ctex}% work \begin{document} Hello World! \end{document} with \usepackage[zihao=\myzihao,fontset=fandol]{ctex}, it complains that: Key 'ctex/option/zihao' accepts only a fixed set of choices. l.314 } That raised from the \myzihao is NOT to be expanded. With the following MWE tuned, it worked with \exp_args:Nee: \documentclass{article} \def\myzihao{5} \ExplSyntaxOn \def\usepkg#1#2{\usepackage[#1]{#2}} \exp_args:Nee \usepkg{zihao=\myzihao,fontset=fandol}{ctex} \ExplSyntaxOff \begin{document} Hello World! \end{document} I have TWO questions: Is the above the best practice(but I found a little cumbersome) to expand l3keys's macro in package option? more important focues in this post: In texdoc ctex, and sec14.2, it shows option zihao's l3keys config: \ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , } As the package author, it's common to predefine some macros like \myzihao to easily control the options(or reuse multiple times, and everywhere). However,in the original MWE's case, made some barriers to achieve this. So my second wuestion is: why l3keys in this case seemly didn't provide handy interface for key-values' expansion to be easily controlled? Edited(supplemented original situation): Actually, the original case is in BHCexam documentclass: . %Line 31-47(in cfr's answer and modification) \DeclareOption{fontset}{\renewcommand{\@fontset}{#1}\@fontsetspecifiedtrue} \DeclareOption{zihao}{\renewcommand{\@zihao}{#1}} \DeclareOption{linestretch}{\renewcommand{\@linestretch}{#1}} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax % Load required packages \LoadClass{article} % Conditional loading of ctex with fontset option \if@fontsetspecified \RequirePackage[fontset = \@fontset, punct=kaiming, zihao = \@zihao]{ctex} \else \RequirePackage[punct=kaiming, zihao = \@zihao]{ctex} \fi Actually it didn't have a good practice(which raise question here) to handle key-value pairs with \DeclareOptions (Thanks cfr!!)...

  • How can I continue a special enumerating after new section?
    by Moura on May 10, 2025 at 2:31 pm

    Thanks to @egreg (bellow) I had a great help. But unfortunately there is an alignment problem on the left margin and I would like it to be aligned. How could this be solved? \documentclass{article} \usepackage{enumitem} \usepackage{lipsum} \newlist{articles}{enumerate}{1} \setlist[articles]{label=Art.~\arabic*º,resume} \begin{document} \begin{lipsum} \end{lipsum} \begin{lipsum} \end{lipsum} \begin{articles} \item bla \item bla \item bla \item bla \item bla \item bla \item bla \item bla \item bla \item bla \end{articles} \noindent Some text \begin{articles} \item bla \end{articles} \end{document}

  • How do you specify column widths with longtable and revtex4-2?
    by nmaclaren on May 10, 2025 at 1:42 pm

    I am using longtable in a revtex4-2 document. This document compiled correctly before (i.e., fall of last year, before the most recent longtable update), but does not compile now. Using plain tabular with p{.} or longtable with {llll} still works (in that it compiles). Here is a MWE: \documentclass[pre, preprint]{revtex4-2} \usepackage{longtable, lipsum} \begin{document} \lipsum[1-2] % \begin{longtable}{llll} % longtable without column widths works \begin{longtable}{p{0.75in}p{0.5in}p{0.5in}p{3in}} % longtable with column widths doesn't work col1 & col2 & col3 & \lipsum[42]\\ col1 & col2 & col3 & \lipsum[42]\\ \end{longtable} % \begin{tabular}{p{0.75in}p{0.5in}p{0.5in}p{3in}} % tabular with column widths works % col1 & col2 & col3 & \lipsum[42]\\ % \end{tabular} \lipsum[3-4] \end{document} Using the above document code without revtex4-2 also works: \documentclass[12pt]{article} \usepackage[margin=1in]{geometry} \linespread{1.3} \usepackage{longtable, lipsum} \begin{document} \lipsum[1-2] \begin{longtable}{p{0.75in}p{0.5in}p{0.5in}p{3in}} col1 & col2 & col3 & \lipsum[42]\\ col1 & col2 & col3 & \lipsum[42]\\ \end{longtable} \lipsum[3-4] \end{document} Is there a better way to specify column widths with longtable in a revtex4-2 document?