{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
31 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
81 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
70 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
82 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
296 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} ...
2
votes
1answer
78 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
47 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
48 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
89 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
285 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
34 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
14 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
28 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
78 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
86 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
42 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
79 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
22 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
48 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 ...
5
votes
3answers
235 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
51 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
66 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
118 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
36 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
132 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
72 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
44 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
203 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
38 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
40 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
83 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
41 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
161 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
2answers
76 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
32 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
85 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 ...
4
votes
2answers
91 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
67 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?
3
votes
3answers
71 views

Wrong axis limits when using `\pgfplotsextra` in `loglog` axis environment?

This is a follow up question on Key names of the axis limits when not set explicitly. The solution as given there works great for regular PGFplots axis environment, but not for a loglog axis ...
3
votes
1answer
40 views

Expansion problem with \newlistof from tocloft package

I try to write macro(s), say \foo, which automatically provides counters and \listofsomething like commands for some generated macros, using a xkeyval package approach for fine tuning of the generated ...
3
votes
2answers
93 views

What is a function's signature? [LaTeX3]

I am trying to understand the interface3 documentation. The LaTeX Interface 3 documentation v. May 20, 2014 and March 1, 2015 refer to Defining new functions using the signature in section 3.3. I am ...
0
votes
1answer
63 views

Command to automatically start new row

I need not trivial help. I have a command with parameters. This command fills in and prints the following table: \begin{longtable}{|p{3.2cm}|p{2.5cm}|p{2.5cm}|p{2.3cm}|} \hline Some Text: & ...
1
vote
1answer
83 views

Writing to aux - you can't use a prefix with `the character @'

In a previous project, we used the following macro to define requirements, so that they were easy to reference later in the text. \newcommand{\reqlabel}[2]{% \label{#1} ...
7
votes
1answer
116 views

Create itemize-like command

Can I somehow create a new command with this functionality: {\tabcolsep=0mm \begin{tabularx}{\textwidth}{r@{\,---\,}X} where $P$ & power of transmitter, dB;\\ $G_a$ & Gaining, dBi;\\ ...
4
votes
1answer
53 views

Plot instance missing in PGFplots

I have written a small macro to draw triangles with slope in PGFplots axis environments. I try to draw two of these triangles. However, the first one is missing for some reason. How can I resolve ...
4
votes
2answers
55 views

inputenc, active catcode and \csnsame

with this MWE, with a non utf-8 engine (like pdflatex) \documentclass{article} \usepackage[utf8]{inputenc} \begin{document} \expandafter\def\csname a\endcsname{toto} \expandafter\def\csname ...
1
vote
1answer
24 views

how understand my variable is vacuum in use of \ifx? [duplicate]

I want use \ifx and do some thing if my variable\myvariableis vacuum . how do it?
4
votes
1answer
36 views

mydots and linewrapping,

Can someone help me improve upon this command? \def\mydots{\leavevmode\xleaders\hbox to 0.40em{\hfil.\hfil}\hfill\kern0pt} I have been using his to fill space between raggedright and ragged left ...