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,301
questions
3
votes
1
answer
46
views
\IfBlankF in \NewDocumentCommand removes content leading up to argument
I'm trying to define a command with \NewDocumentCommand that create a subsection with a given name (mandatory) and optionally some descriptive paragraph. Since I don't want these paragraph to be ...
0
votes
1
answer
23
views
commands within \subimport
Using a command within subimport leads to problems.
Consider the following files, which have to lay side-by-side in the same folder. test.tex:
\documentclass[]{letter}
\usepackage{import}
\def\AV{510}...
0
votes
2
answers
120
views
design a \Command that allows a Dual-parameter \Command passing its return into another \Command as one (which might be a label) of its inputs
Design: a (La)TeX command (maybe look like this \passresult{\outercommand}{\innercommand}{param1}{param2}),
which pass the return of a dual-parameter \innercommand{param1}{param2} into another \...
1
vote
2
answers
110
views
Nesting two environments
The snippet below has been obtained nesting two environments taken from amsthm and tcolorbox.
I would like to redefine the environment theorem to produce the same output (I can only modify the ...
1
vote
1
answer
44
views
How to make own title of the part of text?
I'm trying to create titles for pieces of text that won't appear as the last element at the bottom of the page. I haven't been able to find a method to prevent page breaks directly below the title. ...
6
votes
3
answers
485
views
Creating a command to display blackboard font
I am relatively new to LaTeX and I want to know whether there is a way to create a command such that it takes whatever capital letter the command is and prints the blackboard font. Here's what I mean: ...
5
votes
2
answers
254
views
Expand a `.cs` defined by key inside the function
I have a prop list in which I save items using the \addtoprop
command and then loop through the prop list and print it with the
\foreachinprop command. The \foreachinprop command has several
keys, but ...
0
votes
2
answers
69
views
How to check if command received a command as argument
I tried to use ifdef command for that, but it doesn't work. It outputs text when it's passed and executes the true branch.
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\...
1
vote
1
answer
65
views
How does one fully expand a macro between \csname and \encsname?
The best way to ask this question is to present two MWEs, one of which works and one of which does not. Naturally, I would like to get this into the second form, but I am at a loss as to what is ...
1
vote
1
answer
50
views
Expanding Variables to Input as Arguments for Macro
I have an issue when trying to use variables in a command (\ResearchModule). I read up to 8 lines from a text file and have them set to elements of an array (using code thanks to egreg!), with \...
2
votes
4
answers
160
views
How to modify overlay specifications in a new command in LaTeX Beamer?
I would like to modify the overlay specification that is passed to a custom command, but for some reason, < and > are interpreted as ¡ and ¿ when they are included in a new command.
MWE:
\...
4
votes
2
answers
155
views
Confused about optional argument with \NewDocumentCommand result
Given this MWE:
\documentclass[12pt]{report}
\usepackage{fontspec}
\setlength{\parindent}{0pt}
\NewDocumentCommand{\testone}{m m m }{%
\if\relax\detokenize{#2}\relax
\textbf{#1}\dotfill#3\...
2
votes
2
answers
143
views
Memory usage of new commands requiring several intermediate commands
The following command
\newcommand{\PDef}{\mathcal{P}_{\operatorname{Def}}}
can be defined, alternatively, by iterating several new commands:
\newcommand{\CP}{\mathcal{P}}
\newcommand{\PDef}{\CP_{\...
0
votes
0
answers
53
views
Rules upon % at end of line [duplicate]
When writing macros, the trailing comment character is used to ignore the rest of the input line, suppressing spaces, and the end of line character that is appended gets ignored too.
Which aspects of ...
1
vote
2
answers
44
views
Can I change the effect of a command depending on the environment in which it's invoked?
I need a user-defined command to behave differently depending on whether it's invoked inside a \begin{quotation} environment or not. Is that possible? I don't know where to start!