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

3
votes
1answer
22 views

Using/Forcing upright text within theorem environment

I would like to write an equation within a theorem that involves an integrand and the upright symbol $ \textrm{d} $ which I have abbreviated in my preamble with \newcommand{\dmath}{\textrm{d}} ...
2
votes
1answer
38 views

How can I remove trailing \par when reading a file and writing the output to the log?

I put together a macro to write the contents of an external file to the log output. Unfortunately, I always read out the trailing \par that LaTeX adds when reading files. How do I test for this and ...
0
votes
0answers
20 views

Global variable to macros

Good day, I have a eskdi.sty style file where I define two command: \newcommand{\gostorganizatia}[2]{% \ifodd#1 % 1 - text; 2 - logo \gdef\@gostorganizatiaoption{1} ...
1
vote
1answer
31 views

Making csv2latex work with OSX El Capitan and TexMaker

I have encountered several difficulties making csv2latex work after excel2latex mysteriously failed after having worked fine for 2 years (no upgrades of office or anything)... I am using TexMaker as ...
64
votes
6answers
3k views

Which document class is being used?

Is there a way to programmatically determine which document class is in effect? I'd like to be able to write conditional macros that behave differently depending on which document class is currently ...
2
votes
1answer
35 views

Convert count into length

I want to decrease a length by a number (count). I tried some variations with \newlength{\temp} and \addtolength but I got problems there with the minus. I also tried variants with \dimexpr. The ...
3
votes
1answer
36 views

\expandafter to expand macro before macro call

I am trying to include an image: \documentclass{article} \usepackage{graphicx} \begin{document} \newcommand{\ext}{.pdf} \def\incPIC#1{ \expandafter\includegraphics{#1}} { \tracingmacros=1 ...
3
votes
1answer
66 views

Defining and expanding macros In loops

I want to define and expand macros in a \foreach loop. The names of the macros depend on the iteration step. The macros I define are interpreted as strings rather than sets of numbers that I actually ...
0
votes
1answer
60 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} ...
1
vote
1answer
445 views

How to check if the selected letter is uppercase or lowercase in a macro?

I'm using Texmaker and want to define some custom macros. The macros shall check if a selected letter is uppercase or lowercase and then replace that letter by a sequence defined in the macro. I need ...
0
votes
1answer
42 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
34 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
31 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
85 views

How to force edef to execute def [closed]

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
103 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
31 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
125 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
124 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
85 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
183 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
21 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
379 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
285 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
55 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
41 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
77 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 ...