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,303
questions
26
votes
11
answers
8k
views
Storing an array of strings in a command
I want to store three strings in a variable \mydata like the following:
\storedata\mydata{one}{two}{three}
Then I want to extract the first/second/third string in the following way:
\getdata[1]\...
1
vote
0
answers
21
views
Using \ifthenelse and \isempty in newcommand used in glossaries's name
I want to use \ifthenelse while defining symbols with \newcommand. This works all fine, until I try to use those symbols (here \densCanv) in my glossary as a name:
\documentclass[a4paper,10pt]{article}...
0
votes
1
answer
148
views
Printing labels into file to support editor
I am using the following command to define a custom counter for different things I refer later in the document.
\usepackage{cleveref}
\newcommand{\customcounter}[2]{%
\newcounter{#1} \setcounter{#...
2
votes
2
answers
130
views
Build a new command "newsymbol" with NewDocumentCommand
I want to create a new command \newsymbol, which functions like \newcommand, but with the difference that math is ensured. I also have another reason, why I want to define this new command, namely so ...
1
vote
1
answer
460
views
Gnuplottex: Pass latex command to gnuplot script
I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position ...
0
votes
2
answers
33
views
Command doesn't show put after a new line
I used \newcommand to make a label and then label it.
\documentclass[12pt]{article}
\makeatletter
\newcommand{\createlabel}[2]{%
\@bsphack
\expandafter\edef\csname #1\endcsname{#2}\@...
5
votes
1
answer
2k
views
Insert code snippet via keyboard shortcut in TeXworks
I know there already are questions (1, 2) on creating keyboard shortcuts in TeXworks. The discussion (also in the Google thread referred to), however, seems a little outdated.
By now, there is the ...
0
votes
2
answers
138
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 \...
4
votes
1
answer
59
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 ...
6
votes
2
answers
2k
views
Define commands without the need for brackets
Not sure whether the standard actually allows this, but at least in my LaTeX installation (TeX Live 2019/Debian), I can write for instance $\sqrt\frac12$ instead of $\sqrt{\frac{1}{2}}$. However, this ...
2
votes
3
answers
146
views
Construct math super/sub-script from reference (`\ref`) with hyperref and cleveref being loaded
First, I would like to apologize for the insanely long MWE below. However, I wanted to keep it complete.
At the bottom line I want to achieve a construction like $H^{\ref*{my-label}}_{\ref*{another-...
15
votes
2
answers
3k
views
Problem with environment expansion and the Tikz external library.
I've created my own environment mytikz, which basically looks like this (full MWE):
\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{external}
\newenvironment{mytikz}{%begin code
...
1
vote
1
answer
100
views
pgfplotstabletypeset in a custom command for CSV parsing
I created a dynamic table in order to cast inline CSV data easily to a table and want to use it now as a custom command, in order to make the table command easy to use for my colleagues.
This first ...
198
votes
6
answers
58k
views
What exactly do \csname and \endcsname do?
What exactly do \csname and \endcsname do? What are their job?
I have glanced at the Texbook and some other books, but none of them was clear enough to me.
Can anyone please give a simple example to ...
0
votes
1
answer
683
views
Creating colorlinks on author AND year with biblatex using the apa style
I am writing a MSc thesis in LaTeX and I would like to use a formatting style that comes close to that of published academic journal articles. This is my first big LaTeX project and I have only ...