{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
71 views

HZ typesetting system in plain TeX

How can I use the hz typesetting engine with plain TeX and pdfTeX? I read about it in TUG Vol 36 no.2, Peter Karow article, link: TUG Vol 36 no.2, Peter Karow.
5
votes
0answers
41 views

How to save and restore the nodes between tikzpictures?

The next code is not very interesting but it may illustrate correctly my problem. I have a lot of macros and I need actually a lot of temporary nodes. I tried until now to use different names,but ...
2
votes
0answers
35 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}% ...
4
votes
1answer
48 views

Why does having an empty definition, {}, when defining a new command execute whatever is between the brackets when the command is called?

Here is an MWE: \documentclass{article} \newcommand{\new}{} \begin{document} \new{Why is this printed?} \end{document} Which outputs a document that says "Why is this printed?". My main question ...
121
votes
3answers
23k views

What is the difference between \let and \def?

What is the difference between the \let and \def commands in TeX/LaTeX? Ideally please provide a simple example that will illustrate the difference between them.
5
votes
2answers
45 views

Checking if a subenvironment is unique inside an enviroment

I would like to define a environment inside another environment, but I need to make sure the new environment is unique, so there can only be of them. The unique environment should also be able to be ...
190
votes
5answers
46k views

What is the difference between \def and \newcommand?

Inspired by a question about \let and \def, I have some that essentially all boil down to asking What are the differences between \def and \newcommand? In particular, I wonder Is it possible to ...
1
vote
1answer
29 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 ...
3
votes
1answer
22 views

tikz - Multi-line text size

I am using this command: \newcommand{\orgnode}[2]{\node[shape=rectangle,draw=black,align=center] at (#2) {\Large #1};} to make basic ORG chart nodes. I want the text size Large. This works with one ...
59
votes
7answers
35k views

Isn't there any other way of doing double quotes in LaTeX besides `` + ''?

The standard way of writing quotes and double quotes in LaTeX is with `` and '', but I find them quite ugly. Isn't there something similar to \emph{}, but for quotes? I mean something like ...
1
vote
0answers
38 views

What is a good environment for writing problems and solutions? [on hold]

I'm writing a book where I record interesting problems and their solutions. However, there does not seem to be an organized list, or other reference to these types of latex packages and tex macros. ...
2
votes
1answer
177 views

How to remove LaTeX control sequences from a .tex document using plasTeX?

I need to get just the text and math expressions (ignoring tables, pictures and styling) from a set of LaTeX documents and represent them in html. Looks like plasTeX and MathJaX are enough for this ...
2
votes
1answer
40 views

Add an iterative layer to IfFileExists to check each graphicspath

I am collaborating on a project that started off with images stored on a server. Since everyone had a different path to get to this server I took advantage of a \graphicspath declaration in the main ...
3
votes
0answers
67 views

Aliasing a variable argument command into tabular environment [closed]

I am making a multi-language document. With the big help of Mr. Steven B. Segletes, I am able to deal with several languages mixed document, which can only output in wanted one or several laguages. ...
0
votes
0answers
42 views

How define a command auto insert some command and environment

I have a file like \tag{3.1.1}{ 3 section_name 3.1 subsection_name 3.1.1 subsubsection_name line1 afasf sht sa.fm th saf th adf. line2 afasf th asdfa lg..ag ;ag gasg line3 wfasdfasfsaf. ...
3
votes
1answer
93 views

Items from file in itemize environment

Is it possible to import items from a file into an itemize environment? For example, consider a file with just words and no formatting: Elem1 Elem2 Elem3 Elem4 ... Elem120933 I like to read in this ...
3
votes
1answer
19 views

Call a command where part of the command name is given as input?

This seems obvious but I can't seem to find what I need via a search (I can't figure out a good search term I guess). So what I'm looking for is to have a command that takes in a string, and then ...
2
votes
2answers
81 views

Conditional test inside command parameter

I want to call \includegraphics with parameter width= #1\textwidth if the number i have provided thru \mycmd is >= 1 and scale= #1 otherwise. I already saw this: Can I conditionally scale an image ...
11
votes
3answers
863 views

if test for 1 not 11

It may seem rather silly, but I can't find an answer for this question. (I've been looking for one for a while already). Suppose I want to have a macro with a single parameter. When this parameter ...
5
votes
0answers
18 views

Problem between keys, paths with two macros and pgfkeys

Sorry the code below for my minimal example is a bit long. In this code I defined two macros : the first macro \SC draws semi-circle and the second macro \ARC draws arcs. The first macro uses the ...
1
vote
0answers
52 views

Where to put plain TeX macros so MiKTeX finds them

I have MiKTeX 2.9 working except it can't find the files (.tex macros) when the source file (always plain TeX) refers to them as in \input mac2 I do have a TDS-compliant directory called ...
3
votes
1answer
46 views

Underscores in function arguments seem to change file names

I have been trying to pass a file name that contains underscores to a couple of nested commands. Since escaping each and every _ isn't really an option, I thought a group \catcode_=12 (had to remove ...
28
votes
2answers
896 views

How do I debug pgfkeys?

I'm sure if you're reading this question you are already familiar with my love for pgfkeys. However, it is absolutely impossible to debug: \tracingmacros is a total mess, with every key expanding to ...
9
votes
2answers
171 views

Interchange variables in LaTeX (to be used with TikZ)

I want to define a couple of variables in LaTeX and then exchange their values, like this (but it doesn't work): \newcommand{\signS}{$+$} \newcommand{\signT}{$-$} \newcommand{\signU}{} \signS ...
3
votes
2answers
74 views

edit the minimum length of \hfill

Once again I have a pretty special problem: I'd like to edit the minimum length of \hfill. According to de.wikibooks it is a TeX primitive. Therefore, I assume, that it can't be edited. What is it ...
3
votes
1answer
89 views

Bulk letter, “loop” doesn't work, “read to” doesn't work

Original Text below Edit: I solved it with endless googleing and help from here. Here is my theory: the typos caused expandafter to fail, which caused a dismatch between the chopline command and the ...
3
votes
2answers
121 views

Check if two labels are undefined

I'm struggling to test if there are two labels undefined, in order to include some specific files only in that case. Until now, I only needed one condition: workshop, so I was checking like: ...
0
votes
1answer
48 views

Alkenes and newman projections

Recently, I've written a latex document about stereochemistry, but i needed a lot of strange newman projection, I found lots of problem about alkenes. First of all, I had to draw alkenes, then my ...
4
votes
1answer
93 views

Best Key-Value System For LaTeX

I want to make new macros that support key=value style. But, there are many such packages for doing this. What is the best choice, given these priorities: Highly developed, complete, or actively ...
2
votes
2answers
60 views

Macro: compatibility of 1) Auto-colorization & 2) Auto-counter-and-title-to-label

This question is about asking to have the following 2 "workflows" (if you permit me to call them as such) to be able to coexist together in 1 Tex document: Workflow Auto-colorization (≅ User ...
2
votes
1answer
24 views

New command with an Underscore

I tried creating a new command with an underscore as shown below, but doesn't work. \newcommand{\h\_world}[1]{Hello World #1} At the output I see without even initiating the command : worldHello ...
4
votes
2answers
123 views

Automatically colourize all occurrences of certain strings (different colouring for different sets of words)

This question is a follow-up of Macro: Replace all occurrences of a word, but I would like the same for different colours, that is to have different pre-defined sets of text strings which will be ...
2
votes
1answer
25 views

Metapost : input file within macros

I like to have separate .mp files to organize my Metapost projects. But I'm facing this error message when I try to input file within a macro File names can't appear within macros. Even with this very ...
15
votes
0answers
121 views

Is there a reliable way to get the number of arguments of a command?

While pondering over a test to distinguish two versions of a command I came up with the following example: \documentclass{article} \begin{document} \def\testA#1{\#2->blabla} ...
5
votes
5answers
149 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. ...
2
votes
3answers
86 views

Loop, compare to macro value in condition and multiple macros if true

I seem to be stuck and for now am trying my luck through trial and error to find the right way to do this. Here is a general idea: % I DECLARE NEW MACROS WITH NAMES AS DEFFINITION. AND ASIGN LETTERS ...
1
vote
1answer
17 views

defining new functions such that their names have a normal font [duplicate]

There are predefined functions somewhere such that when you use them in default theorem environments, their names appear in a normal (non-italicized) font. I want to be able to define my own functions ...
0
votes
0answers
27 views

Keep Latex packages and templates on USB

I was able to install TExshop on my university's mac computer lab, but the IT people were only willing to install Basic Tex. The root of the problem is that the computers are refreshed every 15 ...
1
vote
0answers
17 views

Process a latex command if the current date is between two specified absolute dates [duplicate]

I need to process a latex command if and only if the current date is between certain months, say between april 15 and june 15 of any given year. I imagine it's possible with datetime.sty but all the ...
1
vote
1answer
35 views

Is there a simple way to create a local length

I want to redefine \textheight and \textwidth inside a \parbox. \textwidth works pretty well so far. But the textheight-part works only with the help of a \newlength. Unfortunately the \newlength will ...
2
votes
1answer
408 views

Insert text before end of page, and at the beginning of the next page

I'm putting a template together and I have created a custom command which I'm going to use to set specific margins on the text passed to its argument and a few more formatting things, like this: ...
1
vote
2answers
52 views

automatic word in color

I would like some text to display in red color. For Example paragraph text need to display in red color. My MWE is: \documentclass{article} \usepackage{times} \usepackage{amsmath,amssymb} ...
7
votes
2answers
59 views

How to handle syntax errors in a macro?

I would to indicate in the log file that if I use () instead of {} in the line \macro[red,circle]{2/3/a,4/4/b,5/0/c}, an error occurs . What is the best way to do this ? \documentclass{article} ...
1
vote
1answer
101 views

Is biber Turing complete?

I am wondering whether biber inherits Turing completeness from TeX. To show Turing completeness (without the requirement that the memory is infinite), we would need to emulate a Turing-complete ...
15
votes
1answer
578 views

What is the programming term for the command invoking '\' in latex?

I don't think it would be called a delimiter. Is there a specific term for this character? Just to clarify, I'm talking the slash here: \frac{1}{2}
5
votes
1answer
47 views

TeXstudio freezes when opening a macro

Since several weeks all my TeXstudio installations show this irritating behaviour: Write a macro like \cite, \input, \SI, \gls, \label, ... Type the opening bracket { As soon as typing the { the CPU ...
17
votes
1answer
538 views

How to display LaTeX code and the typeset version next to each other without repeating myself?

I would like to write some LaTeX code, and without repeating myself, I would like that to be used for displaying that particular piece of code as-is and its typeset version, next to each other. The ...
1
vote
0answers
33 views

Package that fills pages to total number of pages devideable by 4, 8, 16

I'm doing a package right now, which is capable of filling in empty or custom pages to get a total number of pages which is devideable by a defined number. I just want to make sure, that a package ...
4
votes
1answer
307 views

Numbers in \newcommand not working

I am trying to use the chosen solution shown here, for being able to use numbers in the alias I need for \newcommand. (That one is not able to use numbers in the alias directly strikes me as ... well, ...
1
vote
0answers
51 views

Macro: Replace all occurrences of words which are identical to content of \label{…} into \nameref{…} (unless of course the \label itself)

This question is a follow-up of Macro: Replace all occurrences of a word, but would like to ask for a possibility to do the same with words (e.g. foo) that are identical to the contents of certain or ...