Questions tagged [colorbox]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

How to preserve minted's foreground color while highlighting code sections with \colorbox

I'm currently working on highlighting specific sections of code snippets in my LaTeX document. To achieve this, I followed the example provided in the documentation for the minted package, ...
Átila Gama Silva's user avatar
0 votes
2 answers
59 views

Make colorbox show vertically centered characters when using \strut

The context The problem The question The context I know that it is possible to show text in colored boxes by using \colorbox. Because the characters have different sizes, the height of the boxes is ...
rdrg109's user avatar
  • 309
2 votes
1 answer
144 views

Change font size of a paragraph and make all colorbox have equal height

The context I know that it is possible to enclose text in colored boxes by using \colorbox. \documentclass{standalone} \usepackage{xcolor} \begin{document} \colorbox{red}{This} \colorbox{green}{is} ...
rdrg109's user avatar
  • 309
0 votes
0 answers
35 views

Exam class & solution box: incompatible color warning when printing answers

The following code uses printanswers and %printanswers (commented out) commands (h/t @simondispa) The code compiles without error using %printanswers. But when I printanswers the following log warning ...
Siuslaw Math's user avatar
1 vote
0 answers
45 views

How to define a colorbox command which can treat other user-defined commands in its argument?

I would like to highlight text including user-defined commands with linebreaks. I found a solution for linebreaks (Colorbox does not linebreak), but the \ctext{} command cannot treat other commands in ...
TobiR's user avatar
  • 574
0 votes
1 answer
202 views

tcolorbox breakable through pages

I've tried to realize a breakable tcolorbox like this: \usepackage{geometry} \usepackage{lipsum} \usepackage[skins,breakable]{tcolorbox} \newtcolorbox{cvbox}[2][]{ blanker, %leftupper=4cm, ...
fede1602's user avatar
1 vote
2 answers
56 views

Text is not centered with colorbox

I would like to perfectly center the yellow box with the text in abstract. Here's the code I attempted so far: \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{blindtext} \usepackage[...
dvd's user avatar
  • 25
1 vote
0 answers
48 views

How to preserve vertical colour gradient in breakable tcolorbox

I am currently trying to write a document where I have breakable tcolorboxes with a vertical gradient, as in the code below. However, I am facing an issue where the color gradient resets each time ...
Dan qwerty's user avatar
0 votes
1 answer
161 views

How to put a gray box around text that splits at page break

Is there a way to create a gray box around text that will split upon a page break? For example, using tcolorbox I can get the following: However, it will shift onto the next page if it does not fit ...
Mike Smith's user avatar
1 vote
2 answers
127 views

Custom colorful definition

My MWE: \documentclass[a4paper]{article} \usepackage[most]{tcolorbox} \usepackage{xcolor, soul} \usepackage{amsthm} \definecolor{columbiablue}{rgb}{0.61, 0.87, 1.0} \newcommand{\highlight}[1]{\...
WinnieNotThePooh's user avatar
0 votes
1 answer
99 views

Defining a new environment/command to encapsulate a colorbox

I have the following working MWE file: \documentclass{article} \usepackage[rgb,dvipsnames,svgnames,table]{xcolor} \usepackage{array} \usepackage{booktabs} % \begin{document} \begin{table}[!hbt] \...
chandra's user avatar
  • 3,084
1 vote
1 answer
100 views

How to make background of note in 'tabularray' can be broken with 'xelatex' in LaTeX?

As I write the article that contains Chinese characters, so I need to use xelatex engine, even lualatex engine sometimes will not work. I also insert some tables by tabularray package which has a lot ...
Y. zeng's user avatar
  • 1,737
1 vote
1 answer
651 views

Specifying RGB color in a colorbox - tcolorbox package

I tried to specify a RGB color in a color box in this way, but it doesn't recognize RGB, only rgb that is a different thing. How can I specify a RGB color in a color box? \documentclass{article} \...
Gennaro Arguzzi's user avatar
0 votes
1 answer
69 views

force line breaks in long character strings that contain highlighted text (seqsplit does not work here)

I have a long string of characters containing highlighted text by way of a colorbox. Inside it, \seqsplit is ignored. How can I force line breaks within the highlighted text? Please note: \seqsplit ...
C.Carl's user avatar
  • 718
2 votes
1 answer
82 views

Effecting a Shift of an FCOLORBOX within a Simple Lettrine

Consider the code \documentclass{book} \usepackage{type1cm,lettrine} \usepackage{xcolor} %\usepackage{lipsum} \usepackage[tracking=true]{microtype} \begin{document} \thispagestyle{empty} \large \...
DDS's user avatar
  • 8,491
1 vote
1 answer
108 views

Adding a Colored Frame to a Do-It-Yourself Lettrine

This question is an extension of the one posed a while back in Adding a Letter to an Image in a Do-It-Yourself Lettrine Consider the MWE \documentclass{book} \usepackage{lettrine} \usepackage{xcolor} ...
DDS's user avatar
  • 8,491
0 votes
1 answer
99 views

How can I patch `minted` to use `soul`s higlighting

I'd like to highlight code with a gray background like StackExchange does. I know that I can set bgcolor in minted to put a solid background color on inline code. However, this makes minted use ...
Eric's user avatar
  • 527
0 votes
1 answer
171 views

How do i align colorbox with my text?

I am trying to insert colored boxes into my caption like below. But my code below does not align the colored boxes with the text. How can I automatically align them with the text? \documentclass{...
Kong's user avatar
  • 2,303
0 votes
1 answer
105 views

Width of parbox inside colorbox

I want to insert a colorbox into a margin paragraph. parbox is used to keep the line breaks. What value should I pass to \parbox's width so it doesn't get too wide as it does now? \documentclass{book}...
tush's user avatar
  • 1,103
7 votes
3 answers
328 views

Centering an Initfamily Letter within a Colorbox and Sizing It for Use as a Two-Color Lettrine

Consider the code \documentclass{book} \usepackage{lettrine} \usepackage{lmodern} \usepackage{xcolor} \usepackage{scalefnt} \usepackage[tracking=true]{microtype} \input GoudyIn.fd \newcommand*\...
DDS's user avatar
  • 8,491
0 votes
2 answers
108 views

\newenvironment with defined colorbox

Sorry if this has been asked before, but I couldn't find an answer, that fits my situation. I want to create a \newenvironment that produces a box, with a predefined color, and can have text inside. I ...
Mads Sahl Torjusen's user avatar
0 votes
1 answer
490 views

Color box with yellow border

How can I modify to produce something like this? I tried this code for colorbox but I can't see the yellow border \newtcolorbox{colorbox}[1]{ breakable, title=#1, colback=white, ...
주성우's user avatar
  • 133
2 votes
1 answer
96 views

Highlight source code keeping spacing intact

I try to highlight some lines of a code using colorbox in listings. \documentclass[12pt,a4paper]{report} \usepackage{xcolor} \usepackage{listings} \begin{document} \lstdefinestyle{data}{ ...
Theo's user avatar
  • 518
3 votes
1 answer
396 views

Verbatim/Lstlisting environment with background color highlighting

Use case: Currently we are reporting security findings using MS Word. These findings contain large parts of code snippets, command outputs and HTML code. We highlight relevant parts of this code so ...
Jan-Jaap Korpershoek's user avatar
1 vote
1 answer
55 views

Some problem about the frame

I have made a box and I have a few problems. The first one is that, no matter how I change the toptitle or the bottomtitle, the spacing between the box and the article below is still unchanged. How ...
Hưng Trần's user avatar
1 vote
1 answer
375 views

colorbox for a multi paragraph text

I adapt the solution in Set the width of a fcolorbox for a multiparagraph statement - there should be a uniform colour box encompassing multiple paragraphs: \documentclass{beamer} \usepackage{xcolor} \...
Viesturs's user avatar
  • 7,665
0 votes
2 answers
641 views

Highlighting code snippet in lstlisting with colorbox changes the character and breaks the border

I am using Texstudio with texlive 2021. To highlight some lines of the following code snippet in lstlisting, I am using colorbox \begin{lstlisting}[style=listing1] |\colorbox{yellow}{...
sepideha's user avatar
  • 169
1 vote
3 answers
956 views

How to colour the background of a Theorem

How to colour the background like the following picture in LaTeX
GameDev Rony's user avatar
0 votes
0 answers
174 views

Theorem Styles with \ref and \colorbox [duplicate]

Yesterday I publicated a question, link: Theorem styles with emph. But I still have other problems. My code: \documentclass{book} \usepackage[italian]{babel} \usepackage[utf8]{inputenc} \usepackage[...
Puck's user avatar
  • 1,158
0 votes
2 answers
475 views

\fcolorbox in \begin{equation}

Good evening I do not understand why Overleaf tells me that there is an error in this code \begin{equation}\fcolorbox{black}{gray!30}{$\color{blue}{\displaystyle{\lim_{n\longrightarrow+\infty}\dfrac{n!...
Puck's user avatar
  • 1,158
1 vote
2 answers
422 views

Color box with multiple lines and underlined text (within a paragraph)

In a paragraph, I want to highlight some part of the text (not the whole paragraph!) with a colorbox and also underline the text within that colorbox. This would be the result that I am looking for: ...
mar's user avatar
  • 11
3 votes
1 answer
349 views

Transparent colorbox with no text

This is related to Vary transparency of colorbox in a sentence I would like to have a transparent colorbox for some overlay and this attempt is not working \documentclass{article} \usepackage{soul,...
Ruth Lazkoz's user avatar
1 vote
2 answers
246 views

Color background of table using colorbox

I want to set a lightgray color behind my table, using colorbox. Following this solution, I created the following MWE: \begin{table}[H] \renewcommand{\arraystretch}{1.5} \centering \begingroup\...
NickG's user avatar
  • 193
2 votes
1 answer
115 views

Consecutive colorbox items does not line break in a table

I want to create a table with the long text content. Each word in the text is color boxed. But when this is done, the text does not wrap and there is no line break. Below is sample code: \begin{table}[...
Foshiba's user avatar
  • 123
2 votes
1 answer
211 views

one-column abstract is moved to next page when I use tcolorbox

I'm making a two-column document, but I need a one-column abstract with background-color for that I am using tcolorbox, if the content of the abstract is too long then the abstract content is moved to ...
Shalu's user avatar
  • 319
1 vote
0 answers
58 views

ntheorem and psframebox - bad box splitting

I am having some troubles with the typesetting of boxed theorems. I use ntheorem to typeset theorems in a colored frame, defining them via the \newshadedtheorem macro. The problem is that sometimes, ...
Manlio's user avatar
  • 480
2 votes
0 answers
97 views

Extending hline within a colorbox environment

I am trying to extend the hlines of the following table such that they span the entire width of the colorbox, but can't seem to figure out how. The current Latex code looks like this: \documentclass[...
user236014's user avatar
1 vote
0 answers
68 views

Left and right colour box equation

I'm looking for solution to get colour boxes for equations below (with optional box in one of them) - one for the right and one for the left - as on the picture below. Is it possible to get dialog ...
Delfina's user avatar
  • 11
1 vote
1 answer
96 views

How can I fill green the chapter in table of contents

How can I fill green the chapter in table of contents like this: I have read many place (for example Using colors in LaTeX document, Generate a table of contents,...) but I could not found any ideas ...
NKellira's user avatar
  • 199
1 vote
2 answers
243 views

Exact size of makebox

I am trying to create a page layout, where the page number is shown on the right margin in a white textcolor on a black background. \documentclass[parskip=full]{scrreprt} \usepackage[left=2cm,right=...
Chris's user avatar
  • 173
2 votes
3 answers
360 views

Overful hbox when using \colorbox in math mode

I got pretty long math formulas in my LaTeX document. Now I want to color the background of those formulas. However, if I use \colorbox{}{} the linebreak doesn't work anymore. Note: the gray bar at ...
TarantelFaser's user avatar
1 vote
2 answers
859 views

How to colorbox an entire section?

I want the last section of a chapter to have a colour background. I want to create a Summary section that needs to be differentiated. I already tried using colorbox (xcolor package): \colorbox{...
Fred Guth's user avatar
  • 156
4 votes
2 answers
479 views

Highlighting only the bottom half of a word

I would like to define a command for highlighting in the following style. Some people do this on paper and I would like to mimic that on a particular document. How could I achieve this? I thought of ...
Tera's user avatar
  • 97
1 vote
2 answers
402 views

How can I increase the font and sidebar size?

I would like to add increase the size of the sidebar to 2.5cm and increase the size of the text proportionally. At the bottom I would like to create a box taking the entire length of the frame. The ...
Antonio Mendes's user avatar
1 vote
2 answers
296 views

How to add borders with shaded environment (from the framed package)

I defined a shaded environement using the framed package (\usepackage{framed}) and I would like to add borders to the shaded area, how could I do it? For instance, how could I add borders in this ...
user6441253's user avatar
0 votes
1 answer
432 views

How to make a colour box in these 3 different ways

I want to put a text in a colour box in these 3 different ways. See the pictures below 1. Pic 1:- 2. Pic 2:- 3. Pic 3:- Please tell me.
Soham Chatterjee's user avatar
0 votes
0 answers
26 views

alternate background color for biblatex [duplicate]

I am trying to get alternate background color for bibliography, with AtBeginBebliography, as shown(Please note, \IF_COUNTER_IS_ODD does not have any meaning, it is just to show, I want orange \...
BaRud's user avatar
  • 2,159
2 votes
1 answer
269 views

How to put text inside chronoperiode timeline-bar?

How can I put text inside the bar instead of over the bar? Thank you in advance for your help! \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{chronosys} \begin{document} %--------...
Cecilie V's user avatar
1 vote
2 answers
242 views

How do I make a colored box around chemfig

How do I expand the box over both molecules (centered and middle space adjustable), but the borders within the enumerate environment? The image is what I want to make. I attempted to do the following, ...
Dave2627's user avatar
1 vote
1 answer
88 views

How to remove the section numbers while colouring the whole section line using \colorbox?

I have used the following piece of code for colouring the text written in the section. The only problem which I am facing is that after adding this code my section is getting numbered which I don't ...
Shivam Chakraborty's user avatar