{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
1answer
12 views

changes package for peer reviewed journal: hide authors and convert 'replaced' to 'added'

I'm using the changes package to keep track of any changes I ( and my co-authors ) made for a peer reviewed journal. Meaning, in response to each of the reviewers' comments, we are using a new author ...
1
vote
1answer
19 views

How to implement a macro for normal ordering of operators?

I am looking to typeset the normal ordering symbols :O: commonly used in quantum field theory in a way that makes them easily discernible from regular colons, especially the 'defined as' symbol :=. ...
3
votes
1answer
12 views

\if leqno or reqno: command to check whether left or right eq. Numbers were set

I am defining my own command and need to check, which mode the user has set, whether reqno or leqno. Is there a way to do this?
3
votes
1answer
42 views

Correct superscript spacing for new mathbin

I redefined the \div command so that it's U+2215 aka ∕, but for some reason when I use it as a superscript the spacing between this symbol and its numbers is really tight (works fine in displaymode or ...
0
votes
0answers
34 views

Is there a semantic definition command?

Every time I want to emphasize a definition word in a paragraph I need to explicitly state the formatting with \mathbf{<word(s)>}. But I'd like to use a semantic command like ...
2
votes
0answers
48 views

How to make a function inside the tikzpicture behave like outside

I have a makro which generates a structure(rule) and a reference to that structure. It does not behave when inside a tikzpicture. How to make the function robust to reference the structure even when ...
7
votes
4answers
374 views

How to replace text

I'd like to write something like this: \replace{Text should be replaced here, here and here}{here}{Latex} It should outpout Text should be replaced Latex, Latex and Latex How can this be ...
0
votes
1answer
35 views

Expand second argument/counter

I'm currently working on a somewhat automatic way to generate B+ trees. Thus I introduced a new macro to generate the content of a matrix of nodes which should also generate the labels automatically. ...
1
vote
1answer
58 views

Chapter Opener in both Right and Left Side

I would like to get the below chapter opener with back-end Image in my LaTeX file. 1) BackEnd Image 2) Front End Chapter Number and Chapter Title. 3) Yellow Color box is backend and what you will ...
1
vote
1answer
68 views

image height reduce/increase automatically

I have the below boxed environment. The image should place in the marginpar width. When my environment is going long the image should automatically increase upto my enviroment, when is going to low it ...
1
vote
0answers
26 views

Problem with answers using hyperlinks and tbox

I have minor problems with the solutions shown in Hyperlink with answers package I wanted to make a macro which takes solution and exercise as arguments, uses a button like mutual reference, and ...
1
vote
1answer
48 views

How to parse a macro that contains a \let?

My situation is similar to, but hopefully different from How do I ‘expand’ a control sequence \let to a character?, as that question does not admit a positive answer. I want to parse, not expand, but ...
4
votes
1answer
60 views

Strange preamble for a thesis or this is normal?

I have a somewhat strange template that I should use for submit my dissertation for the speciality. I put the code as a minimal working example for you to see: ...
0
votes
0answers
49 views

Overlay specifications in beamer

I'm trying to create a beamer document class (.cls) with some configurations that please me. But, I ended in this point where a cannot overlay my \newcommand. This code has to collect a few ...
3
votes
1answer
31 views

Using \newcommand to display user input that may contain special characters that need to be escaped

I don't know much about LaTeX right now, but I need to be able to use it to generate dynamic PDF documents using C#. For the most part, everything is cool and works the way I want it to work. ...
1
vote
1answer
35 views

Placing the text under a line in a multiline form

I am typing a form like the following: I want to make a command \newcommand\myform[1]{ *** #1 ***} that will produce the filled-in form with the argument substituted into it. For example, the ...
0
votes
0answers
10 views

Using a comma-separated list for a cycle macro [duplicate]

I am doing abstract algebra and it is rather tiring to have to write \begin{pmat}1 & 2 & 3\end{pmat} or something of that nature every time I want to write a cycle. I was thinking of a macro ...
2
votes
1answer
46 views

How to refer to a word inside a running text as a TikZ coordinate?

Say you have some running text, and you want to be able to refer to some part of that text (like a single word) as a TikZ coordinate in order to, for example, draw edges to that word. What's the best ...
4
votes
2answers
88 views

Processing “List” of “List”

I implemented a short macro that processes a comma separated argument list to format them. So by calling \macroa{ABC, DEF} it will format the text to ABC DEF Now what I would like to have is ...
1
vote
1answer
28 views

Inserting command with optional argument as optional argument Problem

If I define the following two commands: \newcommand{\TestA}[1][]{a^{#1} aaa} \newcommand{\TestB}[1][]{#1} and then call it by $\TestA[\TestB[111]]$ I get the error: "Argument of \\TestB has an ...
3
votes
4answers
92 views

Too many Sums: “TeX capacity exceeded ”

I am a lazy student who writes a lecture in LaTeX. As I need many \sum\limits and \int\limits I tried to overwrite the command \sum\limits so I just have to write \sum. So I wrote ...
3
votes
1answer
32 views

How to pass parametres to an external file included by `\input{<filename>}`

I have a class file to set up agreements. I want to define a command that choose boilerplate text to include using a parameter pass a parameter to the included file to run a test and choose correct ...
3
votes
1answer
73 views

Generating Labels via Macros and loosing \ref{}'s

I want to write a macro which will include labels. When I generate a label with the macro I don't seem to have access to it in the list of Gathered resources provided by Winedt 9. I really want the ...
5
votes
1answer
30 views

Anchor macro for paths

I am trying to build a macro to assign anchors for a given path. This is what I have: beginfig(1); def anchors(expr p) = pair p.n, p.e, p.s, p.w; p.n := .5(ulcorner p + urcorner p); p.e := ...
1
vote
1answer
64 views

Extracting text from variable

I am trying to work out a special document that through a seed generates a test for my students. I have gotten quite alot to work but I have the issue that when I try to add my answers into an array ...
6
votes
1answer
41 views

More robust macro for ranges AND series of lines, measures, etc

Starting with @egreg's marvellous xparse answer to my question about a Macro for abbreviated ranges (pages, music measures), how to define a similar command that can also handle non-contiguous ...
4
votes
1answer
60 views

Macro for abbreviated ranges (pages, music measures)

I would like a semantic, configurable way to input ranges of pages, poetic lines, and music measure numbers. Using a macro would enable me to make sure all such ranges are formatted consistently, and ...
3
votes
3answers
119 views

Safe test for an empty expanded macro argument?

How can I test in a safe way (i.e. without reserving tokens as explained here) if an expanded macro argument is empty?
2
votes
1answer
56 views

Create a command for a different font

I'm pretty new to Latex and I am writing my thesis. I would like to use a command that I can essentially change the font of a few words in-line or separate (like an equation). I have computer ...
0
votes
1answer
54 views

Using `\cronominutes` with Antibes theme

This is a nice post that discusses the use of the \tdclock package. Following the tex demo provided in its answer, I modified my MWE below to use a stopwatch with the macros \cronominutes of that ...
6
votes
1answer
66 views

How to use macropackage in LaTex?

I have used LaTex amspackage to type a math article. The publisher is asking me to do it in Springer LaTex macropackage with the option of 'smallextended.' I have no idea how to do this. Help please!
1
vote
1answer
16 views

Appending to macro name in a metacommand [duplicate]

I'm trying to build a macro that in-turn generates a couple related commands. Here's a really simplistic example: \documentclass{article} \newcommand{\myabbv}[3]{% \newcommand{#1}{#3} ...
6
votes
1answer
40 views

How to return \count value from \def

I wrote a macro which calculate remainder : \def\remainder#1#2 {% \newcount\dividendcount \dividendcount=#1 \newcount\quotientcount \quotientcount=#1 \divide\quotientcount #2 ...
0
votes
0answers
25 views

Reassignment macro doesn't work inside title, if protected “works” but not styled

A handy macro egreg made works famously, but not so well in titles. \protecting it prevents TeX from dying, but then it seems to be hidden from \spacedallcaps. \documentclass{article} ...
7
votes
1answer
85 views

New command to number paragraphs (related counter)

I use KOMA class (scrbook). My goal : I try to create a command (let's say \verset) that will display a number, each time indented. A title should be put as argument An example : \verset \lipsum ...
5
votes
1answer
129 views

Macromize a tikzfigure

I have this figure (/ 2 figures) \documentclass{article} \usepackage{pgfplots} \usepackage{subcaption} \newcommand{\xfigscale}{.5} \newcommand{\yaxscale}{.75} \begin{document} \begin{figure} ...
7
votes
2answers
245 views

QR-code from jobname

I would like to print a qr-code in a LaTeX documnet. The info to the \qrcode command of qrcode package would come from the file name by the varsfromjobname package. But it does not work for me: ...
7
votes
2answers
106 views

Why \newlength is not profiled as \newcommand?

While commands are defined and set in one step with \newcommand, lengths need two steps for this: \newlength and then \setlength. Because \newlength{\foo}{1cm} would be easier than ...
2
votes
1answer
50 views

\newcommand doesn't work with \section and \chapter

I have a newcommand defined as follows: \newcommand{\met}{\cancel{\it{E}}_{T}} When I try to place it into a \section like this: \chapter{\met} I get error messages like this: ! Undefined ...
0
votes
0answers
16 views

Macro that feeds its argument to an environment that changes the catcodes

Suppose an environment that reads its contents with changed catcodes (verbatim, CJK, etc). I want to write a macro that invokes this environment on its single apparent argument. The argument is ...
0
votes
0answers
23 views

What is the meaning of the “at mark” @, also called “Klammeraffe”, in LaTeX commands? [duplicate]

I have seen the "at symbol" on several occasions, used in connection with LaTeX macros, often as part of command names. Does this symbol have a special significance in LaTeX, or is it just a ...
2
votes
0answers
45 views

How to redefine the chapter like the following?

I have a newcommand to redefine chapter. \newcommand{\Chapter}[1]{ \clearpage % \noindent \refstepcounter{chapter} \begin{center} \dsp{CHAPTER\space\thechapter\\} \vspace{10pt} ...
1
vote
1answer
47 views

A command for making a string of characters [duplicate]

How can I make a command (or is there an existing one?) which takes two arguments: 1) character type 2) N (count) and puts N number of characters side by side? \newcommand{\foo}[2] { % sample: ...
11
votes
3answers
321 views

Parser for decimal numbers in (plain) TeX

I need help writing a parser for decimal numbers using only TeX and plain TeX. The set of accepted inputs is given by the regular expression: (+-)?(0-9)*(.,)?(0-9)+ The parser need not do anything ...
2
votes
1answer
56 views

Macro for tables that take as arguments the column and row dimensions

I am working with tabulars formatted in a consistent way. Sometimes the tables are 3X3, 3X4, 4X4 etc nXm in general. As it is I have a macro for each of these tables: \matrixIIIC, \matrixIIID etc. Is ...
1
vote
3answers
58 views

Font size macro only works once in the document

I am writing a paper where HI comes up a lot. I need the capitalized "I" to be slightly smaller than the "H" so I have been doing this: H\small{I} However this only works in the first instance of my ...
6
votes
1answer
138 views

Correct usage of the LaTeX \newcounter and associated commands?

Previously I had a question about the \newcount command. I was then led to consider the \newcounter command instead, that does allow the use of digits in counter names. Accordingly, I have modified ...
2
votes
1answer
56 views

Workaround that allows the use of digits as part of counter names?

I tried to define indexed counters, such as x1, x2, . . . etc, by defining them like this : \newcount\x1, \newcount\x2, . . . etc, but it didn't work. Is there a workaround for this in TeX or LaTeX ? ...
0
votes
0answers
27 views

What is the difference between \number and \the ? No.2 [duplicate]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Here is the example tex-file that illustrates use of \number and \the . %% ...
5
votes
1answer
154 views

What is the difference between \number and \the?

I am trying to learn more about macro programming - if that's the right word - in TeX and LaTeX. I began by defining a quantity I called Sum : \newcount\Sum. I then wrote \Sum=0. Then I did some ...