# Tag Info

### Recursively update macro

You are doing full expansion (\xdef) of previous macro declated by \update but \underbrace is more complicated macro which uses \halign with # in its preamble and this cannot be fully expanded without ...
• 53.4k

### Recursively update macro

underbrace is a robust command protected by LaTeX's \protect mechanism. For the mechanism to work properly you need the protected@ functions. \documentclass{article} \begin{document} \def\temp{} \...
• 2,071

### How do I create macros that take + (plus) or - (minus) separated arguments as inputs and stores them to variables (e.g., coefficients of polynomials)?

You can read numbers to registers \coefnum and \expnum and run next macro using \afterassignment. \newcount\coefnum \newcount\expnum \def\polycoeff#1{\polyA#1\relax} \def\polyA{\afterassignment\...
• 53.4k
1 vote

### Math Symbols Palette?

Check out: https://www.caam.rice.edu/~heinken/latex/symbols.pdf This is a pdf document listing all mathematical symbols with Latex coding. Nice document to have for reference.

### Doing an interlinear text

Using expl3 - a demonstration The same Greek text, three times, can keep things in sync. First line, each word is looked up as a key in a property list to find the Strong reference number as value, ...
• 7,344

### escape hashs (#) passed as argument to use them in inner macro

In this specific case there are some "workarounds": In case you can tolerate some "global namespace pollution" you can do this \documentclass{article} \usepackage{xcolor} \begin{...
• 2,071

### How to use new line command while using multicolumn in tabular?

Like this? With talltblr defined by the tabularray package: \documentclass{article} \usepackage{tabularray} \begin{document} \begin{talltblr}[ caption = {Overview of statistic. Diff.: Differened}, ...
• 255k

### TikZ \foreach loop with macro-defined list

Starting with version 3.1.7 (November 2020), TikZ supports the expand list option for \foreach. From the TikZ & PGF manual: /pgf/foreach/expand list={<boolean>} (default false) If this key ...
• 2,914

### Using \Makelowercase in includegraphics

In case \includegraphics' optional argument contains things that shall not be lowercased and/or some component of the filename shall not be lowercased, you can use a macro for composing the call to \...
• 23.4k
1 vote

### escape hashs (#) passed as argument to use them in inner macro

For comparison: what we need to do in OpTeX: \fontfam[lm] \def\Foodeclared{} \optdef\DeclareFoo[]{\ea\def \ea\Foodeclared \ea{\the\opt}} \optdef\Foo[]#1{{\em \Foodeclared \the\opt #1}} \DeclareFoo ...
• 53.4k

### Using \Makelowercase in includegraphics

The \Makelowercase LaTeX macro uses \lowercase TeX primitive and this command cannot be used as an argument denoting file name. This argument is only expanded but commands like \lowercase cannot be ...
• 53.4k

### Using \Makelowercase in includegraphics

I'm very sorry, I can't solve your problem very elegantly, I think the following code should make your project work： \ExplSyntaxOn \cs_set_eq:NN \Lowercase \str_lowercase:n \ExplSyntaxOff \newcommand{\...
• 875

### Understanding the code and trying to learn

Two more examples: \documentclass[10pt,a4paper]{article} \usepackage{tikz} \usetikzlibrary{calc,snakes} \usetikzlibrary{ decorations.markings} \begin{document} \begin{tikzpicture}[scale=.6] ...
• 2,822

### Understanding the code and trying to learn

Another pedagogical (I hope) example: \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=1.5] % rotate (six time) a square around hi center ...
• 2,822
1 vote
Accepted

### Include PDF with section title only on first page

Just test the number of pages in the PDF first (cf. this question). \newcommand{\insertScore}[3] {% \pdfximage{#1/score.pdf}% \addcontentsline{toc}{section}{#2}% \includepdf[scale=0.8,pages=1,...
• 12.7k
1 vote
Accepted

• 21.7k
1 vote

### Declare new command to denote the condition with additional settings

Here is a solution via my own, slightly non-standard package, SemanTeX. I took the liberty to change the order and meaning of some arguments and keys in a way that made the implementation easier: \...
• 11k
1 vote
Accepted

### Using a CSV File to Drive Custom Macro

In your definition of \checkboxYesNo you find the line \str_if_in:eeTF { \str_foldcase:n { #2 } } { \str_foldcase:n { #1 } }. My guess is that \str_if_in:eeTF triggers expansion of \str_foldcase:n ...
• 23.4k

### Call specific Command in combination with argument in Latex

If your LaTeX installation is up to date (2022-06-01 version) you can do \newcommand{\SomeCommand}[3]{\UseName{Hello#1} \UseName{Hello#2} \UseName{Hello#3}}
• 315
1 vote

### Call specific Command in combination with argument in Latex

I'd do it with property lists. You can define a property list based on an arbitrary name, in the example Hello and populate it. Then you can extract the items by key. \documentclass{article} \...
• 992k
Accepted

### What is \mathopen{} for?

Some people write ]-1,1[ to denote the open interval from -1 to 1. The default TeX math status of the characters [ and ] is mathopen and mathclose, respectively. To properly typeset the open interval ...
• 439k
1 vote
Accepted

### Regarding the separation line in the expression of sets

This is a proof of concept. You may want to use TikZ for a better dashed or dotted line, but the idea is the same: measure the height plus depth of \delimsize\vert. \documentclass{article} \usepackage{...
• 992k

### Misplaced \omit and \multicolumn in \IfEqCase

For information, if you use {NiceTabular} of nicematrix, with its built-in command \Block instead of \multicolumn, you have directly the output you wish (because \Block is a protected command which ...
• 25.4k
Accepted

### Remove Whitespace After a Macro

You could replace \NewDocumentCommand{\programName}{m}{% \textbf{#1} program } with \NewDocumentCommand{\programName}{m}{% \textbf{#1} program} If you don't want to move the closing curly ...
• 439k
1 vote
Accepted

### Create a version of a theorem whose environment name is capitalised

I'm not sure what would the usage of this would be: having two environments defi and Defi that do exactly the same is useless and possibly confusing. Anyway, you can use \text_titlecase:n (with a ...
• 992k
1 vote

### Create a version of a theorem whose environment name is capitalised

You can use the TeX primitive \uppercase directly, but this is still not expandable, so we have to trick a bit. \createTheorem@a is used to get the first character, and calls \createTheorem@b after ...
• 48.9k
1 vote

### Create a version of a theorem whose environment name is capitalised

As mentioned above, MakeUppercase is not expandable. You can use expl3 functions str_uppercase:f instead which is expandable: %! TEX program = lualatex \documentclass{article} \usepackage{amsmath} \...
• 2,071
Accepted

### Is there an equivalent of "AtBeginSection" for appendix?

Turns out, as John suggested in his comment, this is very easy to do by redefining \appendix! I did not add a hook, as I have trouble getting \write\@auxout to work, and instead simply made the ...
1 vote

### From \newcommand to \NewDocumentCommand

• 7,344
Accepted

### From \newcommand to \NewDocumentCommand

If you would like to simplify it, you can define a common macro for each four persons because there is the same format commands for each person. % def characters \def\declname#1#2{% \def#1{\...
• 53.4k
Accepted

### \NewDocumentCommand not working in pgfplots when \newcommand does

pgfplots does one-step expansion when it encounters a control sequence in <coordinates list> from input \addplot ... coordinates {<coordinates list>}, see \pgfplots@foreach@plot@coord@...
• 21.7k

### \NewDocumentCommand not working in pgfplots when \newcommand does

\NewDocumentCommand defines \protected macros. As such, they aren't expanded inside \edef, \write, etc. The macros defined by \NewExpandableDocumentCommand don't have this property, so it is a natural ...
• 22.7k
1 vote

### How to make an environment for a tikz nodes content

You can not nest tikzpictures — dragons will be there. But if you have a new enough latex, you can "grab" the whole environment using the +b type of parameter, and you can nest a tikzpicture ...
• 30.1k

### How to make an environment for a tikz nodes content

Nested tikzpictures are unsupported and unneeded here, as far as I understand the goal. You can use \bgroup and \egroup to avoid the brace-balancing issue. \documentclass{article} \usepackage{graphicx}...
• 22.7k
1 vote

### How to make an environment for a tikz nodes content

The environ package has a \BODY macro that contains what you have fed to the environment. If I have understood your wishes correctly I think that this could work for you. :) \documentclass{article} \...

### How to check if figures are on the same page of call out/text?

OpTeX users can create following definition of the \check macro: \def\check{\label[x/\_lastreflabel]\wlabel{}% \space \ea\ifx\csname _pgref:x/\_lastreflabel\ea\endcsname \csname ...
• 53.4k
Accepted

### How to make \NewDocumentCommand respect spaces and paragraphs?

Spaces and endlines have always been a problem in TeX programming. When starting to develop a new programming style for LaTeX, namely expl3, the team decided to provide tools for controlling ...
• 992k

### How to implement token.get_char

If you are using \directlua (i.e. no external .lua file) then you can get the value from TeX world to the Lua world by expanding it inside the Lua code, because \directlua expands its argument before ...
• 53.4k
Accepted

### Define new command for split environment

The following is copy-and-pasted from technotes.tex in the amsmath distribution 6 Why can’t I use abbreviations for \begin{align} . . . \end{align}? Authors often like to use abbreviations such as \...
• 19.9k

### Define new command for split environment

• 1,735