Questions tagged [macros]
{macros} is for questions specifically concerning TeX's macro processor. Note that, because TeX uses macros ubiquitously, most questions about code that uses macros are not looking for information about how macros work, and so are not appropriate for this tag.
8,577 questions
0
votes
2
answers
17
views
Redefine `\item` so its first "argument" is a full word
I defined a Tikz macro and I want to use it so the item of an inline itemize is passed as its argument. So far, my solution is this:
\documentclass{article}
\usepackage[inline]{enumitem}
\usepackage{...
0
votes
1
answer
57
views
Tikz size change
With the help of AI I created the following:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning}
% Define colors extracted from the image
\...
3
votes
3
answers
107
views
Macro with mandatory argument in xint (xintexpr)
This is my first time using of xint.sty; therefore, I have a few questions:
(1) Is \NewDocumentCommand{\sn}{m}{ subsn(expr, var1=value1; var2=#1) } the correct way to define a macro with a mandatory ...
1
vote
2
answers
34
views
Issue interacting with mhchem (\ce) and align environment when fetching dynamic data via csnames / expl3
The Goal: I am building a chemistry database package (chemdata.sty) where chemical equations and properties are generated from a CSV file (via Python) and stored as control sequences using etoolbox's \...
2
votes
1
answer
44
views
How can I modify a personnal macro so that it behaves differently in the Beamer class and the Article class? [duplicate]
I wrote a macro \exo{} that automatically numbers the exercises in a worksheet or in an assessment (the option allows you to choose and display the grading rubric). It was corrected by @egreg here: ...
11
votes
5
answers
857
views
Primes in Latex
I want to create a command \isthisprime{<number>} where it decides whether <number> is or is not prime, and if it is, it also returns the order of the prime (eg, 2 is the first, 3 is the ...
1
vote
0
answers
50
views
Alignment of twoside book headers with images and passing dynamic content to variables
I am tasked with a very specific book design and have done this until now with Scribus but want to switch to LaTeX and try to get it done to learn it.
The design of the booklet is very specific, as it ...
4
votes
3
answers
603
views
Is there a tool that translates LaTeX written with user-defined commands into standard LaTeX?
I have a (far from ideal) collection of macros that I \include in the preambles of my documents. It's very useful in giving my documents uniform semantic representation. For example, contravariant ...
3
votes
0
answers
60
views
Create user copy of \if@partsw with \AtBeginDocument [duplicate]
I would like to create a user copy of the \if@partsw flag something like this
\documentclass{article}
\newif\ifPart
\AtBeginDocument{\makeatletter
\if@partsw
\Parttrue
\else
\Partfalse
\...
1
vote
0
answers
57
views
How to use datatooltk with DTLforeach after reading dbtex file using DTLread?
The following code works if I use \DTLread to read csv under name data, then save it as dbtex-3 using \DTLwrite, and finally read the .dbtex file under the name datafromdbtex. Then I can use it for ...
2
votes
1
answer
68
views
Forcing strict flush-left alignment in align* environments inside a minipage for algebra worksheet
Note: I attempted to mod the code in my OP by integrating Mr. Carlisle suggestions in the comments below. My implementation must be wrong because the render still results in the screenshot below.
I am ...
5
votes
7
answers
366
views
Define commands inside foreach loop
I'm trying to define commands inside a pgffor \foreach loop, where the command-names depend both on the a macroparameter and the loop parameters. However, I get "First argument of '\...
2
votes
2
answers
101
views
Hide all content before a certain point [duplicate]
Suppose I have a document containing text and mathematical formulas.
From a certain point onward, I would like everything written before that point not to be displayed in the compiled document, ...
0
votes
2
answers
64
views
How to use cslet with DTLforeach after reading dbtex file using DTLread?
The following code works until \DTLwrite. So, I am unable to get the \action to work. I understand there might be other ways of accomplishing this. My reason for using this approach is to speed up ...
2
votes
1
answer
57
views
How to implement a global nesting level counter for all tcolorboxes (including defined ones)?
I am trying to implement a counter (boxlevel) that automatically tracks and displays the nesting depth of my boxes.
I attempted to achieve this by redefining the standard tcolorbox environment to ...