Text FormattingProblem with Colors

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
fayez
Posts: 13
Joined: Mon Dec 21, 2009 12:00 am

Problem with Colors

Post by fayez »

Hello,

I found this code

Code: Select all

 \documentclass[12pt,a4paper]{article}
 \usepackage[dvips]{color}
 \usepackage{multicol}
 \pagestyle{empty}
 \setlength{\oddsidemargin}{0pt}
 \setlength{\textwidth}{16cm}
 \setlength{\textheight}{22cm}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{0pt}
 
 \begin{document}
 \renewcommand*{\DefineNamedColor}[4]{%
    \textcolor[named]{#2}{\rule{7mm}{7mm}}\quad
    \texttt{#2}\strut\\}
 
 \begin{center}\Large Named colours in \texttt{dvipsnam.def}
 \end{center}
 \begin{multicols}{3}
 \input{dvipsnam.def}
 \end{multicols}
 \end{document}
on a website and it was suppose to show me the colors in a table, however I keep getting the colors displayed as black when I build a PDF file directly, and not being recognized by LaTeX for some reason, but when I build it as ps first then PDF it comes out as expected.
Is this normal? and any colors should be built .ps first ?
because when I do pdf it gives me an error that says
Non-pdf special ignored!
?

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Problem with Colors

Post by Stefan Kottwitz »

Hi,

you're using the dvips driver that's working if you compile to dvi and convert with dvips but not with pdftex.

Stefan
LaTeX.org admin
fayez
Posts: 13
Joined: Mon Dec 21, 2009 12:00 am

Re: Problem with Colors

Post by fayez »

Thanks a lot, I actually had more complications as a result, because when I run tex -> ps -> pdf, the document comes as Portrait when I had it set as landscape, as soon as I put pdftex it worked as I wanted it.
Fayez
Post Reply