New answers tagged

0

If you only want the equation number coloured then redefine \theequation: Here's the code: \documentclass{article} \usepackage{color} \definecolor{SAEblue}{rgb}{0, .62, .91} \renewcommand\theequation{{\color{SAEblue}\arabic{equation}}} \begin{document} \begin{equation} 1+1=2+\varepsilon \end{equation} \end{document} If you want the brackets ...


2

Well, you can change \@eqnnum but whether this is what you want is impossible to say without more details about your class code and your desired results. \documentclass{article} \usepackage{xcolor,etoolbox} \makeatletter \patchcmd{\@eqnnum}{\normalcolor}{\color{magenta}}{\typeout{eqnnum patch: OK!}}{\typeout{eqnnum patch: Oh, dear!}} \begin{document} ...


2

I don't know if you want change grey to another colour or to black (which is a colour anyway), but adding this line to the preamble (and x11names to the document class): \AtBeginDocument{\colorlet{chaptergrey}{IndianRed3}} produces this chapter heading:


1

The class ociamthesis uses the quotchap package which uses \color{chaptergrey} by default. It's sufficient to redefine chaptergrey to any desired colour, say, \definecolor{chaptergrey}{RGB}{0,0,255} being blue effective. But this might be confusing, since grey is assumed to be grey, not coming out as blue Another (much better) possibility is to ...


1

Here a starting point for you with titlesec. I will not comment the code, check the documentation of titlesec for a description: \documentclass{article} \usepackage{lipsum,color} \usepackage[explicit]{titlesec} \titleformat{\section} [hang] {\sffamily\large\bfseries\color{blue}} {\thesection} {1em} {[~{\color{magenta}\MakeUppercase{#1}}~]} ...


0

The following builds on the technique described in An improved \rowstyle that takes the cell contents as an argument, capturing each cell using collcell: Each cell .. is set using \textcolor{red}{..} depending whether/not the switch \ifrowcolour has been set to \rowcolourtrue or \rowcolourfalse. Since these switches occur inside tabular cells (and ...


2

You can pass the options for xcolor via pstricks: \documentclass{article} \usepackage[dvipsnames,x11names]{pstricks}% Options for xcolor \usepackage{pst-barcode} \begin{document} \begin{pspicture}(3.5,1.2in) \psbarcode[linecolor=red]{1234567}{includetext inkspread=0.5}{ean8} \end{pspicture} \end{document} xcolor itself loads by default color


1

Pstricks (loaded by pst-barcode) already loads xcolor without option. If you load the latter with an option, there will be an ‘option clash’. The solution consists in loading the option from within the document class, which will propose it to all subsequent packages, until one of them recognises it. Alternative solution: write in the preamble ...


0

For the shown example I am not convinced that you need to draw the "existing figure" outside the PGFPlots axis environment. But even if it should really be the case, you can match the PGFPlots coordinate system to the one of tikz and then use all of the possibilities PGFPlots offers to draw the heatmap. I also want to mention, that I would draw it the other ...


3

If we assume that you are using unbalanced columns and want to have the column borders on all of the pages of your document, then you can insert them in the background as part of an overlay using eso-pic (or some other package; there are multiple options): \documentclass{article} \usepackage{lipsum,multicol} ...


2

Issuing \color{white} inside a group doesn't really do anything. I'd suggest defining a section rule colour (say) secrulecolor which you can adjust to suit your needs: \documentclass{scrartcl} \usepackage{titlesec} \usepackage{xcolor} \definecolor{myblue}{RGB}{0,25,102} % Title format \colorlet{secrulecolor}{black}% Default rule colour ...


4

You have the color macro improperly grouped. That is, you close the group (with a right brace }) immediately after changing the color, rather than after painting the \rule. \documentclass[a4paper, 10 pt, oneside, final]{scrartcl} \usepackage[left=4.6cm, right=0.75cm, top=0.5cm, bottom=0.5cm]{geometry} \usepackage{soul} \usepackage{scrpage2} ...


2

Simply put the colour modifications inside a {} \documentclass{beamer} \begin{document} \frame { \frametitle{Hello} \framesubtitle{Hi} { \setbeamercolor{block title}{use=structure,fg=white,bg=black} \setbeamercolor{block body}{use=structure,fg=black,bg=gray!60} \begin{block}{Say you will} \begin{itemize} \item ...


3

You can use caption package % in the preambule \usepackage{caption} \usepackage{color} % in the document \captionsetup{font={color=green}} To change captions only in figures and revert styles back to normal: % in the document \captionsetup[figure]{font={color=green}} %\begin{figure} % figure stuff %\end{figure} \clearcaptionsetup{figure}


2

Here's a version without \colorbox (apart from the example), but using the very nice \tcbhighmath command from tcolorbox and the configurable settings of highlight math style={....} The most important setting is size=tight, but there is size=minimal too! \documentclass{article} \usepackage{xcolor} \usepackage[most]{tcolorbox} \usepackage{blindtext} ...


0

\colorbox adds padding on the four sides; you want to remove it. \documentclass{article} \usepackage{blindtext} \usepackage{xcolor} \definecolor{light-gray}{gray}{0.89} \newcommand{\graybg}[1]{% \begingroup\setlength{\fboxsep}{0pt}% no padding \colorbox{light-gray}{#1}% \endgroup } \begin{document} \blindtext $\mathsf{A \rightarrow P(x)}$ ...


3

The documentation of pgfgantt includes a chapter "Style Examples", starting at page 45. The syntax for ganttbars is: \ganttbar[ options ]{ label }{ start tss }{ end tss }. You can make different settings for most of the available elements. Also, you can adjust the colour of the bars quite easily: \ganttbar[bar/.append ...


0

In fact, I think I found a way that I like the most, because the code is the most easy to modify (2 added lines) and understand (pure LaTeX). I got the idea reading this post on text in different colours by different authors. I have not yet seen any downsides to this, apart from the fact that you have to assume the rest of the document colour is black, ...


3

You could also define a command instead of an environment; makes it easier IMO if you have consecutive sections which you want colored: \documentclass{article} \usepackage{xcolor,titlesec,titletoc} \newcommand{\mystyle}[1][black]{% \titleformat {\section}% {\normalfont\Large\bfseries\color{#1}}% {\thesection}% {1em}{}% % \titlecontents ...


4

Here is a solution. I will try to explain if needed. \documentclass{article} \usepackage{xcolor} \newenvironment{myenv}% {\color{red}% \addtocontents{toc}{\protect\begin{mytocenv}}}% {\addtocontents{toc}{\protect\end{mytocenv}}} \makeatletter \let\mtl@section\l@section \newenvironment{mytocenv}% ...


1

Here's a version with tcolorbox and its \tcbhighmath command, wrapped in `\highlightnew: \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{color} \usepackage[most]{tcolorbox} \setlength{\fboxsep}{0pt} \newcommand{\highlight}[1]{\text{\colorbox{yellow}{$#1$}}} ...


2

Once you're in the \colorbox, LaTeX forgets that you were in math mode and it forgets the type of font you were using. In math mode there are four different sizes: \displaystyle \textstyle \scriptstyle \scriptscriptstyle If you rewrite you third equation as \(\frac{-b\pm \sqrt{\colorbox{yellow}{\(\scriptstyle b2- 4ac\)}}}{2a}\) then you'll get the ...


1

The problem disappears if you use the m{2cm} column type. If you want to use p{2cm}, a work around consists in using \textcolor{white}{cell contents} indtead of \color{white} cell contents: \documentclass{article} \usepackage[table, x11names]{xcolor} \usepackage{hhline} \definecolor{colorh}{rgb}{0.5,0.5,0.5} \setlength\arrayrulewidth{0.25mm} ...


0

With slightly changed your MWE in question, I cannot reproduce your image of your table. Also your finding in your answer is false. Try the following: \documentclass[border=3mm]{standalone} \usepackage[table]{xcolor} \definecolor{colorh}{rgb}{0.5,0.5,0.5} \begin{document} \begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|} \hline \rowcolor{colorh} ...


0

I guess it is more of a workaround than a solution, but the last of the mentioned methods actually makes the rightmost line visible if it is specified twice, like |L|L|L|L||. Input \documentclass{article} \usepackage{color} \usepackage{colortbl} \definecolor{colorh}{rgb}{0.5,0.5,0.5} \setlength\arrayrulewidth{0.25mm} ...


2

Here is a solution. I replaces \line with \hhline and I supposed you want to colour the background of some cells, not the numbers: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[showframe]{geometry} \usepackage{array} \usepackage[table, x11names]{xcolor} \usepackage{array, multirow} \usepackage{makecell, hhline} ...


2

Temporary solution (until the desired colors wouldn't be known): \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{array,makecell,multirow} \renewcommand\theadfont{\normalfont\bfseries} \usepackage{hhline} \usepackage[table]{xcolor}% <-- needed for cell coloring \usepackage[margin=20mm]{geometry} ...


12

You can use newunicodechar: \documentclass{article} \usepackage{xeCJK} \usepackage{newunicodechar} \usepackage{xcolor} \newunicodechar{の}{\textcolor{red}{の}} \begin{document} ...


11

This is precisely one of the things that XeTeX makes excitingly easy to achieve. See the section Character classes in its documentation (texdoc xetex in your TeXLive/MikTeX installation or http://texdoc.net/texmf-dist/doc/xetex/xetexref/xetex-reference.pdf). Here is an example, but you definitely should check the XeTeX reference for more, especially as you ...


14

Here's a LuaLaTeX-based solution. It defines a Lua function, named color_chars, that renders in red all instances of characters contained in a pre-defined set of characters. The code uses the function unicode.utf8.gsub instead of the more basic string.gsub, so that it can handle characters that aren't ASCII-encoded. The code take care not to operate on TeX ...


0

Just have your macro take an argument and then feed the characters to the macro. If they are to be consistently formatted, you want one macro which you use to format the 200 characters. You don't need - or want - 200 macros. For example, \documentclass{article} \usepackage{xcolor} \newcommand*\learnme[1]{\textcolor{red}{#1}} \begin{document} ...


0

Use the math mode if it is more an array as a tabular: \documentclass{article} \usepackage[table]{xcolor} \usepackage{icomma,rccol} \begin{document} $\begin{array}{|c|R{1}{3}|c|c|c|c|}\hline B_N & \multicolumn{1}{c|}{C_N} & i & j & k & l \\ \rowcolor{gray!35}\hline B_1 & 5,128 & 0 & 1 & 0 & 0 \\ ...


4

An practical alternative: To write decimal numbers alegned at decimal mark you can use two packages: dcolumn siumitx With both you simple merge r andl column in one and numbers write as ordinary decimal Numbers. Since I'm more familiar with siunitx ... \documentclass[a4paper,10pt]{report} \usepackage[table]{xcolor} ...


7

Sorry blame the author of colortbl not xcolor the interface here is rubbish, however you can do this: \documentclass[a4paper,10pt]{report} \usepackage[table]{xcolor} \begin{document} \begin{tabular}{|c|r@{,}l|c|c|c|c|} \hline $B_N$ & \multicolumn{2}{c|}{$C_N$} & $i$ & $j$ & $k$ & $l$ \\ \hline ...


3

The three memoir commands in question are: \chapnamefont \chapnumfont \chaptitlefont which, in the default settings, are set to \Huge and \bfseries. Thus it is a simple matter to redefine them: \documentclass[openany]{memoir} \usepackage{xcolor,lipsum}% lipsum.sty is just for this example \renewcommand{\chapnamefont}{\Huge\bfseries\color{blue}} ...


0

You can insert a \color{blue} expression after \chapterheadstart and revert back to \color{blue} at \memendofchapterhook: \documentclass{memoir} \usepackage{blindtext} \usepackage{xcolor} \makeatletter \g@addto@macro\chapterheadstart{\color{blue}} \makeatother \renewcommand{\memendofchapterhook}{\color{black}} \begin{document} \blinddocument ...


4

One option to do this with clip, you can use method taken from this answer How can I invert a 'clip' selection within TikZ. First we create path (rectangle) which covers the central part of cyan line. Second use method described in the answer above to invert clip. Code \documentclass{article} \usepackage{tikz} \begin{document} ...


2

In general, one can define a radial shading and try drawing a rectangle on it. \documentclass[border=9,tikz]{standalone} \usetikzlibrary{shadings} \begin{document} \pgfdeclareradialshading{arc}{\pgfqpoint{0bp}{0bp}}{% color(0bp)=(white); color(12bp)=(white); color(13bp)=(blue); color(50bp)=(blue)} \tikz{ ...


7

Most of the beamer element colors in a beamer template are dependent on other colors. Look for example at the default color theme. Nearly all the element's colors are dependent on these four "base colors". \setbeamercolor{normal text}{fg=black,bg=white} \setbeamercolor{alerted text}{fg=red} \setbeamercolor{example text}{fg=green!50!black} ...


3

The xcolor package is an extension of the color package, so I don't understand why you loaded the color package twice along with the xcolor package. Moreover, according to page 7 of the xcolor documentation usenames is obsolete. I cleaned up the code to this: \documentclass[11pt]{article} \usepackage[dvipsnames,table,xcdraw]{xcolor} ...


3

sorry I can't comment as I'm just a noob and I need reputation. I tried out the command in my document and it works perfect. Check the image below. In my beamer, I had declared something like \documentclass[xcolor=dvipsnames]{beamer} while the document that I use based on tufte declares \usepackage{xcolor} in the .sty file. Could you try renaming the ...


2

I don't know what happens, but the problem seems to be that \only is placed between items. If you insert inside colorized item, there's no change. In next code I've introduced t option to top align frames and better see where changes start. \documentclass[10pt]{beamer} \setbeamersize{text margin left=0pt, text margin right=0pt} \paperheight=24mm ...


2

Change \renewenvironment{leftbar}[1] to \renewenvironment{leftbar}[2] then replace blue by #2 and you can use \begin{leftbar}{red}


2

This is easy to do with the enumitem package: \documentclass[x11names]{article} \usepackage[utf8]{inputenc} \usepackage{graphicx, xcolor} \usepackage{enumitem} \setlist[itemize, 1]{label =\raisebox{-0.3\height}{\scalebox{2}{\color{Red3}\textbullet}}} \begin{document} Some text some text some text some text some text some text some text some text some text ...


4

This is intended to demonstrate a couple of different things: style can be added to nodes within a matrix of nodes by adding the configuration between |...| within the cell itself, and this seems the easiest way to fill the lower left node with anything; fill=<colour> fills with a uniform colour, as opposed to a shading; to avoid the dots and lines ...


3

to 1) You may move style definitions at another place. This is convenient, if the styles are more complex and they can be changed easily at this central place. You can see this in the options block after begin tikzpicture. to 2) The unwanted dashes result from the cycle. Here it is sufficient to make a straight line from one edge to another. to 3) The ...


4

\documentclass{beamer} \usetheme{Warsaw} \setbeamercolor{background canvas}{bg=yellow} \AtBeginDocument{ \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{% color(0pt)=(yellow); color(4pt)=(black!50!bg) } } \begin{document} \begin{frame}{Nice Title} Stupid Content \end{frame} \end{document}


1

I found a new workaround for the problem explained in the comment to the original question. Basically one needs to replace the old \makeatletter from @marco-daniel with this one: \usepackage{xcolor} \colorlet{chapterbackground}{red} \addtokomafont{chapter}{\color{white}} \makeatletter \renewcommand\chapterlinesformat[3]{% \colorbox{chapterbackground}{% ...


6

If you do git log --color --graph --oneline > l.txt then you get the history including the terminal colour codes in l.txt then you can copy that to a verbatim environment. Here I just made ^^[ active and grab everything up to an m and typeout a warning of the terminal code used, so you just need to define a suitable definition in each case. You can ...



Top 50 recent answers are included