{expansion} is about expanding tokens, including the manipulation of expansion order and the suppressing of expansion.
3
votes
1answer
1k views
Is there a LaTeX/TeX preprocessor/inliner that replaces only selected macros with their definitions?
I have the following situation:
Like most LaTeX users that write much, I have my own header files where the packages I use normally are required and the macros I use often are defined.
So if I write ...
3
votes
1answer
114 views
Converting command to result
Consider this example:
\documentclass{article}
\newcommand{\foo}{}
\newcommand{\currentbar}{\thebar}
\newcounter{bar}
\setcounter{bar}{0}
\makeatletter
...
2
votes
2answers
173 views
An expandable 'character scanning' command?
Please consider the following MWE, for a "character scanning" command "\looper" which utilizes \@tfor:
\documentclass{minimal}
\usepackage{trace}
\makeatletter
\newcommand\looper[1]{%
% ...
2
votes
2answers
172 views
Macro behaviour different inside tabular environment
I have a lot of problems lately with macros expanding (or not expanding) at unexpected times, so thought I was having a related problem here. But, in this case, things are working as I want outside of ...
2
votes
1answer
60 views
Pass the contents of an \input command to a macro
I am having some difficulty with the expansion of LaTeX. I would like to expand the contents of an \input command before passing them to macro, in a pattern similar to the following:
\outer{\inner}
...
2
votes
2answers
58 views
Undefined control sequence \pgfmath@
Why does the following code give me this error message?
Error
ERROR: Undefined control sequence.
--- TeX said ---
\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@
l.28 \draw ...
2
votes
1answer
64 views
At which point does \immediate\write write to file?
Assume I have opened a file myfile and write to it with
\immediate\write\myfile{My cat is too old}
I have multiple such statements in my document and do calculations in between which influence the ...
2
votes
1answer
128 views
Using “German” quotation marks inside \newcommand [duplicate]
Possible Duplicate:
babel shorthand "| doesn’t work in macros
I know there is a deeper non-understanding of LaTeX mechanics at work here, but I have no idea how to phrase my question ...
2
votes
1answer
89 views
Passing name ending with number to \csname does not work [duplicate]
Possible Duplicate:
macro names with special characters
When I use \yyy defined bellow it does not print yyy, but if I use \xxx it prints xxx. How can I make \yyy work?
\def\P1{yyy}
...
2
votes
1answer
81 views
Use result from pgfmath with xifthen
I try to use the results of pgfmath calculations with cnttest from xifthen, but it fails:
\documentclass{article}
\usepackage{pgf,xifthen}
\begin{document}
\pgfmathparse{42+77}%
...
2
votes
1answer
110 views
expandable optional parameter to enumerate environment
The MWE below, by using paralist package, is supposed to allow \begin{enumerate}[...] where ... is flexible in "some way" (inherits from enumerates above).
\documentclass[a4paper,10pt]{report}
...
2
votes
1answer
39 views
Specify file name shell access via \@@input
Background:
I need to perform a conditional branch based on the first three characters of a file. I found a rather simple solution (on a Unix system, or PC with cygwin installed):
head -1 ...
2
votes
1answer
181 views
How to add \hline to macro expansion?
I want to add one \hline to the macro expansion of this code, that is minimally modified version of David Carlisle's answer to Generating LaTeX tabular code during compilation.
Compiling this with ...
2
votes
1answer
75 views
Cutting string with formula or cite
I am trying to define a macro that would take a string and paint its ending, for example:
\def\paintString#1{%
\saveexploremode%
\exploregroups%
\textcolor{white}{\StrGobbleRight{#1}{5}}%
...
2
votes
1answer
243 views
meta-command - need help with expansion
To enforce labeling regulations in a document to be edited by ~50 users (imported subdocuments) i have to re-redine the existing document structuring commands part, chapter, etc to follow a predefined ...
2
votes
0answers
89 views
\ref, \autoref and hyperref expansion
I'm trying to write section numbers to a file with the newfile package.
In details, this MWE basically tries to write to a .ref file with lines like A-B. The A and B are generated by \label and \ref ...
1
vote
1answer
46 views
How to expand keyval options immediately
I am trying to build up a macro that creates other macros depending on kvoptions' options. But then, the outcoming macros are dependent on the actual state of the options instead of their state at the ...
1
vote
1answer
766 views
Expanding macro arguments in newcommand
I'd like to use datetime's \monthname as part of a command; consider this snippet of command line pdflatex use:
$ pdflatex
This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
restricted ...
1
vote
0answers
58 views
Expanded StrSubstitute
I am trying to use \StrSubstitute, but what I want is to expand it all the way to get the result string.
\StrSubstitute{Řepa}{Ř}{Rzzz}
then i use it with
% somehow define \a as the result string ...
1
vote
0answers
147 views
how to create a fully-expandable environment [closed]
I know DeclareDocumentCommand from the package xparse. I am wondering if there is a version for environment ?
I could also imagine a trick based on :
declare the environment with ...
0
votes
2answers
1k views
The argument of foo has an extra }.
I'm trying to write a command that does, effectively, an \fbox in something like an align environment. The following code works:
\usepackage{etextools}
\makeatletter
...
0
votes
2answers
75 views
suppress expansion in macro call
What I would like is to suppress the expansion of the group as a parameter to a macro so that it can be expanded later. For example we want to pass the paramater unmodified as a string to lua or to a ...

