Skip to main content

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.

1 vote
1 answer
135 views

Creating LaTeX Macros to Generate Tables from Predefined Variables

I've been struggling for the past two days to create macros for populating a thesis title page, as I'm planning to share it as a template with my colleagues. As you all know, thesis title pages have ...
Mycroft_47's user avatar
1 vote
1 answer
50 views

How to extend upon siunitx to list units?

I have made this trivial additional macro using siunitx called \qtyalt{} and \numalt{} that helps me add the separator "or" at the end of the list like so: \documentclass{article} \...
Miloop's user avatar
  • 978
1 vote
0 answers
43 views

Redefine commands, changing a catcode

Background I'm the author of the altsubsup package, which set to 12 (other) the catcode of the circumflex ^ char. As it, expressions as x''^2 raise a Double superscript error because the latex ...
jlab's user avatar
  • 3,986
-1 votes
1 answer
43 views

Include font size specification to a command

I would like to include the specification of the font size (\huge \large \normalsize) in the key-value specification. \documentclass[a4paper,12pt]{article} \ExplSyntaxOn \tl_new:N \l_hlov_tipoa_tl ...
Bulldrive's user avatar
  • 161
3 votes
2 answers
552 views

What's wrong with my new environment?

I'm trying to write this new environment, but produces this error when I use it: This is my code: \documentclass{article} \newcounter{questao} \newenvironment{questao}[1][]{ \ifx\relax#1\relax ...
Lenin de Castilhos's user avatar
3 votes
3 answers
95 views

How to create a conditional command depending on the number of argument (two or three)?

I defined a macro with variadic arguments as below, and it works fine. $\un{N}$ => [N] $\un{J}{s}$ => [J/s] \makeatletter \newcommand\un[1]{\@ifnextchar\bgroup{\un@double{#1}}{\un@single{#1}}} \...
Larynx's user avatar
  • 131
9 votes
3 answers
231 views

Newcommand with adaptive number of arguments

What I am looking for is a single newcommand, let's call it \wedges, with a variable number of inputs that yields in a flexible way the following result: I have already written the code for the ...
Freestyla's user avatar
  • 117
0 votes
1 answer
95 views

How can I change the form of coordinates of a point from the form (1, 2, 3) to the form (1; 2; 3)?

I have this picture. I tried \documentclass[12pt,a4paper]{article} \usepackage{amsmath} \begin{document} Let $ABC$ be a triangle with $A(1,2,3)$, $B(4,5,9)$, $(7,8,6)$. Coordinates ...
John Paul Peter's user avatar
1 vote
1 answer
29 views

label inside a newcommand doesn't work

I am defining a \newcommand to shorten a notation I use frequently. To comment reasonings during computations I put daggers over the equal sign where such reasoning is done and hyperref it to a ...
Freestyla's user avatar
  • 117
11 votes
1 answer
1k views

Why Donald E. Knuth used obeylines + gdef instead of def

I am trying to understand Knuth's manmac.tex. At line 436 you can find the following code: \newwrite\ans \immediate\openout\ans=answers % file for answers to exercises \outer\def\answer{\par\medbreak ...
Alexey Ismagilov's user avatar
2 votes
3 answers
101 views

Creating a command that returns colors

My need I want to create a command that returns a color depending on the value of the argument. My attempt I've tried the following but it does not work. The error is Argument of \XC@col@rlet has an ...
Colas's user avatar
  • 6,892
3 votes
1 answer
286 views

How to create a custom command (control sequence) with special characters in its name

I want to create a custom command (control sequence) whose name contains special characters (such as numbers, underscores _, or -). In order to better distinguish different commands, my code is as ...
Tommk's user avatar
  • 31
1 vote
2 answers
91 views

Macro copy, add/remove last token

Suppose I have a macro with only argument that has such a structure \def\foo#1{% {\textbf{#1}}{aaa}{bbb} } I need to create two copies: \bar that is \foo but withouot the last token: \...
antshar's user avatar
  • 4,652
0 votes
0 answers
22 views

How can i fix the error on " Error line 191! Missing number, treated as zero.< to be read again>\[email protected]|Idf@finish\currentoption"

I need help. My text in Miktex + texmaker end on line 40 but I get an "Error line 191! Missing number, treated as zero. \I@English. 1.191\Idf@finish\currentOption". please help me to fix ...
George Darius Ocen's user avatar
2 votes
1 answer
84 views

Print macro in \addplot node label

I use a foreach loop to plot multiple curves via the \addplot command. The values that are necessary to define the relevant curve in each iteration are defined through some macros with the command \...
Laura Roich's user avatar

15 30 50 per page