Text Formattingtext color in the new page

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
bioalb
Posts: 2
Joined: Sun Dec 19, 2010 10:45 am

text color in the new page

Post by bioalb »

Hello,

I am using the following:

Code: Select all

Some black text
\textcolor{red}{some red text}
Some more black text
All works fine except when "some red text" is long enough that it starts in one page and ends in the next one. In such a case, the text in the new page is black, while - being included in \textcolor curly brackets - it should still be red.

I have observed this using the "color" package with document class of "article" and "report".

Any help is much appreciated.
Last edited by bioalb on Mon Dec 20, 2010 3:47 am, edited 1 time in total.

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

text color in the new page

Post by localghost »

bioalb wrote:[…] I have observed this using the "color" package with document class of "article" and "report". […]
Perhaps you should use the xcolor package instead. The code below works flawlessly on a TeX Live 2010 system.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}
\usepackage[x11names]{xcolor}

\begin{document}
  \blindtext[4]
  \textcolor{red}{\blindtext[2]}
  \blindtext[4]
\end{document}

Best regards and welcome to the board
Thorsten
bioalb
Posts: 2
Joined: Sun Dec 19, 2010 10:45 am

Re: text color in the new page

Post by bioalb »

Thanks for the quick reply, Thorsten. Really appreciated.

Your suggestion worked. However, I realized that the problem wasn't related to using color or xcolor but it was related to the dvi drivers and/or viewers.

I observed that the lack of continuation of the red colored text in the new page on the compiled dvi (viewed with okular). Upon conversion from dvi to ps (dvips) and subsequently from ps to pdf (ps2pdf), the problem disappeared and the red text correctly continues in the new page.

As it is, this issue can then be considered solved, unless someone is particularly annoyed/concerned that the dvi doesn't quite look like the final pdf in terms of text color.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: text color in the new page

Post by localghost »

So what do learn from this? Always look at the PS or PDF output and not at the intermediate DVI file.
Post Reply