Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [robust-commands]

The tag has no usage guidance.

5
votes
2answers
53 views

How to extend the elements package to print melting and boiling points?

To my propose I would like to extend the elements package to print too the melting and boiling points of chemical elements. Using the same logic used in elements package, I thought about creating ...
0
votes
0answers
28 views

Removing commands from input to command

I'm trying to create my own command to highlight some changes. I want the command to update a counter, add a line in the contents table and do some changes in the text. So far, I got: \...
2
votes
0answers
27 views

Help Understanding/Adapting the Definition of Beamer's 'lecture' Command

Beamer's 'lecture' command has been a great way for me to have all my lecture notes in one document, but typeset only the segments that I need for any given day/week of class. Ultimately I would like ...
0
votes
0answers
54 views

Expand one more time as needed? To compose with a macro that requires a maximally expanded argument?

Consider the case below as a minimal example. But the questions concerns understanding nonfragile composition of macros each which parse using something like xparse. (code below thanks to egreg) \...
0
votes
1answer
36 views

Robust command for tikz yshift

I created a robust command declared in preamble to include a small figure in the text. \DeclareRobustCommand\mytikzcell{\tikz \tikzset{b2block/.style = {rectangle split, rectangle split parts=1, ...
2
votes
0answers
98 views

Automatically `\protect` arguments sent to existing command

Say you are using titlecaps and you have the following code: \documentclass{article} \usepackage{titlecaps} \begin{document} \def\makemytitle#1{{\Large \titlecap{#1}}} \makemytitle{The lazy fox ...
3
votes
1answer
136 views

Redefining \bfseries command

I am trying to redefine \bfseries to become a spacing-out command. The easiest way is to redefine it as \so macro from the soul package. The trouble is, \so takes an argument (and thus is analogous to ...
2
votes
0answers
121 views

Write fully expanded macros to auxiliary files

Considering the following code snippet: \documentclass{article} \usepackage{xparse} % \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \NewDocumentCommand{\edeftest}{m}{\edef\test{#1}#1} \...
1
vote
1answer
48 views

Condition statements in commands

I need to have references in some algorithms and for this I want to have a command which can take 3 parameters, the first being the key of the algorithm and the second and third being options for ...
1
vote
1answer
103 views

Redefining Commands Using DeclareRobustCommand

I am trying to create the following commands. I want to replace \exp by a command that takes an input and outputs \exp(#1). Trying to copy something that I was shown before, I tried the following \...
4
votes
1answer
174 views

scrlayer-notecolumn `\makenote` with `BibLaTeX`

Continuing my journey into BibLaTeX + scrlayer-notecolumn. I thought, once I had the BibLaTeX working with \marginpar it would all be easy. But not so. I want to create my sidebar using the scrlayer-...
5
votes
1answer
107 views

Does ConTeXt have fragile commands?

A fragile LaTeX command is (link) a command that expands into illegal TeX code during the save process. Does ConTeXt "suffer" from fragile commands, or are all commands there robust?
14
votes
1answer
490 views

List of deprecated commands and their `appreciated' alternatives

I'm wondering if there is a list of deprecated LaTeX commands and suggestions for commands that are to be used instead.
3
votes
1answer
75 views

Indexing and robust commands

I need to do a little massaging of my index entries before putting them into the index, so I defined a helper command. For the MWE, I'll just let the helper pass straight to \index. \documentclass{...
1
vote
2answers
270 views

Why does redefining \contentsname conflict with redefining \section when there is a \tableofcontents?

I am trying to modify the title of table of content and make every title of sections uppercase. But strange compilation errors occurred. The .tex file looks like the following one: \documentclass{...
7
votes
3answers
257 views

\def inside of \def not visible in titles or captions

The following MWE yields a compilation error: \documentclass{article} \usepackage[english]{babel} \begin{document} \def\AAA#1{\bgroup\def\contents{AAA}#1\egroup} \def\BBB#1{\bgroup\def\contents{BBB}...
3
votes
1answer
170 views

random numbers scaled into parametrized intervals

MOTIVATION: To point shade a diagram. Points have random coordinates. They cluster around hidden user input coordinates more or less far out depending on those inputs. How would one use \...
7
votes
1answer
155 views

Passing a macro defined by \newrobustcmd to another macro causes some problems while \DeclareRobustCommand doesn't!

I wrote a macro for slicing any part of string. It works with ordinary strings but when a string defined with \newrobustcmd passed to it, the macro doesn't work and causes error. (in case of using \...
7
votes
7answers
2k views

newcommand with comma separated argument, and optional arguments

I want to define a command (not with \def) the simplest possible way that it takes arguments separated by a comma, supports an optional argument (the first one). maybe another solution with extra ...
4
votes
1answer
362 views

Robust commands

What is the primary reason to \protect new definitions or macros, or use \DeclareRobustCommand rather than just \def? (If it is primarily to do with better error messages, I personally can live with ...
1
vote
1answer
190 views

Command line option to get tree view structure of LaTeX project

I would like to get a tree-view of a latex project showing things like sections, chapters, figures. - Table of contents - Introduction (1.0) --- fig 1 fig one title --- fig 2 fig two title - ...
15
votes
1answer
315 views

A robust command for French-style intervals

In France, we usually write open or half-open intervals as ]a,b[ or [a,b[, not (a,b) or [a,b). I especially do not like (a,b) as it can be confused with an ordered pair. I have therefore defined an \...
7
votes
3answers
393 views

Cause DeclarePairedDelimiter to switch starred and nonstarred versions

I've made lots of use of the answer here, which shows how to switch the starred and nonstarred versions of a paired delimiter command (causing the regular version to automatically size the delimiters)....
2
votes
0answers
38 views

Can I force a pre-process action on all commands or environments without having to redefine them all manually?

I am trying to preserve a history of the latex commands and environment initializations I use in a typeset html or pdf file. Is there a way where I can force a pre-process action on all commands ...
5
votes
0answers
117 views

Strings and memory usage [closed]

The TeX engine was originally written in Pascal before dynamic memory allocation was generally available. Modern implementations tend to be done in C. To qualify as TeX an implementation has to pass a ...
3
votes
1answer
892 views

Use \raisebox with \depth in caption

I want to use \raisebox in a caption. I know that \protect is often needed in these situation, but this (and other combinations I have tried) does not work: \documentclass{article} \begin{document} ...
7
votes
1answer
229 views

Clarification about moving arguments

I was reading in latex2e about the use of \protect. In section 13.8 it mentions "expressions in tabular and array enviornments" as examples of moving arguments. I was a bit surprised by this. Could ...
3
votes
1answer
295 views

How can I, if possible, create a command whose output is dependent on an argument/parameter for language switching?

Question I would like the ability to work with macros in multilingual (xelatex) documents. Example Situation I have a large document in 8 languages that share a common preamble. I decide there is ...
1
vote
2answers
120 views

User-defined parentheses that can span across more lines

I usually define some command of the kind \newcommand{\paren}[#1]{\left(#1\right)} to make the use of parentheses more agile. Now, if in the body of my document I do this \begin{align} z = \paren{y\...
3
votes
1answer
157 views

How to make a function inside the tikzpicture behave like outside

I have a macro which generates a structure (rule) and a reference to that structure. It does not behave when inside a tikzpicture. How to make the function robust to reference the structure even when ...
7
votes
2answers
266 views

robust version of \@ifnextchar?

The command \@ifnextchar cannot be used in a \section and the like. It fails with a "TeX capacity exceeded" message. This is pretty clearly related to the recycling of the section name for the table ...