{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.

learn more… | top users | synonyms (4)

3
votes
1answer
78 views

Where is \printtoctitle defined?

I can use \show\printtoctitle to get its definition, > \printtoctitle=macro: #1->\printchaptertitle {#1}. l.5 \show\printtoctitle but grepping for it through my latex installation I don't ...
4
votes
2answers
98 views

macro help with $\mathbb{Z}/p^{a}\mathbb{Z}$

I am using \mathbb{Z}/p^{a}\mathbb{Z} many times in my work with variable a, I was thinking can I define a macro like \Z_p^{a} which will give the above result. I tried ...
13
votes
1answer
229 views

How to show keys (ctrl, alt, …, etc.) as fancy as StackOverflow? [duplicate]

In StackOverflow, I can show keys like this: ctrl + alt. How to do the same things in LaTeX?
1
vote
1answer
66 views

TexStudio: Multiple Cursors in Macro

however looking up my questions using the usual suspects (Google, search function etc.) I could not find an answer/solution to the following task (potentially I don't know the proper name of the task ...
5
votes
2answers
108 views

Tikz: Latex macros in draw to [in=,out=] and point coordinates

I want to use latex macros in the calculation of the coordinates in a \draw command but that seems not to be possible if both the target point coordinates and [in=...,out=...] instructions involve ...
1
vote
0answers
52 views

Macro passing problem with pgfmath

As a continuation of thread 2010/2014 versions difference: I am trying to decorate program listings with highlighted lines, numbered balls, etc. In 2010, I used a macro which does not work any more ...
2
votes
1answer
29 views

How can I pass variables to \renewcommand from within another command (\DeclareRobustCommand)?

Situation I need to set a few commands and variables based on what language a document is written in. To do this, I pass an ISO 639-1 language code to a command ...
0
votes
1answer
26 views

Names on certificates [duplicate]

I have to make some certificates. The main problem is not the certificate itself but to change names between pages. Can I create a list of names, each of appears once for page?
12
votes
6answers
663 views

command for writing a sequence of numbers

While writing a document with many sequences of numbers (and various lower and upper boundaries), I would like to define a command such as \myscale{1}{6} that would produce: 1 2 3 4 5 6 What ...
1
vote
0answers
51 views

Package xthesis [closed]

\usepackage{xthesis} error messages: command\properpagestyle already defined. ...yle{myheadings}\markboth{}{}\markright{}} command\dedication already defined.{\vfill\end{center}} This errors ...
2
votes
1answer
53 views

CurVe document class: Adjust spaces between entries cross rubric or inside certain rubric without \vspace

I am using CurVe document class to create my CV. I want to know if there is anyway to adjust the spaces between the entries (\entry*[...]...) as indicated by the Figure 1. I know I can always put ...
2
votes
1answer
40 views

Textual replacement macros to wrap environment

I want to create simple textual replacement macros for an environment: \def \myEnvStart {\begin{someEnvironment}[enormous list of arguments]} \def \myEnvEnd {\end{someEnvironment}} This doesn't ...
7
votes
1answer
112 views

Macro for pgfplots/gnuplot exponential regression line

I am trying to create a series of plots with exponential regression that are automatically generated from comma/tab separated .csv files and pgfplots with help from gnuplot. When not using macros I ...
4
votes
1answer
68 views

How to control conditional statements within new commands and environments

I'm writing a pretty complicated class to typeset a book based on memoir. One of my commands draws a caption on the preceding verso page, draws content on the following recto and verso pages, and ...
6
votes
3answers
113 views

substitution problem with plain tex

Can anyone please tell me what I did wrong?? I cann't get the second number of tests to work correctly (and the command appears to be the same argument as done manually) \magnification\magstep1 ...
5
votes
1answer
85 views

Repeat geometry / body / object / shape in PGFplots

I depicted a pentahedron by means of the code \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset { plotOptsA/.style={surf,patch,patch type=triangle,shader=faceted interp}, ...
2
votes
1answer
31 views

\pgfplotstablegetelem in \section does not work

I read in some dates with \pgfplotstableread and want to use this dates. The idea is, I want to be able to change its values without having to change my LaTeX code. The following MWE will not compile ...
0
votes
0answers
35 views

Text tool to expand TeX macros [duplicate]

a few months ago I heard of a tool für TeX but I can't find it, so I want to ask you whether you know what tool am I talking about. The function is: Say you have some own macros like ...
2
votes
1answer
34 views

How to define a numeric variable?

Following the Latex wiki page I tried \newcommand and \DeclareRobustCommand: \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \newcommand{\marginProportion}{0.76} ...
0
votes
1answer
44 views

\textbf does not work insine \newcommand [duplicate]

I'm trying to make a new command, to add autoincrementing numbers to the definitions throughout my thesis. Here's what I have. \newcounter{DefCounter} \setcounter{DefCounter}{0} ...
3
votes
2answers
54 views

new command for nested enumerate with variable arguments

I have some text that I want to turn into a template which looks like this: Extensions: \begin{enumerate} \item[2.a] xyz \begin{enumerate}[i.] \item a \item b ...
5
votes
2answers
128 views

How can I define a macro, so that is does not have to be preceded by \protect in headings, captions etc.?

I tried to define a macro myself, which outputs different strings according to the input variable (like select-case statements in other programming languages). The problem: If I use the code in ...
5
votes
1answer
100 views

LuaTeX: How to handle a Lua function that prints TeX macros

Let's say that I have a Lua function that prints TeX macros: How can those macros be executed during compilation with LuaLaTeX? In the following example, I defined a LaTeX macro that should print a ...
2
votes
1answer
102 views

How can I know if I am inside an equation environment if it's nested with others?

I wanted to define some partial derivative commands that would be \partial y/\partial x if it was inside an inline equation and would use \frac{\partial y}{\partial x} if inside an equation ...
3
votes
1answer
76 views

How to avoid typesetting any cell if a table is empty

Following How can I define a macro that adds a row to a table that has not yet been printed?, I came up with a macro (\AddToTable) that “builds” a table, i.e. appends its argument as the last row of ...
0
votes
0answers
14 views

How to disable a self-made command [duplicate]

Is there a way to disable a self-made command? I thought of the following: %!TEX TS-program = lualatex \documentclass{scrbook} \DeclareRobustCommand{\mycommand}[1]% % {\textbf{#1}} ...
8
votes
7answers
300 views

How to define optional second argument for macro?

I've defined a command which lets me quickly reference to the number (of figure or table) AND page at the same time: Command \newcommand{\kplref}[2]{~\ref{#1}, S.~\pageref{#1}{#2}\xspace} The ...
11
votes
5answers
468 views

Basics of scanning

I'm trying to master the art of scanning text one character at a time. The following is what I've discovered so far. Is this as good as it gets? I would really prefer not to do all those \edefs as ...
6
votes
2answers
96 views

Suffixed macro and uppercase

when I declare a macro with suffix, its use inside a \uppercase commands doesn't work. See the MWE \documenclass{article} \usepackage{suffix} \begin{document} \newcommand{\AcCan}{\emph{Actes des ...
0
votes
0answers
66 views

Customize index with section name, not page number

I would like to build an index where instead of a reference to a page number, I would have a reference to the section name of the term. So this is what I did (but which doesn't work) : ...
17
votes
3answers
1k views

What is the purpose of hash (#) as a special character sign?

I understand the purpose of all special characters, $, &, %, _, {, }, ^, ~, and \, but just except for hash (#). When and why should it be used?
1
vote
1answer
26 views

How to fix the spaces of superscript text

I'm trying to typeset an old bible which has all the verses superscripted. I created a command that produces a superscript number corresponding to the verse number, and then this is increased by one. ...
5
votes
6answers
166 views

loop and char &

I can't find the problem in this code \documentclass{article} \newcount\mt \newcount\mtt \newcommand{\mttab}[2]{% \mt=0 \loop \advance\mt by 1 \mtt=1 {\loop ...
4
votes
2answers
77 views

How to create a custom environment with a listing inside it?

Well consider the following code: \documentclass[a4, oneside,openleft]{book} \usepackage{listings} \begin{document} \begin{flushright}\begin{minipage}{0.9\textwidth}\begin{lstlisting} for (i) { ...
1
vote
0answers
37 views

How to define a simple command for “mark” in an exam paper?

Here is the link for a .cls file. http://phyweb.phys.soton.ac.uk/ugadmin/Staff%20forms/EXAM%20TEMPLATES/su-exam.cls But all I want, is to be able to use \mark. And being able to get a simple total ...
6
votes
3answers
269 views

Parse argument with a number and an optional letter

How to define a macro which takes a string made by number and an optional letter and then branches on the basis on the letter? Since this is an extension of an existing package, it is preferable not ...
1
vote
3answers
72 views

How to add a framed box inside a paragraph?

I'm using little markers in some parts of my text and I wanted to add one of those to a paragraph entitling a list: \newcommand{\hip}{{\color{BlueViolet}\framebox[1.1\width]{HIP}}} ...
17
votes
4answers
803 views

On/Off switch (redefine a macro at each use)

I try do define a macro \onoff, which alternatively prints "on" and "off" each time it's used. For example the sequence \onoff \onoff \onoff would print on off on My first guess would be to use the ...
0
votes
0answers
71 views

TeXstudio does not auto-complete newcommands

I've just updated my TeXstudio to version 2.9. Unfortunately, this was kinda destructive to my ability to efficiently use it. I have a project with file main.tex which then calls (using input{}) ...
14
votes
3answers
259 views

Creating a newcommand with indefinite arguments

I am kind of new to LaTeX. I am doing project which contain resources (formula, solutions to problems, e.g.) i can bring to the Exams day on 16th March. I have been looking for a solution to my ...
1
vote
1answer
58 views

How to get pgfgantt today to be set to the \today macro

I want the pgfgantt chart to automatically update the "today" line so that it always shows \today when compiled. The problem is that though I am using time slot format=isodate and have set the ...
3
votes
1answer
60 views

Dynamic length variable with argument? (like “\setlength{\foo}[1]{0.5+#1*0.5}”)

Is there a way to define some kind of a length function that takes an argument, sort of a mixture between \newcommand and \setlength? The following example should illustrate what I want. (I'm using a ...
8
votes
1answer
71 views

Using \ifdefined on \csname macros

I've run into this issue several times now, and have just worked around it in other ways. But it would be simpler just to know how to do it properly. I would like to use \ifdefined in the context of ...
7
votes
1answer
199 views

Understanding how a TOC is generated

I'm trying to understand, in some detail, how a toc is generated. But now I'm thoroughly confused and perplexed after examining the .toc file before and after making a ``slight'' modification. I hope ...
5
votes
1answer
76 views

How to write custom configuration for TeX4ht

I have some macros in my document, and I want to create my own HTML for there. I follow this blog entry but I can't to make it work. I put this code before my \begin{document}: ...
1
vote
0answers
33 views

pgfplots(table) protect ##1 when in a `\newcommand` with optional arguments

I am using the excellent answer from @percusse to the question How to rotate head row cell entries of pgfplotstable which works great if you always want rotated headers. I am calling ...
3
votes
1answer
42 views

Table of Contents labels not directing hyperlinks to correct page

Being only a LaTeX novice I may have introduced a bit of customizing code renewing part formats and adjusting numberings which may have messed up the ability for hyper-references accuracy in heading ...
5
votes
2answers
38 views

latex tokens reader breaks on \iffalse

everyone, I've found a very strange behavior of latex \iffalse with \newcommand\NAT@parse... inside of it (\NAT@parse taken directly from natbib). If I add that macro in style, then latex breaks with ...
2
votes
1answer
38 views

What does \csappto does and where does it come from?

What does the macro \csappto do, exactly? I've seen it in multiple code snippets throughout the website and on the internet in general, but I've never seen an explanation of what it does. I've looked ...
1
vote
1answer
89 views

Latex Macros: Local Variables and Path Names

I initially have a group of TeX codes that looks like so: paper.tex assignment.tex Where paper.tex is the main TeX and takes in the assignment.tex file and adds it in there. The assignment.tex is ...