How Can I Use Colors in TeXnic?

  • Thread starter Thread starter PhizKid
  • Start date Start date
AI Thread Summary
To use colors in TeXnic, the correct package is \usepackage{color} or \usepackage[dvipsnames]{xcolor}, and it should be placed in the preamble, which is the section between \documentclass and \begin{document}. The color names must be in lowercase, such as "red" instead of "Red," to avoid errors like "Undefined color `Red'." If colors are still not displaying, checking the error log for additional messages may help identify the issue. Properly configuring the document with the correct syntax should resolve the problem.
PhizKid
Messages
477
Reaction score
2
I just got TeXnic yesterday and I'm trying to use colors, but usepackage{colors} doesn't work and I have xcolor or something installed from MiKTeX. I read that you put the usepackage in the "preamble" but I don't know where in the document that is.

So far I have:

Code:
 \documentclass[thmsa, a4paper,11pt, oneside]{book}
\usepackage{color}
\usepackage{amsmath, amsthm, amsfonts, amssymb}
\usepackage{array}
\usepackage[dutch]{babel}
%\usepackage{titlesec}  % to define "fancy" section head
%\usepackage{fancyhdr}  % to define page headings
%\usepackage{fancybox}  % to make title page
%\usepackage[dvipsnames]{color}  % colored title page
\usepackage{enumerate}

\setcounter{secnumdepth}{1}

%\renewcommand{\thesection}{\arabic{section}}


%\input{caligraphic}
%\input{greek}
%\input{fraktur}

\newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}} \newcommand{\Q}{\mathbb{Q}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\adjoint}[1]{{{}^\tau #1}}

\theoremstyle{plain}
\newtheorem{theorem}{Eigenschap}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Gevolg}

\theoremstyle{definition}
\newtheorem{exercise}{Oefening}[chapter]
\newtheorem{definition}[theorem]{Definitie}
\newtheorem{example}[theorem]{Voorbeeld}
\newtheorem{examples}[theorem]{Voorbeelden}
\newtheorem{remark}[theorem]{Opmerking}
\newtheorem{remarknohead}[theorem]{}


\renewcommand{\baselinestretch}{0.95}

\begin{document}

{\color{Red} test}

\end{document}

But no color showing yet.
 
Physics news on Phys.org
the predefined color names are in lower case, i.e. red not Red.
With the wrong version, I get the error message

LaTeX Error: Undefined color `Red'.

It would be worth trying to find out where TeXnic hid the error message, because other messages might disappear the same way. (I don't use TeXnic so I can't help you with that).

The "preamble" is everything between \documentclass{...} and \begin{document}.
 
Still no go, but I think this is the error log:

Code:
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9) (preloaded format=pdflatex 2012.9.5)  6 SEP 2012 18:54
entering extended mode
**C:/Users/Fizz/Desktop/LaTeX3.tex
(C:/Users/Fizz/Desktop/LaTeX3.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, 
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\book.cls"
Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\bk11.clo"
File: bk11.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: pdftex.def on input line 130.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count88
))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsmath.sty"
Package: amsmath 2000/07/18 v2.13 AMS math features
\@mathmargin=\skip43

For additional information on amsmath, use the `?' option.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amstext.sty"
Package: amstext 2000/06/29 v2.01

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks14
\ex@=\dimen103
))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen104
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsopn.sty"
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count89
LaTeX Info: Redefining \frac on input line 211.
\uproot@=\count90
\leftroot@=\count91
LaTeX Info: Redefining \overline on input line 307.
\classnum@=\count92
\DOTSCASE@=\count93
LaTeX Info: Redefining \ldots on input line 379.
LaTeX Info: Redefining \dots on input line 382.
LaTeX Info: Redefining \cdots on input line 467.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen105
LaTeX Font Info:    Redeclaring font encoding OML on input line 567.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 568.
\macc@depth=\count94
\c@MaxMatrixCols=\count95
\dotsspace@=\muskip10
\c@parentequation=\count96
\dspbrk@lvl=\count97
\tag@help=\toks15
\row@=\count98
\column@=\count99
\maxfields@=\count100
\andhelp@=\toks16
\eqnshift@=\dimen106
\alignsep@=\dimen107
\tagshift@=\dimen108
\tagwidth@=\dimen109
\totwidth@=\dimen110
\lineht@=\dimen111
\@envbody=\toks17
\multlinegap=\skip44
\multlinetaggap=\skip45
\mathdisplay@stack=\toks18
LaTeX Info: Redefining \[ on input line 2666.
LaTeX Info: Redefining \] on input line 2667.
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\classes\amsthm.sty"
Package: amsthm 2004/08/06 v2.20
\thm@style=\toks19
\thm@bodyfont=\toks20
\thm@headfont=\toks21
\thm@notefont=\toks22
\thm@headpunct=\toks23
\thm@preskip=\skip46
\thm@postskip=\skip47
\thm@headsep=\skip48
\dth@everypar=\toks24
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"
Package: amsfonts 2009/06/22 v3.00 Basic AMSFonts support
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 96.
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty"
Package: amssymb 2009/06/22 v3.00
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\array.sty"
Package: array 2008/09/09 v2.4c Tabular extension package (FMi)
\col@sep=\dimen112
\extrarowheight=\dimen113
\NC@list=\toks25
\extratabsurround=\skip49
\backup@length=\skip50
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\babel.sty"
Package: babel 2008/07/08 v3.8m The Babel package

*************************************
* Local config file bblopts.cfg used
*
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\bblopts.cfg"
File: bblopts.cfg 2006/07/31 v1.0 MiKTeX 'babel' configuration
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\dutch.ldf"
Language: dutch 2005/03/30 v3.8i Dutch support from the babel system

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\babel.def"
File: babel.def 2008/07/08 v3.8m Babel common definitions
\babel@savecnt=\count101
\U@D=\dimen114
)
Package babel Info: Making " an active character on input line 132.
))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\enumerate.sty"
Package: enumerate 1999/03/05 v3.00 enumerate extensions (DPC)
\@enLab=\toks26
)
\c@theorem=\count102
\c@exercise=\count103


LaTeX Warning: Unused global option(s):
    [thmsa].

No file LaTeX3.aux.
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
 
PhizKid said:
Still no go, but I think this is the error log:

That's most of the log file, but you didn't post last few lines, which is where the error message might be! What you did post looks OK.

FWIW I just changed Red to red in the document you posted, created a PDF, and it worked fine.
 

Similar threads

Replies
4
Views
3K
Replies
3
Views
2K
Replies
8
Views
12K
Replies
4
Views
12K
Back
Top