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

0
votes
0answers
35 views

Follow Up Question : multiple lines format for ifthen or ifbool compound statements

Follow up question to How do I add multiple macro definition inside an \ifbool compound statement? Ok if you look at the last post, people fixed my format for the ifthen / ifbool statement format to ...
7
votes
2answers
261 views

Is there any analog to #pragma once in (La)TeX?

In C, I can write #pragma once as a preprocessor directive at the top of a header file, which tells any compiler that supports it to include the file a maximum of one time per compilation cycle, ...
5
votes
4answers
157 views

Alignment of the text like a table

What I wanted to achieve was this: I defined a new command like this: \newcommand{\details}[2]{ #1 \hspace{2cm} : #2 \\ } The full MWE is as follows: \documentclass[12pt]{article} ...
3
votes
1answer
114 views

How to Define New Todo Command Which Still Takes Options

I am using the package todonotes in order to handle my TODOs. As written in the manual, one can define a custom TODO command like that: \newcommand{\feedbackRequired}[1]{\todo[color=red!70]{#1}} ...
13
votes
3answers
411 views

Macros that know their macronames themselves?

Some programming or scripting languages know the feature of #0 or $0, holding the name of the current script or the current routine. Does a similar technique (or a workaround) exist for the macro ...
2
votes
0answers
30 views

\newcommand - Missing \begin{document} [duplicate]

On defining a new command, and using it, LaTeX throws an error that Missing \begin{document}. What is the issue here? \documentclass[12pt]{article} \newcommand{details}[2]{ #1 \hspace{2cm} : #2 } ...
0
votes
0answers
32 views

How do I make a new command with author/journal/year citation in footnote

\documentclass{beamer} \usepackage[backend=bibtex]{biblatex}%backend=biber, natbib=true, style=chem-acs \bibliography{oralspaper} \DeclareCiteCommand{\citejournal}%%%creating \citejournal command ...
7
votes
2answers
103 views

Redefine \newcommand to insert code at start and end of custom macros

I would like to be able to insert code into the definitions of my custom macros, without having to modify each macro definition. This seemed like a simple case of redefining \newcommand, but this ...
3
votes
2answers
60 views

How to expand a macro to use it inside a question in AMC?

Context I'm trying to use AMC to produce an exam with code in it. However, the use of verbatim code inside the questions is beyond the scope of the package. They suggest to declare boxes and used ...
5
votes
2answers
128 views

Use of \csname in \input produces mysterious results

I am stuck with the following one where I want to input a file with a name in the line of \jobnameQ.tex. Here is my MWE excerpted from a bigger picture. \documentclass{article} \usepackage{lipsum} ...
1
vote
0answers
54 views

newcommand, section

I just received a new task in LaTex with a predefined structure and predefined commands. There was also the command \mysection. I think it shouldn't show the text of the section in the document, but ...
2
votes
1answer
62 views

How to convert command parameters into optional ones?

LaTeX allows the use of optional parameters. Sometimes one wants to rewrite a command by making certain parameters optional: \newcommand{\foo}[2]{ #some commands } to: \newcommand{\foo}[2][a]{ ...
5
votes
2answers
79 views

Extra space in command created

Consider the following answer given by @egreg which can be found at http://tex.stackexchange.com/a/111043/10898 Why is an extra 6.799999pt space created when you issue a command like ...
6
votes
2answers
100 views

Using \mathpalette with macros that take more arguments

As I understand it, \mathpalette takes two arguments; the first must be a macro A that itself takes two arguments. A will be passed as #1 commands to reproduce the math enviroment at the location ...
1
vote
1answer
59 views

Beamer renewcommand

I am doing a presentation using the beamer class and I want to declare a new command, which shortens the following thing: \textsuperscript{1} to \up{1} I did this while using scrartcl with ...
3
votes
1answer
60 views

conditional loop printing text and icon

I'm new in the Latex world. I'm writing a little guide and I've choose Latex, in particular Texmaker for writing it. I'm trying to do a loop for printing some instruction as File -> Save as -> Ok. ...
3
votes
1answer
63 views

AucTeX insert-environment C-c C-e (no label prompt)?

Does anybody know how to configure Emacs or Auctex such that when you insert an environment for example with C-c C-e equation RET? Avoid having to type RET for (Optional) What label? question? Or ...
0
votes
0answers
23 views

Manipulating the output of \footnote

This is in a way a generalization of my earlier question Footnotes (e.g. citations) in the footline of beamer frames? Generally, I would like to know which macros (La)Tex uses to process footnotes ...
1
vote
1answer
59 views

Custom citing command. Bibtex key as parameter to \newcommand

I'm new to LaTeX and I want to define an auxiliary command for citing. What I would like to achieve is a \newcommand or similar that takes a BibTeX parameter such as paper and produces the same output ...
3
votes
1answer
74 views

Redefining a command and special character

I am trying to redefine \v command (wedge above character) to do what \vec does in mathmode and preserve \v in a command called, say \hac. This code works perfect \documentclass{article} \let\hac\v% ...
3
votes
1answer
90 views

How can I redefine the chapter command to display additional text below the title?

I'm relatively inexperienced with Latex. I'm using the Memoir class and I've been trying to develop a custom chapter style based on Danie Els' BlueBox style (the source for this is given on page 46 of ...
8
votes
1answer
116 views

How to rename an existing command?

I would like to know if renaming a command is possible in LaTeX. For instance, could I change the \section by \sec ? I read that some people used something called "alias".
6
votes
1answer
86 views

testing parameter values with \ifx

Let's say that I would like to redefine \@seccntformat so that whenever the section counter is printed, it is prefixed by Section, but other counters should no be changed. Here is my failed attempt: ...
0
votes
0answers
16 views

Include SVG aligns/centers different when used with “newcommand”? [duplicate]

this is my first post in this forum, but i have been here a thousand times, enjoying the high-quality answers to often also good quality questions. So i try my best to also provide all needed ...
4
votes
1answer
44 views

How to know if page is empty

Looking for macro to know if the current page is empty , and opening new page if were not as well. Is there any idea to do that? example in this MWE \documentclass{article} \usepackage{tikz} ...
2
votes
1answer
54 views

macro to showcase newly defined macros

I have the following MWE which takes an argument and prints it verbatim. I have obtained the code from this answer. \documentclass{article} \makeatletter \newcommand{\myverb}{% \begingroup % ...
1
vote
0answers
25 views

Macro for textinput without any formatting [duplicate]

Is there a LaTeX macro that just compiles whatever I type into it? Something like \text or \textnormal. I want to display a LaTeX code inline without any formatting, but don't want to escape ...
2
votes
1answer
106 views

Modify the @tufte@margin@float environment to automatically align floats

The Tufte classes provide the @tufte@margin@float environment which is used for tables and figures, but its result it's not automatically aligned with the text. The \marginnote command provide a ...
0
votes
0answers
30 views

Output command arguments for spellchecking

I have a longer tex file which contains text in different languages. The languages are highlighted in different colors, e.g. {\color{blue} some text in french } {\color{red} some text in ...
2
votes
0answers
51 views

What is the meaning of \+ in doxygen-generated latex?

When compiling a software reference manual with doxygen and latex output, I get the following error: ! Undefined control sequence. l.2 ... Modular System for Shelves and Coasts (M\+ ...
4
votes
1answer
70 views

text inside tikz node which can skip to an other

I would like to put text in a mini page with fixed length inside a tikz node using \sbox , if the text skip a specified length (10cm) it will be saved in an other \sbox and used inside a tikz node ...
8
votes
2answers
87 views

Package csquotes does not seem to work within a mdframed box defined via a macro

If I define a macro which uses a mdframed box, this seems to disable csquotes (red box). But using mdframed directly (i.e., without defining it via a macro), then the csquotes package can do its job ...
8
votes
1answer
293 views

Does \Twoheadleftrightarrow exist? How to write my own?

I'm a LaTeX newbie. I am writing a document in which I need to have a two-headed bidirectional arrow. Two-headed like \twoheadleftarrow, bidirectional like \leftrightarrow. Is there any package that ...
10
votes
2answers
144 views

Passing command output as a parameter to the other command

I created some kind of switch statement with a help of \ifthenelse command. Now, I would like to pass its output to another command. In my example I want to colorize each sentence with a color ...
2
votes
2answers
186 views

redefine starred command \section*

with \usepackage[explicit]{titlesec} I have defined \section like \titleformat{\section} {\ttfamily\Large\bfseries\color{red}} {\thesection} {1em} {#1} i want to redefine the starred ...
6
votes
2answers
193 views

macro that deletes whatever symbol follows after the code and leave no space

How would the following macro X be defined in TeX? word in previous sentence?\macroX . Next sentence gives output identical to word in previous sentence? Next sentence The motivation: a period ...
4
votes
1answer
57 views

Arbitrary positioning in math mode without size restriction

In the MWE below, are all general methods, of achieving arbitrarily shifting of symbols up or down or left or right in math mode, represented? If yes, that is the answer. If no, what good methods are ...
3
votes
2answers
77 views

Problems in expansion of a setcounter macro (Use of \csname doesn't match its definition)?

Followup to Split the reference counter for any numbered item (like with subequations) : I was trying to make a generic subanything macro, and I fail miserably - see MWE below for what I get as error ...
6
votes
1answer
106 views

Execute a command automatically for each Page

my code save groups inside environment topr and topl to two sbox , the command \border draw a frame devided into two parts and put in them the two sbox , here is my MWE \documentclass{article} ...
6
votes
1answer
144 views

Are (La)TeX macro/command names restricted to ASCII code characters (letters)?

Perhaps this question has been asked already, but my search efforts were unsuccessful. Is it necessary to have ASCII characters (i.e. letters basically [a..z,A..Z], special characters such as \( etc ...
0
votes
1answer
72 views

Graphics: Moving Images and aligning with text

So currently I have this code written out: \begin{figure}[ht!] \includegraphics[width=60mm, scale=0.3]{titanium-distillation-vessel.jpg} \caption{Argon Vessel, containing TiCl$_{4}$ and Mg} ...
3
votes
1answer
37 views

Replacing some macro tokens in a list before \write ing

I'm trying to hack a bibliography package (amsrefs), and fall into the following problem. I'm trying to convert the amsrefs format back to .bib files. This doesn't quite work, because strings get ...
7
votes
2answers
106 views

convert a \newcommand to \newenvironment

I have defined a command as follows \newsavebox{\textsix} \newcommand{\bottomr}[1]{\sbox{\textsix}{\parbox{11cm}{\begin{flushright} #1 \end{flushright}}}} which save the parameter (text) of the ...
4
votes
1answer
53 views

Command with semi-arbitrary characters

Is there a way to define TeX commands with names containing (almost) arbitrary characters, like :, -, _, numbers etc., perhaps even spaces? These are the characters I shall need apart from the ...
2
votes
1answer
46 views

Problem with \edef and CJK

In the following code, it seems that using \edef with CJK contents may fail. (I used pdflatex, UTF8 encoding.) \documentclass{article} \usepackage{CJK} \begin{document} \begin{CJK*}{UTF8}{bsmi} ...
4
votes
2answers
78 views

new command using math mode sub index bug

I have defined the following command \newcommand{\gsubselector}[2]{$s_{#1,#2}$} and I'm calling it from a document in the following way: ... \gsubselector{a,i} : \gsubselector{b,j} there is ... ...
2
votes
1answer
120 views

Command to gray words

I would like to create a macro in LaTeX to have the following effect (gray parts) on some text: I would like to have something like \gray{Hello} which puts brackets and grays the text. Can someone ...
9
votes
3answers
196 views

Is it safe to “renewcommand” \SS? (Which packages use \SS command?)

I've tried to set \newcommand{\SS}{\mathcal{S}} in the preamble but I've discovered that this command is already defined. So, I tried native command on my code and I've found that it is a "simple" ...
7
votes
1answer
288 views

What generically CANNOT be compiled inside an equation environment?

Certain macros or whole environments which are themselves not equations, like whole tikz diagrams can be placed in the equation environment and compile. For example Diagram displayed as an equation ...
8
votes
0answers
119 views

How to pass a LaTeX argument verbatim to lua?

I would like to pass an argument verbatim from LaTeX to lua including LaTeX commands and end of line characters. The example below takes care of the former issue, but not of the latter. Is there a ...