Every time I want a bold text, I want it colored blue. Currently, I am using:
\textcolor{blue}{\textbf{some bold and colored text}}
To save time, I can define a command to do both at once. How can I do it?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communitySimply
\newcommand\boldblue[1]{\textcolor{blue}{\textbf{#1}}}
1
and #1
works there? Your solution worked for me, but my attept was \newcommand{\boldblue}{\textcolor{blue}{\textbf{}}
and gave me a compile error and I'm trying to understand how that 1
and #1
that solves the problem.
1
means that the macro \boldblue
will have one argument*. Later #1
is a reference for the first argument of \boldblue
. * by the way: [1]
means that this is an optional argument of \newcommand
Jun 21, 2021 at 13:18
Another approach is to use font-switching commands within \DeclareTextFontCommand
, here:
\DeclareTextFontCommand{\bblue}{\color{blue}\bfseries}
\newcommand\bluebf[1]{\textcolor{blue}{\textbf{#1}}}
? This is \bluebf{blue bold text}