New command to insert a couple of red XXX as placeholder?

1,680
\documentclass{minimal}
\usepackage{color}
\newcommand\ph{\textcolor{red}{XXX}}
\begin{document}
Foo \ph\space bar.
\end{document}

works just fine.

Share:
1,680

Related videos on Youtube

None
Author by

None

Updated on January 15, 2020

Comments

  • None
    None almost 4 years

    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)

    • Harald Hanche-Olsen
      Harald Hanche-Olsen almost 13 years
      Your suggested command works just fine, as my answer indicates. You will need to provide more detail, preferably with a minimal working example.
    • Admin
      Admin almost 13 years
      in your caption needs one command a \protect
    • Stefan Kottwitz
      Stefan Kottwitz almost 13 years
      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.
    • Hendrik Vogt
      Hendrik Vogt almost 13 years
      @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.
    • None
      None almost 13 years
      @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.
    • Hendrik Vogt
      Hendrik Vogt almost 13 years
      @None: I can't really see that this question is helpful since it doesn't tell me the code that produced the error. So I also fail to see how it could solve somebody's problem. In the future, please do provide a minimal example that illustrates your problem.
  • None
    None almost 13 years
    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.