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

6
votes
2answers
183 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
55 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
611 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
139 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
340 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
65 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
64 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
41 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
116 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
32 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
35 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
56 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
267 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 ...
0
votes
1answer
59 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
75 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
205 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
50 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
109 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
30 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
34 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 ...
10
votes
4answers
175 views

How can I check whether two control sequences have the same name?

I'd like to test whether two custom control sequences have the same name, regardless of what they expand to or whether they're actually defined. For instance, \ifsamecsname\Foo\Foo should be ...
2
votes
1answer
28 views

Command \* already defined

I have included the package amsmath as required to defined a new theorem/corollary (without number), but I keep having the following error: ! LaTeX Error: Command \* already defined. Now, ...
0
votes
0answers
30 views

Number format as optional key value argument for LaTeX function

I followed the answer as given in http://tex.stackexchange.com/a/34318/28093 in constructing a function which uses key values. It works fine, but I also want to be able to give the number format as ...
0
votes
1answer
48 views

Annotate / plot triangle with slope in PGFplots log log axis environment

As a follow up question on the question posted at Annotate / plot triangle with slope in PGFplots axis environment, how do I do this in a loglogaxis? So, given a relative position in the loglogaxis ...
2
votes
1answer
34 views

About making 4 by 4 or bigger square matrices

I am writing some notes with a lot of similar big matrices involved. So I wish to use \newcommand to make typing easily. For a 3 by 3 matrix, I can use the following code: ...
6
votes
2answers
150 views

What is the difference between \@@par and \par?

In LaTeX internal code I came accross \@@par. How is this different from \par or \newline. When should I use \@@par if I am writing a package or class file? In general, there are so many other ...
1
vote
1answer
37 views

Positioning/ Size of MarginText in CV (classicthesis/curvvita)

I'm trying to write my CV in LaTeX, with classicthesis and curvvita for style format. I've got the following code: \documentclass{scrartcl} \usepackage{marginnote} \reversemarginpar % Move the ...
4
votes
1answer
28 views

Problems using listxadd and xappto

I am a fairly experienced LaTeX user. Now, I am trying to get into learning the internals of LaTeX packages and classes. I do not know much about TeX coding. I thought a good beginning would be to try ...
2
votes
1answer
53 views

'Dimension too large' in `loglogaxis` plot

I constructed a macro to annotate slopes of graphs by means of triangles in a loglogaxis. It works fine for small slopes, but for large slopes I get a Dimension too large error. Minimum working ...
3
votes
2answers
77 views

Howto: if argument is numerical … else

I'm trying to create a differentiation command. At the moment I have the following: \newcommand{\diff}[1][]{% \def\ArgI{{#1}}% \diffRelay% } \newcommand{\diffRelay}[2][]{% ...
1
vote
1answer
57 views

How to ignore/comment out a text passage?

I want to hide a very long LaTeX input text in one passage. If I use % for every line I need too much time to hide all the lines. Is there a command that can hide the text in one single passage?