{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
0answers
25 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
174 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
18 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
80 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
861 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
17 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 ...
4
votes
2answers
32 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 ...
1
vote
0answers
50 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
169 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
117 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
575 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 ...
2
votes
3answers
50 views

Ignore parenthesis contained in a macro parameter

I want that the macro ignore the parenthesis which are parts of the parameter and only conside the last parenthesis as the delimiter, I found a solution with \text{}. Are there any better (and ...
4
votes
2answers
34 views

ifboolexpr with a list of toggles - true if any toggle is true

I'd like to write a single file with a collection of e.g. questions, but I want to produce various outputs with a different subsets of all questions each. So at the beginning of my file I want to ...
4
votes
2answers
83 views

Conflict when using \newcommand

I've just realized that I made a big mistake sometime ago when in my preamble I defined the new command \renewcommand{\v}{\mathbf{v}} Now, I'd like to type the czech s using \v{s}, but I can't. ...
1
vote
1answer
25 views

How can I keep everything within a variable/macro on the same line?

I know there are various techniques to keep things on the same line. I have a two-word variable input. For example, Settings App. Let's say there are a group of apps, and I would like them always ...
4
votes
2answers
125 views

\bold in math environment

Having forgotten the command to make text bold in math mode I naively tried $\bold{bold var goes here} these maths symbols are not bold$ and it worked! I became immediately suspicious as I know ...
4
votes
3answers
359 views

Small caps in footnote in title (amsart)

I am trying to add a footnote to a title in amsart in small caps, but constantly end up with upper case characters (even in math mode). \documentclass{amsart} \title{ text \footnote{ text }} ...
2
votes
1answer
45 views

Macro to auto-convert english quotes (“”) to french («»)

French quotes can easily be obtained using \og and \fg commands. Although this is perfectly fine, it's not very intuitive to use them when typing. Is there a way to make latex automatically ...
1
vote
1answer
34 views

TikZ: cannot extract coordinate from intersection point

I am applying the solution proposed in this answer in order to automatically draw a vertical line at the point where to functions intersect. That solution implies creating a new commands that receives ...
7
votes
2answers
61 views

read and write commands to auxfile

I have a problem with the aux-file. According to some posts here on Tex-Exchange, the aux-file is read at the beginning of the document (is this at \begin{document} or \documentclass? I wanted to ...