5
votes
1answer
68 views

Error output using \ifdefempty

I'm using TeX 3.1415926 (TeX Live 2013) and when I execute \documentclass{article} \usepackage{etoolbox} % contents \newcommand{\contentdesc}[2]{\item \ifdefempty{#2}{\textbf{#1}}{\textbf{#1}: ...
8
votes
4answers
214 views

Special macro definition (2opt, 1mand)

How can you define a macro \cmd in TeX primitives using two optional arguments (and a mandatory one) that fulfills the property that calling \cmd[opt]{mand} is equivalent to \cmd[][opt]{mand}. Yet, I ...
9
votes
3answers
300 views

Create macro with several options

I struggle to create a macro that can take several options. What I want to create is for \mycommand[up,middle]{Macro} to output Macro with 'up' and 'middle' specified. Using etoolbox in the MWE below ...
24
votes
3answers
2k views

How can I use \patchcmd with commands with optional arguments?

This question led to a new package: xpatch This is likely a simple question, but I'm getting stuck on the small details. I have an internal command, defined by a package as ...