2

I read how to change \emph and changed it to \DeclareTextFontCommand{\emph}{\bfseries}.

Now I want to create another command like \secondstyleformat which I can configure aswell. Such a format could be bold and italic. After writing the document I could change it easily to for example italic and blue. How can I do that?

  • 2
    A number in a LaTeX command does not work, so \emph2 is a syntax error. Try \BetterEmph or something similar – user31729 Jul 3 '14 at 10:03
  • 2
    You could teach \emph to look for the next token and, if it finds a 2 then use \itshape and, otherwise, \bfseries… But, why wouldn't you use a semantic command? What are you going to emphasize with this “\emph2”. – Manuel Jul 3 '14 at 10:06
  • 1
    @Manuel: I would not redefine the standard command \emph anyway. Better use logical markup, say for some text, which should be formated in special way, at first \textit{foo} and later on the decision to make in blue color and bold, it is better do use a command \newcommand{\makeitboldandcoloured}[1]{\textbf{\textcolor{blue}{#1}}}, in the preamble, so you can 1st easily detect and replace such markup to change the name or change the color etc, if needed. This requires a little categorization how certain text is to be formatted – user31729 Jul 3 '14 at 10:29
  • 2
    @ChristianHupfer I'm not recommending to redefine it: since he already did, I'm just asking to clarify what's his real problem… But you seem to have solved the “un-question” :P – Manuel Jul 3 '14 at 10:32
  • 2
    @user50224 You can use the same system you said at first: \DeclareTextFontCommand\makeitboldandcoloured{\bfseries\color{blue}}. – Manuel Jul 3 '14 at 10:36
4

There's nothing stopping you from doing

\DeclareTextFontCommand\makeitboldandcoloured{\bfseries\color{blue}}

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.