Questions tagged [protected-macro]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
3answers
128 views

Questions about `\cs_new:…` and friends and their TeX relatives regarding global, local, long, nopar, protected, expandable and naming

This question is two-fold. Unfortunately, one side is opinionated, i.e. something to close-vote, so I put that part at the end and hope no one notices... The other side (coming first) are serious ...
4
votes
3answers
62 views

\input{} inside \chemfig{}

I'm likely ignoring something fundamental here and was hoping for some hints. Please see the inset mwe. Towards having a library of chemfig symbols, I see value in being able to point to a ...
7
votes
1answer
65 views

Use of \noexpand in the implementation of \TextOrMath for eTeX

In latexrelease 2015/01/01, there are two implementations of \TextOrMath: one for regular TeX, the other one for eTeX-like engines (more precisely: those which support \protected). My question ...
2
votes
1answer
56 views

How to change zero to dotted zero in an enumitem label?

MWE \documentclass[a4paper,11pt]{book} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{enumitem} \makeatletter \protected\def\pmzerodot{% \nfss@text{% \sbox0{...
0
votes
1answer
49 views

Protect fragile variable in file path. Case of \ifthenelse in \includegraphics{}

In this script: \documentclass{article} \usepackage{ifthen} \usepackage{graphicx} \newcommand{\myfigure}[1]{% ...
9
votes
2answers
322 views

What is the difference between \unexpanded and \protected in ConTeXt?

EDIT: It turns out that \unexpanded in ConTeXt is different from \unexpanded in ε-TeX, so the earlier description doesn't apply. I'll update the question accordingly. From the ε-TeX manual: ...
1
vote
1answer
163 views

authblk with protected commands and pdflatex

When trying to use this answer to add a linked image to an author with the authblk package, somehow all the following text is shifted, with pdfLaTeX: \documentclass{scrartcl} \usepackage{scalerel} \...
1
vote
1answer
86 views

passing a parameter to nested macro inside caption

I'm having a really hard time understanding this error in a massive document. I took the time to work out a "minimal example", so I could post the error with precision. Please, when trying to answer, ...
0
votes
0answers
11 views

Extra White Space after iftenelse in Title [duplicate]

To begin, here is a MWE: \documentclass[12pt]{article} \usepackage{float} \usepackage{tikz} \usepackage{subfig} \usepackage{ifthen} \begin{document} \newcommand{\titlename}[1] { \ifthenelse{\...
3
votes
0answers
123 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 ...
1
vote
1answer
158 views

\protect vs \texorpdfstring in description lists' keys

I'm referring to chapters and sections in a description list. I want the link to include the chapter or section part as well. I found two options to achieve this: use \protect or use \texorpdfstring. ...
2
votes
1answer
64 views

New command within glossaries ›first‹ needs to be protected?

Consider following MWE \documentclass{scrartcl} \usepackage{xspace} \makeatletter \newcommand\BC{\,v.\,Chr\@ifnextchar.{}{.\relax\@\xspace}} \newcommand\AD{\,n.\,Chr\@ifnextchar.{}{.\relax\@\xspace}} ...
2
votes
0answers
139 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} \...
9
votes
1answer
328 views

Moving arguments and \protect: coming to grips with the definitions

I'm trying to understand the precise semantics of \protect as described in the beginning of section 11.4 Robust commands and protect of the source2e document, the annotated source code of the LaTeX2e ...
5
votes
1answer
439 views

How to unprotect a command to expand it?

This is another question about protection and expansion, that I still don't understand well… (and I guess this is my problem here). I read especially How do I "unprotect" an argument?, and ...
1
vote
1answer
185 views

Correct way to compare macro definitions that contain protected macros, e.g., bibnamedelima

I'm trying to compare the content of \partnamefamily of an author's name in biblatex against a manual definition that is stored in another macro, lets call it \family, using \ifdefequal. So, I have ...