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}
xcolor, or are there advantages ofcolor? – Steven B. Segletes May 12 '15 at 16:54xolorby default, but it is not part of base LaTeX, so that you have to load it. Also you should loadxcolorrather than color, as @Steven B. Segletes commented. – Bernard May 12 '15 at 17:15\textcolor{green}{hello}. – Alenanno May 12 '15 at 17:24\usepackage{amsmath}to use the ams math environments (or a class that does that, such asamsart) It is not loaded by default. – David Carlisle May 12 '15 at 18:07mptopdfwhich seems strange, did you do a minimal initial installation? – David Carlisle May 12 '15 at 18:09\usepackage{amsmath}. I also checked in the miktex package manager that amsmath package was among the installed packages and it's installation date shows as the date when I installed the MikTex. I installed MikTeX on Jan 4, 2015. – nam May 12 '15 at 18:23\usepackage{amsmath}:\begin{eqnarray} x^2 + y^2 &=& 1 \\ y &=& \sqrt{1 - x^2}. \end{eqnarray}The following gives an error (if not using the \usepackage{amsmath} in the preamble) as: "LaTeX Error: Environment align* undefined":\begin{eqnarray} x^2 + y^2 &= 1 \\ y &= \sqrt{1 - x^2}. \end{eqnarray}. – nam May 12 '15 at 20:40eqnarrayis in the latex format (and shouldn't be used) you should useamsmathenvironments instead. @nam – David Carlisle May 12 '15 at 21:01color, David :-)xcoloris just... plain better. @nam, see http://tex.stackexchange.com/q/89763/17423. Also, if you don't havexcolorinstalled by default, you likely chose a very minimal installation with automatic package installation. I guarantee you will have problems if you continue to use TeX like this. – Sean Allred May 12 '15 at 22:04coloris all you need, and is guaranteed to be in any LaTeX installation. – David Carlisle May 12 '15 at 22:08xcoloris preferred when available (and very often loaded by other packages anyway) even ifcoloris all that's required here. Your answer is correct, it's just not good for beginners, in my honest opinion :) – Sean Allred May 12 '15 at 22:10coloroverxcolor. 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 theamsmathenvironments. – Steven B. Segletes May 14 '15 at 15:11