0

I would like to change the color of italic throughout a document. This problem was solved here

Change colour of italics font for the whole document

It appears the solution for pdflatex does not work anymore in TeX Live 2020. The code below does not work on my system. Does anyone know how to fix this

\documentclass{article}

\usepackage{xcolor}
\makeatletter
\renewcommand{\itshape}{%
  \not@math@alphabet\itshape\mathit
  \fontshape\itdefault\selectfont
  \color{blue}%
}
\makeatother

\begin{document}
Some text in \textit{blue}
\end{document}

1 Answer 1

1
\documentclass{article}
\usepackage{xcolor}
\let\oldtextit\textit 
\renewcommand\textit[1]{\oldtextit{\color{blue}#1}}
\begin{document}
Some text in \textit{blue}
\end{document}

You have \oldtextit in case you need colorless italics.

If you want the result with \itshape, add the following line in the preamble, after the packages:

\let\olditshape\itshape 
\def\itshape{\color{blue}\olditshape}
7
  • Thanks, but this does not appear to affect anything written with \itshapesuch as references generated with bibtex.
    – 220284
    Apr 12, 2020 at 16:47
  • I've edited my answer so it works with \itshape. See again.
    – user193767
    Apr 12, 2020 at 17:02
  • Yeah, I also tried this. But this does not appear to work with bibtex.
    – 220284
    Apr 12, 2020 at 17:52
  • Maybe a more specific example of what you want would be helpful.
    – user193767
    Apr 12, 2020 at 17:55
  • Hm, specific in which way? I would like all text that is in italic to be typeset in blue. Your solution works for all text that I put in italic with \textit, but does not appear to work for text in italic that is generated by some other means, such as a reference generated with bibtex or the text in a mathematical theorem written with the amsthm package.
    – 220284
    Apr 12, 2020 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .