Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I seem to misunderstand the documentation, as

\newcommand\ph{\textcolor{red}{XXX}}

causes pdflatex to halt. I'm not sure if this is the error:

! Argument of \sf@@subfloat has an extra }.

And I also don't know what it is referring to.

What I want to achieve is that

\myshortcommand

turns into

\textcolor{red}{XXX}

so the output is

XXX (in red)

share|improve this question
    
Your suggested command works just fine, as my answer indicates. You will need to provide more detail, preferably with a minimal working example. –  Harald Hanche-Olsen Jan 14 '11 at 20:41
    
in your caption needs one command a \protect –  Herbert Jan 14 '11 at 20:45
    
This \newcommand definition doesn't cause the problem. \sf@@subfloat is defined by the subfig package. So I guess, the problem is caused by a fragile command within a subfigure caption. You might look for that. –  Stefan Kottwitz Jan 14 '11 at 20:51
    
@None: You may also want to go ahead and delete this question (I read from your comment to the answer that it was just a problem with a typo, so the question is no longer relevant). For being able to delete, you have to register I guess. –  Hendrik Vogt Jan 14 '11 at 20:54
    
@Hendrik: The question is no longer relevant with regard to the problem caused by my typo, but it's a valid question with a valid answer, so it may solve somebody's problem. I should have commented the cause here instead of in Harald's answer though. –  None Jan 15 '11 at 16:30

1 Answer 1

up vote 0 down vote accepted
\documentclass{minimal}
\usepackage{color}
\newcommand\ph{\textcolor{red}{XXX}}
\begin{document}
Foo \ph\space bar.
\end{document}

works just fine.

share|improve this answer
    
Oops. I only now saw that the label argument of subfloat has an extra } (though hidden by my editor's syntax higlighting. :-( Thanks nonetheless for testing. –  None Jan 14 '11 at 20:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.