Skip to main content
33 votes
Accepted

Providing an Authentic Finish to a TIKZ Gold Plate

You could draw a black disc with opacity that varies by angle. The opacity formula pictured is k·sin²(2θ), with k=.04 (so that the opacity oscillates between 0 and k). Larger values of k will make the ...
Sandy G's user avatar
  • 46.6k
26 votes
Accepted

How to Draw Gabriel's Horn

Almost same image but from a different point of view and with the sun in a different position. Using only tikz with the library math and layers. It may take some time to execute; the time can be ...
Daniel N's user avatar
  • 6,142
25 votes
Accepted

How to create an overlapped colored equation?

An attempt using annotate-equations package. \PassOptionsToPackage{svgnames}{xcolor} \documentclass{article} \usepackage{amsmath} \usepackage{annotate-equations} \begin{document} \newcommand\...
muzimuzhi Z's user avatar
12 votes

How to color math symbols?

In sufficiently new version of LaTeX, simply load xcolor package and use \mathcolor. Refer to texdoc mathcolor for documentation. \documentclass{article} \usepackage{xcolor} \begin{document} $\...
user202729's user avatar
  • 7,573
11 votes

How can I color just the outside \left and \right brackets?

(I've updated answer in order to incorporate David Carlisle's suggestion to mention the new-ish \mathcolor macro.) I can think of three solutions. The first requires having access to a fairly recent ...
Mico's user avatar
  • 514k
11 votes

How to Draw Gabriel's Horn

I don't know if this helps, but I was able to do it with pgfplots as follows; \documentclass{beamer} \beamertemplatenavigationsymbolsempty \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=...
Jasper's user avatar
  • 397
9 votes

How can I draw the shapes with gradient colors as shown in the below figure?

You can use \shade to get the basic effect. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill[blue!10] (0,0) rectangle (12,4); \shade[left color=blue!30, right ...
Sandy G's user avatar
  • 46.6k
8 votes

Extract color command

The first method works only for colours defined with xcolor. As Ulrike Fischer pointed out, this is not a general solution. The second works only for colours defined with l3color. Caveat emptor ... ...
cfr's user avatar
  • 207k
8 votes
Accepted

#1# signature in macro definition

\def\foo#1#{xxx [#1]} is primitive syntax that makes the first argument everything up to a (mandatory) { so \foo hello world{} would produce xxx [hello world] It's used here to save the higher level ...
David Carlisle's user avatar
8 votes
Accepted

Rainbow-colored text strings

You could use this adaptation of the gradient-text package: \documentclass{article} % rainbow text (based on the gradient-text package) \makeatletter \ExplSyntaxOn \clist_new:N\l_gtext_First_clist \...
samcarter_is_at_topanswers.xyz's user avatar
8 votes
Accepted

minted: preserve colours even with `gray` option to `xcolor`

you can change the color model locally. But you then need to consider color conversion. If you load with the gray model, the standard colors like red or blue will be defined as gray, and so can't be ...
Ulrike Fischer's user avatar
7 votes
Accepted

Why does the "\left [" partially disappear when I color a row in a table? But [ does not disappear

matrix has a negative space which is causing the background to over-print, but you don't really want to redraw the background on nested tables anyway, so this disables it \documentclass{article} \...
David Carlisle's user avatar
7 votes
Accepted

Problem with Tikzpicture and colors in a foreach loop

Here an answer based on This solution here. It worked after adding the commands edef,temp and noexpand \documentclass{article} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \begin{document} \...
Jes's user avatar
  • 851
7 votes
Accepted

Colored underline and overline in math mode

I'd first typeset the math, so color will not enter the scene and then add the overline or underline around the constructed box. This allows nesting and also works for subscripts and superscripts. \...
egreg's user avatar
  • 1.1m
6 votes
Accepted

New color command \colorPlus[<color-when-printed>]{<color-in-PDF>} that behaves differently when viewed and printed

colorPlus needs to be implemented as an environment, since filling the font outlines with optional colours depending on OC settings is done after the text has been inserted. So, here is a solution ...
AlexG's user avatar
  • 55.3k
6 votes

How can I color the "or equal" line of \le?

Building a symbol by stacking a < on top of a - and adjusting the heights yields something pretty similar to \le, and then it's easy to add color. Maybe the heights are not perfect, but it's close. ...
Vincent's user avatar
  • 20.3k
6 votes
Accepted

How can I color the "or equal" line of \le?

Clip the top and bottom part, colorizing them separately (the upper part can be also colored), then overlap them with \ooalign. \documentclass{article} \usepackage{trimclip} \usepackage{xcolor} \...
egreg's user avatar
  • 1.1m
6 votes
Accepted

Color in mathematical symbols does not work with overrightarrow command

Many math constructs use math mode inside horizontal mode, so you want that \color{navy} is not applied in nested math. Not foolproof (beware of footnotes, for instance): \documentclass{article} \...
egreg's user avatar
  • 1.1m
6 votes
Accepted

Help to draw and hatch a parallelogram

\documentclass[tikz,border=1mm,usenames,dvipsnames]{standalone} % ateb https://tex.stackexchange.com/a/700945/: addaswyd o gwestiwn JoudaBouda: https://tex.stackexchange.com/q/700934/ \usepackage{tikz}...
cfr's user avatar
  • 207k
6 votes
Accepted

Incompatibility between beamer and pdfrender packages?

To work around the problem, you could switch to an older version of the latex kernel: \RequirePackage[2023/11/10]{latexrelease} \documentclass{beamer} \usepackage{pdfrender} \begin{document} \begin{...
samcarter_is_at_topanswers.xyz's user avatar
6 votes
Accepted

Variable in Color Code?

You can use hsb/Hsb colours in tikz if you load xcolor with the rgb option to set the target colour model to rgb: \documentclass{standalone} \usepackage[rgb]{xcolor} \usepackage{tikz} \begin{...
samcarter_is_at_topanswers.xyz's user avatar
6 votes
Accepted

The distributive law in a square

There many ways to do this with more and less sophisticated packages and more and less complex custom configuration. Here's an example using efbox, makecell and xcolor. If you want to typeset many ...
cfr's user avatar
  • 207k
5 votes

How to draw a double-color line with tikz

In case you want to have a double colored border around a node, you can do it like this: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[circle,...
Arne's user avatar
  • 1,390
5 votes
Accepted

Two issues regarding line numbers

First of all, $$...$$ is not supported in LaTeX documents and lineno can do nothing about this. The manual suggests wrapping the display with linenomath*. \documentclass[12pt]{article} \usepackage{...
egreg's user avatar
  • 1.1m
5 votes

Definite integral with colored boundaries

Just to follow up on @DavidCarlisle's comment: You need to write {\color{...}...}, not color{...}... for the terms in the lower and upper limits of integration. Actually, if your TeX distribution is ...
Mico's user avatar
  • 514k
5 votes
Accepted

colours in loops

The !<factor>! doesn't get sent through the PGF math parser (unlike the coordinates) so you can't put expressions in there. Fortunately, you can use the evaluate key on the foreach loop to ...
Andrew Stacey's user avatar
5 votes

Help to draw and hatch a parallelogram

% !TEX TS-program = lualatex \documentclass{standalone} \usepackage{tkz-euclide} \usepackage{tkz-elements} \usetikzlibrary{patterns,patterns.meta} \usetikzlibrary{arrows.meta} \usetikzlibrary{shapes....
Alain Matthes's user avatar
5 votes

Can I use \substitutecolormodel{hsb}{rgb} rather than \selectcolormodel{rgb} to draw PGF/TikZ paths with a hsb-defined colour series?

Well the problem is that xcolor doesn't support stroke and fill colors. pgf has therefore its own backend commands for stroke and fill which write the correct literals and this backend doesn't support ...
Ulrike Fischer's user avatar
5 votes

subsection head color

Despite its name, your "Star Subsection" is not a subsection, but a subsubsection. So to change the colour, you'll need \subsubsectionfont{\color{red}} (or just use \allsectionsfont{\color{...
samcarter_is_at_topanswers.xyz's user avatar
5 votes
Accepted

Color a single listings comment delimiter (shell transcript language style)?

You can adapt @matexmatics' solution from https://tex.stackexchange.com/a/706145/36296 like this: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \usepackage[T1]{fontenc} \usepackage{...
samcarter_is_at_topanswers.xyz's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible