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

1
vote
0answers
14 views

How to change font type faces in table row? [duplicate]

Is possible to change font faces in whole row on similar way as it is possible for columns? \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{>{\bfseries}c ...
1
vote
3answers
75 views

Set custom commands

Very often I have to write \text{im}(f), to denote the image of f, if I try to write, \im f, then it generates the Imaginary notation which I do not want, if I write im f then it looks awful. Is there ...
10
votes
1answer
154 views

\newcommand and its intricacies

I recently came across the following command: \newcommand{\minitab}[2][c]{\begin{tabular}{#1}#2\end{tabular}} Well, this is close to the syntax laid out on p.845 of TLC, but I still don't ...
3
votes
3answers
161 views

How to use args of macro as part of function's name? like \foo#1bar -> \fooargbar

How to call the function using macro arguement #1 as a part of name of that function? It is analogue of #define in C++. The code will describe you the simple idea: \newsavebox\QAAAX ...
5
votes
2answers
180 views

Capacity exceeded while implementing lookup table

I'd like to implement simple key-value lookup table. I wanted to do it in functional fashion, so I've defined initial state of such table as get function causing error (as table is initially empty). ...
1
vote
1answer
62 views

Redefine \LaTeX command

From How can I see the "implementation" of the \LaTeX command? and How to write (La)TeX (with parentheses) [or any other TeX-related logo], I learn that \LaTeX is implemented as L\kern ...
0
votes
0answers
32 views

how do i change letter in address from capital letter to normal letter in amsart

I want to a form as following: title^* author^1**, author^2*** and author^3**** ^1 adreess of author1 (normal letter not capital letter) ^2 adreess of author2 ^3 adreess of author3 abstract keyword ...
1
vote
1answer
70 views

“Good” command names for typesetting matrices and vectors

I usually add \newcommand{\M}[1]{\bm{#1}} % Matrix \newcommand{\V}[1]{\boldsymbol{\mathbf{#1}}} % Vector to my preambles. Short command names because I use them very often. Is ...
0
votes
0answers
22 views

beamerarticle and minor problems with caption

I have a major and some minor problems with the MWE below. The major one: when I uncomment \usepackage{beamerarticle}, my macro definition starts to contain some extra '}', probably some macro ...
3
votes
2answers
45 views

Redefining `interval` to always be scaled

I already tried something like this: \let\oldinterval\interval \renewcommand{\interval}[2]{\oldinterval[scaled]{#1}{#2}} The problem is that I can't use \interval[open] anymore. Is there anyway to ...
7
votes
1answer
37 views

What's the most plain way to define a parametrized macro within an outer macro definition

I often want to pass some arguments into a macro definition that defines an inner macro with parameters. For example \def\outmac #1,#2.{% \def\argone{#1} \def\argtwo{#2} \def\inmac ...
6
votes
2answers
185 views

Replace digits by arbitrary symbols

I want to write some macro that replaces all digits in its argument by previously defined symbols or macros. I envision something like \overrideDigits{1234567890} which should expand to something ...
1
vote
0answers
8 views

Namespace for theorems [duplicate]

I want to make a theorem \newtheorem*{def}{Definition}. This doesn't compile because \def is already defined. How do I make amsthm use a different namespace for theorems? It doesn't make sense for a ...
1
vote
1answer
56 views

Putting a \newcommand in a tabularx

I have two command I have created with \newcommand, both work find. One is \mydate{date_variable} the other is \PrintOne{Variable1}{Variable2}. My problem is I can not figure out how I can put them ...
28
votes
1answer
615 views

What does “expanding” mean in (La)TeX?

You can often read about expanding a macro or when a macro does expand, sometimes about expansion. But what does this mean - in English?
3
votes
2answers
69 views

Applying MakeUppercase to non-English characters in math mode

I have some macros to distinguish between two varieties of similar objects. So, for example, I need \psi to come out as expected, but \MakeUppercase{\psi} to come out as \Psi. (Obviously my real ...
5
votes
2answers
147 views

New environment, orphan line

I created three environments for my document: a booklet for a treasure hunt with scrreprt. I created 3 environments (the document is in french): enigma: ...
1
vote
1answer
38 views

How to create multiple dotted lines

I want to create multiple dotted lines, I found this code on the internet \newcommand{\Pointilles}[1][3]{% \multido{}{#1}{\makebox[\linewidth]{\dotfill}\\[\parskip]} } The problem ...
3
votes
3answers
341 views

Can I use (LaTeX?) packages from CTAN in plain TeX?

I have the following assumptions: TeX is a kind of language Plain TeX is the original environment for this language LaTeX (and other environments) is a set of compiled macros written using TeX ...
3
votes
3answers
66 views

Saving counters

Consider the situation: Two authors A,B (in fact, it will be four) inserting comments on a tex file. Each author has his own command \alertA and \alertB to insert comments. Each author should has ...
1
vote
0answers
27 views

Passing background color to \lstinputlisting

In question Passing parameter in presence of an xkeyval value I received two ideas for dealing with passing an option to a macro. Namely, \expandafter\lstset\expandafter{\ME@options} and ...
5
votes
2answers
66 views

Using later defined macro values

Is there a way to get something like \test \newcommand{\test}{Print me!} to work in the same manner as \newcommand{\test}{Print me!} \test would work? Basically I'm wondering if I can set a ...
1
vote
1answer
48 views

Generating a list with macros using tasks package

I cannot figure out how to generate a list with the tasks package using macros. If you swap the three identified lines in the MWE below, you should get the following error message: \begin{tasks} on ...
3
votes
1answer
76 views

How to define a command that defines another command?

I have a command defined with xparse that looks like this: \NewDocumentCommand{\ME}{sogd<>}{\added[id=ME,remark={#1}]{#2}} (for the full code see Passing complicated argument patterns to a ...
16
votes
3answers
290 views

The meaning of \@@

A couple of times in the latex.ltx kernel, the macro \@@ is used. For instance in the definition of \@next (l.6222): \def\@next#1#2#3#4{\ifx#2\@empty #4\else \expandafter\@xnext #2\@@#1#2#3\fi} ...
8
votes
0answers
119 views

What type of Chomsky hierarchy is TeX?

There are four types of chomsky hierarchy (specified for formal languages): Type-0 Recursively enumerable Type-1 Context-sensitive Type-2 Context-free Type-3 Regular I consider that, it should ...
2
votes
1answer
58 views

Include LaTeX commands from external file in asymptote file

I have many asymptote drawings in a .asy file whose generated pdf is included in a main.tex. I have many user-defined commands, like \vec or \vxi which I use in my current main.tex and I want to use ...
1
vote
1answer
33 views

auto-completion of \eqref

All references are marked with eq -> equation tab -> table fig -> figure app -> appendix sec -> section chp -> chapter So a reference would look like \label{eq:NT_LoM} \label{sec:intro} for ...
0
votes
0answers
37 views

How to enable forward search in winedt macro?

I use winedt to edit tex, and xelatex to compile. It works fine for a long time. But for some unknow reasons, I recently found that winedt often get stuck when I click the xelatex compilation button. ...
1
vote
1answer
57 views

Fixing a class file

This may be a problem with too narrow an audience for this forum, but I'm rather stuck at the moment. I'm attempting to build my dissertation document. My school's style guide is decidedly ...
18
votes
2answers
269 views

How can I improve my “hands-on”/ “working” knowledge of TeX's low/middle/high/higher -level control sequences?

I am not an experienced TeX/LaTeX user. I know just about enough to write my thesis. As my interest grows, I'd like to continue improving on my TeX/LaTeX knowledge, more specifically, my "working" ...
3
votes
2answers
32 views

Passing parameter in presence of an xkeyval value

I still have some problems with parameter passing in my macros. The MWE below, compiles and runs fine. If you uncomment wide, it mismatches \begin{figure*} with \end{figure}. However, this error goes ...
4
votes
1answer
12 views

Using bytefield as parameter to self-defined macro raises error

I defined a simple LaTeX macro \bansen which takes a single argument: \newcommand{\bansen}[1]{#1} Unfortunately, I noticed that I can not use a bytefield environment as a parameter for this macro ...
0
votes
1answer
24 views

use of “chemmacros” package give errors when define a newcommand

I am using chemmacros package to write chemical symbols in my thesis. (I am using Easy Thesis template with book class). I added these packages (as below) at the top of thesis.cls file ...
1
vote
2answers
71 views

How to use color declarations in titles?

How can I use color declarations when setting the title of a document? I tried \title{\color{blue} Colors in typesetting} but I get an error from LaTeX. Update: The error reads as followed: ...
1
vote
3answers
77 views

Argument name in a macro in another

I want to define a macro (I've simplifyed for posting a clean code) in a macro which name's depend on the name of an argument of the first macro. Here I use the packages amsthm, hyperref and aliascnt, ...
1
vote
1answer
39 views

Custom specific page in two columns

I know that you can make a page in two columns with multicol package, but this control the text. I want to know if possible put a specific page in two columns without depending of text. Its possible ...
0
votes
0answers
70 views

Uploading an article to arXiv: conflict of macro packages

Did anyone encounter the following error? I tried to upload and compile an article (prepared using the package of the "Solar Physics" journal) to arXiv. The response of the system was as follows: ...
0
votes
0answers
19 views

Datatool package: remove link between variable and value

When I try to create a subset from one db with the help of the datatool package, all my rows contain the same information as the last one. \DTLforeach[\DTLisieq{\tmpjob}{\jobnameoff}]{data}{ ...
3
votes
1answer
40 views

How to customize blank space between chapter title and text in gsm

I use gsm packages from AMS to write my book. Overall, the package is beautiful and works well. There is only one problem, that is the vertical space between the header and the chapter title & the ...
4
votes
3answers
206 views

What's wrong with my newcommand?

I defined a question macro, then made it successively fancier. Right now, three macro should define a short hand for the following: \section{Questions} \begin{enumerate} \item Q1... \item Q2... ...
2
votes
2answers
46 views

“List of Lists,” similar to \listoftables or \listoffigures?

While this may seem kind of meta, I'd like some way to create a list of lists at the beginning of a document with labels for each list. Is this easily done? Currently my project is laid out like this: ...
2
votes
2answers
51 views

Put answer as an optional argument for multiple choice

I am using the following code at the moment to make Multiple Choice Questions with the options as the 5 arguments. \documentclass[a4paper,addpoints,answers,12pt]{exam} ...
3
votes
2answers
110 views

Control sequence with arbitrary number of parameters

I want a macro which can generate units consisting of several base units. Let the macro be \unit. For example, I want \unit{kg} to mean \mathrm{kg} and \unit{kg}{m}{s^{-2}} to mean \mathrm{kg \cdot m ...
1
vote
0answers
31 views

How to split a string to figure float with figure name, label and caption?

I am struggling with a shorthand macro that converts a string to a figure. At the end is a working, but unstable version what I am trying to do. The goal is to parse make a command (or macro) like ...
6
votes
4answers
129 views

A macro dependent on a parameter

I would like to write a macro privatecomment whose behaviour depends on a global parameter show. For example, in the .tex, I could write \privatecomment{Here is a comment}. When I set show to true, ...
1
vote
0answers
17 views

Problems with acronym shortcuts (package: glossaries) [duplicate]

I am using the glossaries package to generate a nice list of acronyms. For often used acronyms I defined some shortcuts, e.g. \newcommand{\myshortcut}{\acrshort{myacronym}}. The acronym myacronym has ...
0
votes
1answer
34 views

Increase spacing between item

I am using: Automatically itemize a paragraph to automatically create \item for my bullets and I was wondering how I would go about setting the spacing between each bullet point. The default for ...
1
vote
1answer
55 views

Argument until non-alphanumeric character

Not sure if this is possible or not... I would like to turn (say) + into a command with one argument without braces. This argument should be everything following the + up until the first ...
3
votes
1answer
35 views

Refering to colors using numbers

I want to create a command allowing me to colour arbitrary text with a color designed by a number (e.g. 1 = Green, 2 = Blue, etc). To that purpose, I create a first command, giving the name of the ...