Talk:LaTeX/Colors

Rewrite
I invested time in rewriting the page completely (some aspects were still missing), after being approved by an admin, the changes were reversed by an anonymous user stating that the former state of that wiki page was more detailed. Yes and no. The former state listed more colors (a small percentage of all available with the packages, which is quite useless i think) and gave some information about color schemes, which is again more than useless for a starter (and i think this book is mainly for starters). Now another edit has been made, adding some more colors.

Now, in order for that entry about colors to be really useful, can somebody please add all colors available by package ?--Johannes Bo (discuss • contribs) 10:18, 2 April 2016 (UTC)

\color versus \xcolor
Could somebody explain the difference between these two packages?
 * I almost completely redid the page. Is it more useful now? --Johannes Bo (discuss • contribs) 13:49, 22 February 2016 (UTC)


 * You almost removed all the useful information from the page. What happened, for instance, to the tables of colors. I think it is better for user to have a visual reference here without having to dig deep into manuals.
 * Yes, i did. The package manual gives an overview of all the more than 500 defined colors. Not just the few that were listed here. After all, the colors are standard. --Johannes Bo (discuss • contribs) 20:06, 28 February 2016 (UTC)

\textcolor v \color
Can somebody elaborate on this ? "The difference between \textcolor and \color is the same difference between \texttt and \ttfamily, you can use the one you prefer."

I couldn't find the difference between \texttt and \ttfamily on the Formatting page either.


 * Checkout following example:

\texttt{Hello} World\\ {\ttfamily Hello} World\\ \textfamily{Hello} World
 * hth, --Gms (talk) 21:50, 22 August 2010 (UTC)

Background (bg) color of text; headings
A nice article! Just a few requests:
 * Could somebody elaborate more on bg color for the text?
 * How to change the bg color of headings (\section, \subsection)?
 * is it possible to color only one line in LaTeX? E.g. the very first line on each page is colored in some color and not the successive lines?

Thank you, Kazkaskazkasako (talk) 11:10, 25 April 2009 (UTC)

Found a partial answer which involves \newenvironment:

\definecolor{MyGray}{rgb}{0.96,0.97,0.98} \makeatletter\newenvironment{graybox}{% \begin{lrbox}{\@tempboxa}\begin{minipage}{\columnwidth}}{\end{minipage}\end{lrbox}% \colorbox{MyGray}{\usebox{\@tempboxa}} }\makeatother from

This article is useless.
It doesn't even show where you're supposed to enter what colour you want. There's no distinction between when you have to type "color" and when you have to type "red". It won't help anyone, just a waste of time. It's a good start, someone fix it please and put examples.

Not at all
Well, not everyone can explain things in such diverse ways as to make it universally understood. It also helps if you read the article then consider what it is trying to say and testing stuff out. The command sequences are placed where they are needed, for example, to color a table place the line: \begin{center} \rowcolors{1}{PaleGreen}{Tan} \begin{tabular}{|l|l|} \hline before the \begin{tabular}. Or somewhere in the body of text you might want a line that looks something like: \color{red}This text will appear red \color{black} Which returns text to the default color, black anyway.

So no, the article is not useless, just perhaps not as clear as it could be.--Henry Tallboys (discuss • contribs) 03:53, 22 April 2012 (UTC)

Color names are not proper names, should not be capitalized
This is quite a helpful article, but I found that using the color names as shown (with capital letters) didn't work. I had to use lower case throughout. Perhaps this could be clarified in the tables of colors provided?

Usepackage xcolor
If you are using tikz or pstricks package you must declare the xcolor package before that, otherwise it will not work.

I do not understand what declaring a package means - could you just write down a code example to get it working with tikz?


 * \usepackage{xcolor} before loading tikz. Better, add the options for xcolor as global options. --Johannes Bo (discuss • contribs) 09:57, 7 January 2018 (UTC)

Incorrect predefined colors
Johannes Bo, I saw you reverted my edit to the predefined colors section. That list has far more names than are actually guaranteed to be predefined by the color package. Could you please either explain your reasoning behind reverting this change without any discussion, or change it back to my (correct) version? I would have added sources, but I wasn't allowed to due to them being external links.

Thanks,

Thislooksfun (discuss • contribs) 05:26, 8 January 2018 (UTC)
 * Thislooksfun, the page says at the top, that package xcolor is used in the examples. This package provides those colors. I made that a little bit more clear (i hope). --Johannes Bo (discuss • contribs) 16:52, 9 January 2018 (UTC)

\color is not an environment
Page currently says:

"The \color environment allows the text to run over multiple lines and other text environments whereas the text in \textcolor must all be one paragraph and not contain other environments."

Problem 1: \color is a command, not an environment. It's a scope-based command, so it will apply to the end of its scope, but this doesn't make it an environment. If it was an environment we'd need to use the \begin and \end commands to use it. We don't.

Problem 2: I agree that for \textcolour the text being entered as the second argument can't contain a paragraph break. (It might be possible to fake something that looks similar via \newline, but that's poor style.) However I'm not clear about the claim that it can't "contain other environments". As for \color, \textcolor is a command, not an environment. I don't know whether the intended meaning was that it can't contain an environment or it can't contain other commands. Either way it seems wrong. It can successfully contain an itemise environment and it can successfully contain an \em command.

But I'm still new to LaTeX, so I'm going to wait a day or so for people to object to this before I start editing the page.

Jim 14159 (discuss • contribs) 06:58, 31 May 2021 (UTC)