0

I'm using little markers in some parts of my text and I wanted to add one of those to a paragraph entitling a list:

\newcommand{\hip}{{\color{BlueViolet}\framebox[1.1\width]{HIP}}}

\paragraph*{\hip{} Following that description, we can infer the following hypothesis:}

However, that fails with:

! Use of \reserved@a doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                              #2}\def \reserved@b {#3}\f...
l.219 ..., we can infer the following hypothesis:}

! Use of \@framepicbox doesn't match its definition.
\@ifnextchar ...eserved@d =#1\def \reserved@a {#2}
                             \def \reserved@b {#3}\futu...
l.219 ..., we can infer the following hypothesis:}

Both errors come with this explanation, that doesn't make sense for me... "If you say, e.g., '\def\a1{...}', then you must always put '1' after '\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it."

What does it mean and how do I fix that?


Example of command in a normal text line:

hypothesis box

  • 1
    there's not enough here to actually test this, but i think that if you add \protect just before \hip this will probably work. this is the old "fragile" command situation. – barbara beeton Mar 8 '15 at 19:44
  • Do you really want to use \paragraph? Why not just set it without a \paragraph? – Werner Mar 8 '15 at 19:45
  • Compiles fine here if I add a standard preamble. Please post a complete MWE so we can reproduce the problem. – cfr Mar 9 '15 at 2:57
  • @barbarabeeton I'll be happy to accept your comment as an answer! That solved the matter. – igorsantos07 Apr 25 '15 at 2:45
2

without evidence to the contrary, \hip appears to be a "fragile" command.

adding \protect before a fragile command in a "moving argument" (the argument to a command like \paragraph that can potentially also be used somewhere else, such as in the toc) will avoid the problem. so here, \protect\hip.

more information on this situation can be found with the question What is the difference between Fragile and Robust commands?

1

I don't have any errors using the following:

\documentclass{article}
\usepackage{color}
\definecolor{BlueViolet}{rgb}{0.54, 0.17, 0.89}
\newcommand{\hip}{{\color{BlueViolet}\framebox[1.1\width]{HIP}}}
\begin{document}
\paragraph*{\hip{} Following that description, we can infer the following hypothesis:}
\end{document}

I had this output:

enter image description here

0

The issue was solved by using \protect, as suggested by @barbarabeeton. If she posts an answer I'll be happy to remove this and accept hers :)

\paragraph*{\protect\hip{} Following...}

On @qzx's answer and @cfr's & @Werner's comments:

I didn't add a preamble because mine's way too big, and I thought it wasn't an issue with it. It might be an issue with default commands and formatting from ABNTex2 (a document class that brings together all Brazilian formatting patterns), as this is the one that alters most stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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