1

I am using MikTeX 2.9 on Windows 8.1. The PDF output of the Following TeX file does not display the word "example" in fore color or background color. I'm using TeXWorks editor - that comes with MikTeX - to generate the PDF:

\documentclass{article}
\begin{document}
This is an {\color{green}example} of fore color text.
This is an \colorbox{green}{example} of highlighted text.
\end{document}
1

add

\usepackage{color}

to the preamble

| improve this answer | |
  • 1
    Wouldn't it be better to send them straight to xcolor, or are there advantages of color? – Steven B. Segletes May 12 '15 at 16:54
  • 1
    MiKTeX includes perhaps xolor by default, but it is not part of base LaTeX, so that you have to load it. Also you should load xcolorrather than color, as @Steven B. Segletes commented. – Bernard May 12 '15 at 17:15
  • 1
    @nam You can also write the text colour as \textcolor{green}{hello}. – Alenanno May 12 '15 at 17:24
  • 1
    eqnarray is in the latex format (and shouldn't be used) you should use amsmath environments instead. @nam – David Carlisle May 12 '15 at 21:01
  • 1
    I think @SeanAllred missed the humor in your comment about color over xcolor. If the package developer doesn't stand up for his own package, who will? It's why I put up with abuse for stacking things that are traditionally done via the amsmath environments. – Steven B. Segletes May 14 '15 at 15:11

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.