New answers tagged

1 vote

How to highlight text containing citation and figure referencing?

You could use the lua-ul package for highlighting. This way you don't have to worry about citations or cross-references in your text: % !TeX TS-program = lualatex \documentclass{article} \usepackage{...
samcarter_is_at_topanswers.xyz's user avatar
0 votes

How to highlight text containing citation and figure referencing?

You can use the soul package (\usepackage{soul}), and make the reference or the citation between curly braces inside of the \hl command: \hl{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ...
Yousra CHERIF's user avatar
0 votes

How to make circle of text in latex?

The wheelchart package can be used. \documentclass[border=6pt]{standalone} \usepackage{listofitems} \readlist\WCcolors{darkbrown,darkred,darkgreen,darkorange,darkyellow,darkblue} \usepackage{...
matexmatics's user avatar
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
4 votes

LaTeX Command for Simultaneous Text Coloring and Highlighting

The xcolor package provides a macro called \colorbox, which can be combined with \textcolor to generate the desired effect. In the following example, the utility macro \highlight takes three arguments ...
Mico's user avatar
  • 495k
2 votes

LaTeX Command for Simultaneous Text Coloring and Highlighting

Try this: \documentclass{article} \usepackage{xcolor} % For text color \usepackage{soul} % For highlighting % Define the command for coloring and highlighting % This will color the text in dark red ...
John Smith's user avatar
1 vote

Option clash for package xcolor

If you used tikz related package, then one way that works for my computer is to load the xcolor before tikz. Example: Correct: \documentclass[]{article} \usepackage[dvipsnames]{xcolor} \usepackage{...
Asigan's user avatar
  • 113
6 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
  • 6,364
4 votes
Accepted

Define simple color for both draw and fill

You could define a new colour using \colorlet: \documentclass{standalone} \usepackage{tikz} \colorlet{mycolor}{black!45} \begin{document} \begin{tikzpicture} \draw[mycolor] (0,0) rectangle (1,1); \...
samcarter_is_at_topanswers.xyz's user avatar
1 vote
Accepted

Change math color except in block titles in beamer

You could redefine the block begin template like this: \documentclass{beamer} \usetheme{Warsaw} \setbeamercolor{math text}{fg=blue} \setbeamertemplate{block begin}{% \par\vskip\medskipamount% \...
samcarter_is_at_topanswers.xyz's user avatar
4 votes

Rainbow-colored text strings

Here's a TikZ solution adapted from an earlier answer of mine, which might be of interest in relation to Beamer, for example. \documentclass[border=10pt,multi,tikz]{standalone} % ateb: https://tex....
cfr's user avatar
  • 194k
4 votes
Accepted

Change command depending on the tcolorbox it's in

You can define \kw to select a custom color for the text which you can then (re-)define inside the relevant tcolorbox using the code option: \documentclass{article} \usepackage{tcolorbox} \...
Jasper Habicht's user avatar
2 votes
Accepted

Color coding with versions package

Instead of creating new macros, you could use hooks to add some colour to the existing environments: \documentclass{article} \usepackage{xcolor}%to use the colors \usepackage{versions} \AddToHook{...
samcarter_is_at_topanswers.xyz's user avatar
2 votes

Color coding with versions package

The documentation states (p. 2) However, \begin{〈version〉}...\end{〈version〉} breaks inside macro arguments, e.g. of \footnote (it is even fragile). So there is \processifversion{〈version〉}{〈code〉} ...
campa's user avatar
  • 29.9k
7 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

#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
3 votes

Why do optional arguments of commands affect spacing of \mathcolor

The similar problem is in OpTeX, but not with regards to the next parameter given by an un-expandable macro. Simply $ {\Blue a^b}_c $ gives c after a^b (i.e. with space, wrong position) because the {...
wipet's user avatar
  • 72.2k
3 votes
Accepted

Why do optional arguments of commands affect spacing of \mathcolor

You can use \NewExpandableDocumentCommand that doesn't suffer from the problem of the check for the optional argument in the legacy \newcommand. \documentclass{article} \usepackage{xcolor} %MINIMAL ...
egreg's user avatar
  • 1.1m
1 vote

Table with overlaping colors

The package nicematrix has tools to address that kind of problems. \documentclass{article} \usepackage{nicematrix} \begin{document} \begin{NiceTabular}{cc}[hvlines] \CodeBefore \rowlistcolors{3}{...
F. Pantigny's user avatar
  • 38.5k
2 votes

Tikz symbols over colors in table

Here is a way to construct that table with {NiceTabular} of nicematrix. \documentclass{article} \usepackage{nicematrix} \usepackage{booktabs} \usepackage{tikz} \usepackage{siunitx} \definecolor{...
F. Pantigny's user avatar
  • 38.5k
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
1 vote
Accepted

Coloured subsection AND text right after the subsection name

I am not sure what you want to achieve eventually, as you did not provide much information. But if you only use the sectsty package for adding color to the subsection title, you should know that you ...
Jasper Habicht's user avatar
4 votes

Tikz symbols over colors in table

A simple solution would be to move the checkmarks and crosses from the top row to the bottom row using \multirow{-2}{*}{\checkmark} to connect the relevant cells upwards. This way, they won't be ...
Jasper Habicht's user avatar
1 vote

Colored text along path in TikZ

As described in the manual, the correct option for setting the text color in a decoration with text along path (or related decorations) is text color. Note that the defintion of options depends on ...
Jasper Habicht'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
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
  • 194k
2 votes
Accepted

\colorlet{saved}{.} inside caption produces error

If you really need such constructs you should hide them in a robust command, eg as defined by \NewDocumentCommand \documentclass{article} \usepackage{xifthen} \usepackage{amsmath,xcolor} \usepackage[...
David Carlisle's user avatar
0 votes

\colorlet{saved}{.} inside \equal produces error

\ifthenelse{\isempty{\colorlet{saved}{.}a}}{empty}{non empty} kind solved my problem, but I would be interested in other solutions as well. Especially solutions changing the \colorlet{saved}{.} rather ...
Jakob's user avatar
  • 919
3 votes

Extract color command

With testcolors environment you can print the color parameters in any format, but unlike \extractcolorspec you cannot assign that values to some command, so translate this to a new definition as: \...
Fran's user avatar
  • 79.4k
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
  • 194k

Top 50 recent answers are included