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

Change temporary or locally error behaviour suppress undefined errors

I googled about this problem with no result yet. You might discourage this, but is there a way to suppress errors? This is an example how it should work. \documentclass[12pt,a4paper]{article} ...
0
votes
1answer
35 views

How to “Go to source” from PDF file to Latex file with Texstudio?

I'm using Win 8 + Texstudio and follow the instructions of the previous answers, but do not succeed. It my commands
0
votes
1answer
30 views

redefine ampersand & for environment

I want to redefine the ampersand-charakter to expand to a macro, I defined. Basically it is/should be something like &={\hspace*{30pt}Ampersand has been redefined\hfill} The final use is ...
2
votes
1answer
30 views

TeXstudio: Is there a way to keep my custom macros and shortcuts in a separate file?

I've created some macros and corresponding shortcuts; found them in my texstudio.ini file (Macros and keysetting keys), buried deep among lots of predefined stuff. Is there a way to 'modularize' it a ...
11
votes
1answer
5k views

LaTeX template for use cases

Currently I am trying to create a template in LaTeX for my team members in order to create a set of use cases. I thought of using tabular to create something like the picture below 2 (without colors). ...
2
votes
0answers
84 views

How to force edef to execute def [on hold]

Since I haven't given up on my problem from yesterday, I've been messing around with \edef, \def, \unexpanded, \expandafter and some other stuff. I also read about fragile commands and robust ...
2
votes
1answer
29 views

Macro or \def to create lines in a table

I have a certain table to which I would like to add lines by a command. One way I can get to this looks like this: \newcommand\arow[3]{ #1 & #2 & #3 \tabularnewline } and the table ...
1
vote
1answer
102 views

Library with xkeyval, make my life easier?

Question is related to the topic that I opened last year regarding the Library with xkeyval, fp and newcommand where the library now grew quite big and adding new stuff in it has become tedious and ...
1
vote
1answer
30 views

Command inscribed in command

May I know if there's a way to use a defined command in other commands without producing an error? Code(the line with error is commented) \documentclass{article} ...
1
vote
2answers
45 views

Environment behaves different inside \cslet{}

Please scroll down for the EDIT and most recent version This is not a good title, but I didn't come up with a better one. I've got an environment which should be used like this (The way this ...
0
votes
2answers
36 views

Newcommand for fixed content not working

I tried to generate a macro for fixed content, but it's not working and I was wondering why. This is my code: \documentclass{article} \begin{document} % this is working and puts A at the bottom of ...
5
votes
3answers
121 views

How to assign arbitrary LaTeX text to a variable for use in different places in a document?

I have lots of LaTeX text duplication in my files, since the file has to compile with pdflatex and tex4ht and text4ht does not support all packages, So my files are littered with things like this all ...
8
votes
2answers
123 views

Make \par work inside command arguments

I have a problem, which I think can not be solved, except for workarounds. I want to pre-define pages and insert them later into the document. The problem is, that \par (if used in the pre-defined ...
2
votes
1answer
49 views

Macro for pictures with generated labels

Good day, I would like to write a macro (using Latex3/expl3) that posts pictures and can take several key-value parameters for generated labels/captions etc. I already found code that can do this, ...
9
votes
2answers
84 views

\ref with macro as parameter

I would like to write a macro (using Latex3/expl3) that can automatically refer to say plot using several key-value parameters. Here is what I currently have: \keys_define:nn{label}{ Re .tl_set:N ...
2
votes
1answer
40 views

White space with subfigures using a macro

EDIT The answer proposed by egreg doesn't work for me: When changing the outer sep to outer sep=-10pt, instead of shifting the images, just the labels get shifted and the white space persists. ...
6
votes
6answers
182 views

How to write macro with variable amount of text variables

I am trying to make a signature block macro that accepts a variable number of text variables so that I can add or subtract the text without using empty fields "{}" as arguments. ...
0
votes
0answers
20 views

create custom badness for pagebreaking over a custom area

This is a - as I think - tricky question. I want to create and/or modify a badness for pagebreaking/newpage. It should work like this (pseudo code): \begin{areaOfBadnessValid}{badnessvalue} ...
45
votes
5answers
11k views

Defining commands/abbreviations that contain numbers

I tend to use \newcommand to define macros for symbols I use often, e.g. \newcommand{\hankel}{H^{(1)}_0}. One inconvenience of this approach is the fact that command names cannot include numbers. ...
15
votes
3answers
4k views

Command/macro name cannot include numbers and symbols

I would like put picture into table, and my idea is define new command as below> \newcommand{\EJ471}{\includegraphics[scale=0.150]{EJ_471.jpg}} But compiler reports an error. If I use the command ...
3
votes
3answers
59 views

\ifnum and real number [duplicate]

I have an error when I take a non-integer value for may argument: \documentclass{article} \def\marks#1{{% \hskip20pt plus 1 fil (#1 mark\ifnum#1=1\else s\fi) \parfillskip=0pt\par}} \begin{document} ...
7
votes
6answers
377 views

Explode arguments in argument list

What does TeX do, when reading an argument? I wanted to write a command that has a comma separated list of arguments (\fun[a@b,c@d,e@f,g,]). Each argument should be exploded in two parts at the ...
1
vote
0answers
21 views

Texmaker user command puts filename in quotes

Following this advice: Integration of arara in Texmaker, I defined user command in Texmaker. Yet after running a command, I get a message: Error : could not start the command : arara "mgr".tex ...
0
votes
1answer
281 views

Wolfram Mathematica Functions in Lyx

When using LyX, how can I call Mathematica to input a mathematical expression, such as using Mathematica's Solve[] function, and return the result directly to LyX?
2
votes
1answer
68 views

Import single macro from file

I have an automatically generated .tex file containing some content and a couple, usually just one, \newcommand calls. Usually I display the content and load the commands with \input but sometimes ...
5
votes
1answer
66 views

tex capacity exceeded when using breqn package with a separate macro

I am trying to use a nice solution for one problem I have which is to break long math sequence with commas in them as given here allowing-line-break-at-in-inline-math-mode only to to find I get tex ...
6
votes
1answer
65 views

suppress single macro from style file

I have a master style file of macros, which I use for all of my documents. Is there something I can add to the preamble of a particular file so that it ignores some specific macro from my style file? ...
4
votes
2answers
52 views

Different `andothers` expressions for `\textcite` and `\parencite`

Is it possible to have two different expressions for andothers, when using either in-text or parentheses citation with biblatex classes? For instance, I would like to use "and others" in text (with ...
2
votes
1answer
40 views

Get \textsc to ignore stuff in braces

This question allowed me to create an uppercase command that would ignore stuff in braces, so that \smartuppercase{An introduction to {LaTeX}} is printed as "AN INTRODUCTION TO LaTeX". Now I want a ...
6
votes
2answers
113 views

How can I define a key-value command like \hypersetup?

I am quite familiar with switch (\if...\else...\fi) now and read many questions on key-value topic, but I cannot find an example to create the options listing command like \hypersetup, to make ...
1
vote
1answer
76 views

Math mode macro in TeXstudio

I want to set up a macro in TeXstudio for math mode which displays $*$ and places the cursor at position *. So far I have tried using $%|$ but upon triggering, this macro does not allow text insertion ...
3
votes
3answers
42 views

Creating \newcommand from existing command

So I have been using the nomencl package with the following \newcommand, to save having to type the abbreviation and then the \nomenclature command: \newcommand*{\nom}[2]{#1\nomenclature{#1}{#2}} ...
3
votes
1answer
49 views

Custom “H” symbols for double affine Hecke algebra

I'd like to create some custom symbols for double affine Hecke algebras. Specifically, I would like to "double" the usual "H" symbols, for example $\mathcal{H}$, $\mathbb{H}$ or $\mathbf{H}$. By ...
0
votes
0answers
21 views

cannot get a navigation newcommand correct

Sorry, I did not read up extensively as I guess this will be easy for people experienced with newcommand. If you prefer to point to the problem and not right away solve it, thanks too. ...
1
vote
1answer
17 views

AUCTeX user Macros

I know that I can add my private macros to auto-completion feature of AUCTeX by running TeX-auto-generate. However the macros that AUCTeX "knows" seem to work better i.e. it automatically ask for the ...
8
votes
2answers
166 views

What is `\@gtempa` used for?

\@gtempa is used in a number of intermediate definitions, but I'm having difficulty finding how it is intended to be used (at least according to convention). I first ran across in this question: ...
4
votes
2answers
4k views

How can I get capital Angstrom symbol to appear in bibliography (using .bib file and natbib)?

I have search all around but cannot seem to find the solution for getting a capital angstrom symbol (an "A" with a small circle above it) to appear in the bibliography of my dissertation. Instead, it ...
7
votes
3answers
90 views

Measure remaining space on page and use it on another page

I want to measure the remaining space and use that number on another page. I tried the following: \documentclass[a4paper,12pt]{article} \usepackage[top=2cm,bottom=2cm,hmargin=2cm]{geometry} ...
8
votes
2answers
139 views

Using Macros within Loop

I was wondering if there is a way to use macro within a \foreach loop. For example some of my defined locals are: \newcommand{\labA}{Adult} \newcommand{\labB}{Adolescent} \newcommand{\labC}{Child} ...
3
votes
1answer
33 views

How to define Macros in forest (e.g. labeling edges)

I want to label single edges and branching ones with some style: For example, instead of edge label={node[right,midway,font=\scriptsize]{9}} I want to have \labelA[right]{\scriptsize}{9} and ...
1
vote
1answer
4k views

“There's no line here to end” in custom command

I am working on creating a resume in LaTeX and have defined a command that allows me to input my work experience. The only problem is that whenever I try to use an itemized list, as seen below, I get ...
0
votes
0answers
33 views

Transforming subenvironments

I need a way to access the subenvironments of an environment. So when I have code like: \begin{env} \somecommand{...} \begin{someenv} ... \end{someenv} \begin{A} ... ...
1
vote
1answer
21 views

\renewcommand in tabular with \input

I have generated a bunch of files (exp1.tex-exp10.tex) for different experiments that define my variables by \renewcommand{\minabserror}{\SI{0.01}{\meter}~}% ...
2
votes
1answer
249 views

Mass replace custom macros in a LaTeX document?

I'm typesetting a document and to make it more editable I'd like to find a nice way to write the document making custom commands left and right for my ease, then go and replace them with their ...
3
votes
3answers
130 views

Creating a macro that conditionally turns on an \iffalse and \fi

I'd like to construct a conditional \iffalse and \fi. Specifically, I'd like to define a counter and a macro such that if the counter set to one,the macro would either set an \iffalse, if the argument ...
2
votes
1answer
26 views

how to add table from word to texstudio using macro?

i have a table of 3 pages in the word document, and it will be very time consuming to copy and paste the individual entities from word to texstudio, please guide me any short cut to manage all these ...
5
votes
1answer
186 views

Get a command to ignore stuff in braces?

Update: @wipet's answer is nearly perfect, it seems like the only problem is that it doesn't work properly with safeinputenc: accented characters aren't capitalized properly and weird commands like ...
3
votes
1answer
317 views

fancyvrb inline verbatim with \newcommand and \CustomVerbatimCommand

I've just registered. This is my first question to this site. I am trying to make a verbatim command for inline code. This has been asked and answered many times before, but I never found a direct ...
2
votes
3answers
200 views

Macro in texstudio/texmaker to surround selected text with tags

When you use some of the predefined shortcuts in texstudio on selected text, it wraps the text with the appropriate tags(is that the proper term?). For instance, suppose i highlight Hello Worldand ...
4
votes
3answers
105 views

What is the best way to check if an argument of a control sequence is a control sequence?

I try to find a way actually I get update : \documentclass{article} \def\IsArgaCs#1{% \ifcat\relax\noexpand#1true \else false \fi% }% \begin{document} \def\a{a}% \let\b=~% \def\c{1}% ...