Basic question about colors 

Date:          Tues, Jul 19 2005 3:36 am
Groups:        comp.text.tex
> I'm beginner in LaTex, I would like to add some nice colors
> in my LaTex document.
> Is it possible? I use directly pdflatex.

Yes:

\documentclass{article}
\usepackage{color}
\begin{document}
I like \textcolor{red}{colored text}.
\end{document}

See grfguide.ps for more information. (Run "texdoc grfguide" if your TeX installation comes with the texdoc program.)

> And is it also possible to add easily tables with background color on
> the cells and different foreground color on the text?

Yes. Check out the colortbl package, which is available from CTAN (http://www.ctan.org/) if you don't already have it on your computer.

Scott Pakin

Basic question about colors 

> Is CTAN a site which contains TeX modules as like CPAN for Perl modules?

Yes, only it's the other way around: CPAN is very much inspired by CTAN.

For your color questions: I can only suggest you use the xcolor package: provides the same features as color but adds much, much more. It is already part of teTeX 3.

Morten

Basic question about colors 

> What is main differences of xcolor package from color package?
> Thank you in advance.

Mixing colours is very easy, convertion between colour models is also easy, there are some useful macros for colouring tables plus some other things. Have a look at the manual, it has a list and lots of examples.

Morten

Colour text 

Date:          Sat, Jan 17 1998 12:00 am
Groups:        comp.text.tex
> And what are the TeX commands to produce this colour text ?
  If you want Plain TeX commands, I think you are SOL (if I'm wrong, someone
correct me on this).  LaTeX2e is the easiest way to get TeX to produce color
output.  (Strictly speaking, this is wrong: TeX doesn't produce color output.
All TeX will do is ship \special commands to the dvi file, and you need a dvi
viewer/printer that can interpret these \special commands to produce color when
printed.  The easiest route to get color output is to use LaTeX2e, convert the
dvi file to a ps file via dvips, then print the ps file (if you don't have a
postscript printer, use Ghostscript/Ghostview).)
  If you look at pp.~131-132 and pp.~224-225 of Lamport's book (second
edition), you'll find the information you want.  If you don't have a copy of
this book, get one.  It has the answers to a lot of frequently asked questions
(you'll not only find it helpful, but it will keep you from irritating people
on this group by asking questions that you could answer yourself by consulting
the appropriate text).

Example:

\documentclass{article}
\usepackage{color}
\begin{document}

This is some \textcolor{red}{red text}.
This is some \textcolor{blue}{blue text}.

\definecolor{magenta}{rgb}{1,0,1}

This is some \textcolor{magenta}{magenta text}.

\end{document}

Jason Alexander <j…@ea.oac.uci.edu>

Colour in documents 

Date:          Mon, May 6 2002 9:48 pm
Groups:        comp.text.tex
> I am aware that the TeX system is a type setting tool, but can you
> change the colour (or color if you prefer...) of text and add colour
> images? or watermarks on pages and similar?

Yes, on all counts.

Indeed, you can do some pretty interesting things if you combine the abilities of TeX and PDF.

For example, see

http://www.maths.man.ac.uk/~mheil/Prosper/ProsperGraphicsDemo.pdf

which was generated with LaTeX, the "prosper" class, and ps2pdf (although the quality would've been better using adobe distiller, most likely).

Myself, I've used LaTeX, the "seminar" class, and adobe's distiller for some decent results, like http://www.menet.umn.edu/~kaszeta/download/defense.pdf (warning, it's two megabytes)

I've also seen nice work down with PPower4, http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/

Richard Kaszeta

Colour in documents 

> Is there a place hidden on CTAN somewhere which tells you the options for
> graded backgrouds/watermaks colour of text and the like....

A good resource is at the local bookstore, "The LaTeX Graphics Companion" by Goosens, Rahtz, and Mittelbach. It covers, among other topics, the LaTeX2e graphics/graphicx package, PStricks (which is what I've used for my example), XYPic, Color, and a bunch of random graphics-related packages.

For example, the following sample document has shaded color backdrops, colored bullets, and borders

\documentclass{seminar}
\usepackage[usenames]{pstcol}
\usepackage{pst-grad}
\usepackage{graphicx}
\usepackage{pifont}
\usepackage{semcolor}

% Basic Color Defs used within this file
\definecolor{lightblue}{rgb}{0.3296, 0.6648, 0.8644}    % Sky Blue
\definecolor{shadowcolor}{rgb}{0.0000, 0.0000, 0.6179}  % Midnight Blue
\definecolor{bulletcolor}{rgb}{ 0.8441, 0.1582, 0.0000} % Orange-Red
\definecolor{bordercolor}{rgb}{0,0,.2380}               % Midnight Blue

\psset{shadowcolor=shadowcolor} % Set all shadowdrops to same color

% Change itemize environment to use funky color bullets
\renewcommand{\labelitemi}{\textcolor{bulletcolor}{\ding{118}}}
\renewcommand{\labelitemii}{\textcolor{bulletcolor}{\ding{224}}}
\renewcommand{\labelitemiii}{\textcolor{bulletcolor}{\ding{51}}}

% Define some nifty shaded backgrounds
% Nice shaded blue background:
\newslideframe{gradframe}
   [\psset{framesep=12pt,linecolor=bordercolor,fillstyle=gradient,gradend=white,gradbegin=lightblue,framearc=0.1,gradmidpoint=0.8,linewidth=0.5pt}]{\psframebox{#1}}

% Use our newly-defined gradient style
\slideframe{gradframe}

\begin{document}

\begin{slide}
\textbf{Sample Slide}
  \begin{itemize}
    \item One item
    \item Another item
  \end{itemize}
\end{slide}

\end{document}

And on my system (with teTeX-1.0 and adobe distiller), to get the pdf of this I ran[1]

latex file.tex dvips -Pcmz -o file.ps file.dvi distill file.ps

(This is a case where you can't use pdflatex, it doesn't know what to do with the pstricks macros. But even there, if you're on linux you can do much of the pstricks stuff with VTeX[2] from Micropress)

> are all the pictures in your thesis coulour inports (the photos obvously
> are) or is it mostly due to acrobats distiller?
> curoius how did you get the picture as a backgroud and then lable it with
> TeX... at least thats what it looks like you have done for the boxes at
> least (page 24, figure 2.5) and get it landscape....

I'll have to admit, this wasn't a pure LaTeX solution. In fact, to get it looking perfect it was a little complicated:

  1. I loaded the image into XFig under linux

  2. I added annotations, and exported it as an EPS. This was *mostly* right, except that I wanted the annotations from Xfig to match the font of the running text.

  3. So I used psfrag to replace the text I added with XFig with text in the current font

(Let me know if you want an example, I can make a simpler one).

However, you *can* get almost the exact same result using either the picture environment, or PStricks pspicture environment.

Watermarks can be done too, although how they are done varies on whether it's a text watermark or a graphic. For basic text watermarks, draftcopy.sty is pretty good.

For more elaborate stuff, like graphics, look at eso-pic.sty, or watermark.sty (I've only used the latter).

(For those following along, we're mostly talking about http://www.menet.umn.edu/~kaszeta/download/defense.pdf and similar use of color in LaTeX, or also http://www.kaszeta.org/rich/phdthesis.pdf)

[1] I've got vanilla teTeX-1.0, and the -Ppdf option to dvips never works. Is this normal?

[2] Disclaimer, it's been a while, so take any comments of mine on what VTeX does/doesn't do with a grain of salt.

Richard W Kaszeta

Colour in documents 

> as I'd prefer to stick with
> pdflatex, as I think it renders better than the likes of ps2pdf, or am I
> totally wrong? (having said that, using pdflatex rather than latex
> hinders latex2html <- more configuration options! <ack> so many
> choices....)

In general, I've found the best results almost always come from using Distiller, but that's since I use a lot of things that pdflatex can't handle. For cases where I'm not doing such things, pdflatex really works well, so I do use it on occasion.

ps2pdf doesn't really do a conversion, it uses ghostscript to do the conversion, and the quality of the result depends highly on (a) making sure you have appropriate type1 fonts in teh source document, and (b) are using a recent version of ghostscript.

background shading a table row 

Newsgroups: comp.text.tex
> i can background shade a row of text with the following sequence:
>   \colorbox[gray]{0.90}{\makebox[\textwidth][l]{#1}}
> how can i do that for a row of a tabular-table?

Use the colortbl package. It has a \rowcolor command.

Piet van Oostrum

Sample \rowcolor command 

\begin{tabular}{|l|c|}
\rowcolor[gray]{.9} one&two\\
\rowcolor[gray]{.5} three&four
\end{tabular}

NB, this command is not recognized by either latex2html or latex2rtf.

Table features 

http://www.mip.sdu.dk/~mads/latex.php3

It is also possible to make some nice things on the tables. If you want to have some of the rows with color you can use the package colortbl.sty. If you for instance want to make a small table with a black row then use can small example could be:

Preamble:
\usepackage{colortbl}


Example:
\begin{table}[!ht]
\begin{center}
\begin{tabular}{ |c| }
\hline
\rowcolor{black} \\
\hline
Hello World\\
\hline
\end{tabular}
\caption{\label{SomeLabel} The Caption!}
\end{center}
\end{table}

The LaTeX colortbl package 

http://www.mackichan.com/index.html?techtalk/476.htm~mainFrame

The package produces colored background panels and rules for specified columns or rows of a table or array. Colortbl implements LaTeX support for color when the active dvi driver can produce colored text.

You can add color to a row in a table by inserting a package command in the table. Adding color to a column is more complex: you must enter the colortbl package commands, along with commands for the entire tabular environment, in an encapsulated TeX field. You indicate the size of each color panel and the corresponding color you want with commands placed at the start of the tabular environment.

The basic command syntax is as follows:

\columncolor[w]{x}[y][z] or \rowcolor[w]{x}[y][z]

where

w is the color model: rgb (red, green, blue); cmyk (cyan, magenta,
yellow, black); gray; or named (names known to the selected driver),
x is the selected color,
y is the amount of left overhang past the widest entry in the column, and
z is the amount of right overhang past the widest entry in the column.

See the package documentation for instructions and for additional examples of package effects.

How to add color to a table row 

  1. Add the colortbl package to your document.

  2. Create a table.

  3. Place the insertion point in the table at the beginning of the row you want to appear in color.

  4. Enter an encapsulated TeX field.

  5. Choose OK.

How to add color to a table column 

  1. Place the insertion point where you want the table to appear.

  2. Enter an encapsulated TeX field.

  3. In the entry area, enter the complete tabular environment.

  4. Place the insertion point at the beginning of the column you want to appear in color.

  5. Choose OK.

Many driver options are available through the Options and Packages command on the Typeset menu. The package is installed in the TCITeX/TeX/LaTeX/contrib/supported/carlisle directory. It should work successfully with other packages that have syntax compatible to that of the array package, such as longtable and dcolumn.

MacKichan Software, Inc

colored tables or similar in headings 

Newsgroups: comp.text.tex
Date: 08 Apr 2003 19:11:09 -0700
> Black        > S u m m a r y
> Green        > ---------------------------------------------------
> White/Orange > Special Report                         Anthony Wood
> Green        > ---------------------------------------------------

OK, I would do the following

\parbox[b]{\textwidth}{%
  Summary\strut
  \color{green}
  \hrule
  \colorbox{orange}{\textcolor{white}{\makebox[\linewidth-2\fboxsep]{
    Special Report \hfill Anthony Wood }}\strut}
  \hrule
}

(Actually, I wouldn't use green and orange together :-)

Donald Arseneau

colored tables or similar in headings 

This worked for me, after some fiddling, grepping, etc:

\newcommand*{\REPORT@mkheadx}{%
\parbox[b]{\textwidth}{%
\trebuchet\LARGE\REPORT@heading\large\strut
\color{green}\hrule height .25em
\colorbox{orange}{\textcolor{white}{\makebox[\linewidth-2\fboxsep]{
\REPORT@title \hfill \REPORT@partner}}\strut}
\hrule height .25em
}}

Now I just have to work out how to get the section name into the header, and how to make the header landscape on a landscape page.

Woody

colored tables or similar in headings 

> Now I just have to work out how to get the section name into the header,
     I presume you have looked at the fancyhdr package. In any case
\sectionmark is how to access the section title (similarly \chaptermark for
the chapter title) but look at the code for the standard class's headings
page style for ideas on how to use these.

Peter W.

colored tables or similar in headings 

> Now I just have to work out how to get the section name into the header,

The same as with any other pagestyle: \leftmark and \rightmark.

> and how to make the header landscape on a landscape page.

Look up landscape or rotating in the FAQ.

Donald Arseneau