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?

user50224
  • 417
  • 1
  • 3
  • 11
  • 2
    A number in a LaTeX command does not work, so \emph2 is a syntax error. Try \BetterEmph or something similar –  Jul 03 '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 03 '14 at 10:06
  • It's not about calling it \emph2. I just want to have another styling format that I can change in the preamble. – user50224 Jul 03 '14 at 10:13
  • I find it strange, why emph changes font style to \bfseries, but ok... You can declare your font style commands with \newcommand{\OtherFontMarkup}{\itshape} or use `\DeclareTextFontCommand, if necessary, I do not get what the issue might be –  Jul 03 '14 at 10:21
  • In my opinion it's better to be able to change your formating afterwards. For example if I come across that italic doesn't look nice I want to be able to change it bold for example. but if I have written the text with \textit{} then I will have to change every single italic phrase in the text. But for example, I can change \emph in the preamble by \DeclareTextFontCommand{\emph}{...}. – user50224 Jul 03 '14 at 10:23
  • @user50224 So, what's the problem? If you are not going to use \emph and this \emph2 at the same time, what's the inconvenience of just changing the definition of \emph? – Manuel Jul 03 '14 at 10:25
  • 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 –  Jul 03 '14 at 10:29
  • @ChristianHupfer: That's exactly what I wanted to do. Thanks. – user50224 Jul 03 '14 at 10:32
  • 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 03 '14 at 10:32
  • @Manuel: Sorry, I misunderstood you. –  Jul 03 '14 at 10:34
  • @Manuel: I just wanted to create a formatting style like Christian's \makeitboldandcoloured – user50224 Jul 03 '14 at 10:34
  • @user50224: Please edit your post and make it clear, since I sense a presence, I have not sensed a long time ago ... the close voting force ;-) –  Jul 03 '14 at 10:35
  • 2
    @user50224 You can use the same system you said at first: \DeclareTextFontCommand\makeitboldandcoloured{\bfseries\color{blue}}. – Manuel Jul 03 '14 at 10:36
  • 1
    @Manuel: Yes, it is even better to use \DeclareTextFontCommand instead of my proposition via \newcommand, see http://tex.stackexchange.com/questions/47259/why-use-declaretextfontcommand-vs-just-newcommand –  Jul 03 '14 at 10:43

1 Answers1

4

There's nothing stopping you from doing

\DeclareTextFontCommand\makeitboldandcoloured{\bfseries\color{blue}}
Manuel
  • 27,118