We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [colorbox]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
10
votes
2answers
6k views

Colorbox does not linebreak

I'm new here, so I'm sorry for any mistakes or error in from my part. I am trying to make colored textboxes that refer to colored blocks in a figure. My problem is that the colored box does not ...
9
votes
6answers
674 views

Using background colors in monospaced text

I am trying to generate this in my document: The goal is to have multiple lines that are aligned, which is why I used \texttt{}. But using \colorbox{color}{text} from the xcolor package, this is what ...
7
votes
1answer
12k views

highlighting math

The issue of breakable highlighting was addressed in Cool Text Highlighting in LaTeX But how, in latex, do I highlight text involving math, something like which, right now, I do with a succession of ...
6
votes
3answers
243 views

About a colored table

I am facing a problem of making a table with colored row. The target picture is as follows: My own tex code about the required colored table is as follows: \documentclass[french]{article} \...
6
votes
1answer
10k views

How to change options in the fcolorbox environment

How can I change the options in \fcolorbox{black}{gray!30}{My text} so that the box gets rounded corners for instance or a thicker border? Best regards Henrik
5
votes
3answers
408 views

width of colorbox

I was wondering if there's a way to set the length of a colorbox. For example: As you can see, the right edge of the box is a bit too much (and the left edge too), and I just want the edges to ...
4
votes
3answers
70 views

How to colour a table with opaque colour such that no text and no lines are visible?

I am iterating a latex file and want to colour all the tables green such that no text or no lines are visible. I tried using "transparent" but it fades the colour along with the text. I want the ...
4
votes
3answers
969 views

How to force a \colorbox to be \pagewidth

I am wanting to make a band of color that stretches across the entire page that will have contact information inside of it. I am attempting this using the color package, and \colorbox. I can not seem ...
4
votes
2answers
296 views

font-size in colorbox inside psmallmatrix

I use \colorbox to highlight stuff with a background color. In normal text, this works great. I stumbled over an inconsistency of font-sizes when using \colorbox combined with psmallmatrix from the ...
4
votes
1answer
292 views

Font used for special characters in listings

I'm trying to highlight code fragments in the listings environment. To do this, I'm using a colorbox with no padding as shown in this answer: \newcommand{\reducedstrut}{\vrule width 0pt height .9\ht\...
4
votes
1answer
1k views

transparency in colorbox

I want to define my paragraphs and subsubsections to always be inside of a transparent box with a certain color. I know that there's a transparency-package but this doesn't work with the PDF-view ...
3
votes
3answers
111 views

Redefine `\uline` so `\colorbox` is locally defined to have underlined text, too

Initial problem: I want to underline the text with a continuous line with the following code: \uline{No underlining for \colorbox{lightgray}{everything} inside the colorbox.} Workaround: A ...
3
votes
3answers
1k views

How can I put two colored boxes next to each other?

I would like to have text in two colored boxes next to each other. I found \tcbox, but it automatically adds a linebreak. Please note: I can use anything that works with pdflatex. No need for \tcbox, ...
3
votes
1answer
271 views

Specific type of box around equation

When I write notes by hand, if I want to box an equation, I usually do it in the following way. I find the lowest (highest) point of the equation, I go a little bit higher (lower) and take a line, ...
3
votes
1answer
4k views

Remove border of a framebox

I would like to insert an inline box. I have tried this: \usepackage{color} \definecolor{shadecolor}{rgb}{1,.8,.3} \begin{document} {\setlength{\fboxsep}{0pt} \framebox{\setlength{\fboxsep}{5pt}\...
3
votes
1answer
79 views

How can I wrap `\colorbox` around `\Verb[commandchars=\\\{\}]` by only changing the preamble?

This is a follow-up question to How can I use `\renewcommand` to wrap `\colorbox` around `\Verb`? I have TeX files which contain code like: \Verb|print("Hello World", end="")| The \Verb content ...
3
votes
1answer
482 views

\colorbox height too long

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{minted} \usepackage{parskip} \definecolor{codegray}{gray}{0.9} \newcommand{\code}[1]{\colorbox{codegray}{\texttt{#1}...
3
votes
1answer
1k views

How to control the dimensions of \colorbox

I want a long narrow horizontal colored rectangle, something more like a thick line, but I cannot get the height below a certain amount. The best I can come up with is: \documentclass[11pt]{book} \...
3
votes
1answer
271 views

Adjust height of Colorbox

Hello I am looking to improve the equality of these colorboxes. You can see the difference in the dimensions of the shading. I tried the \strut command but it changed the table too much. This is the ...
2
votes
1answer
343 views

How to reduce colorbox width for text?

Here's the MWE: \documentclass[a4paper, 12pt]{article} \renewcommand{\rmdefault}{ptm} \usepackage[table]{xcolor} \definecolor{tpgray}{gray}{0.90} \newcommand{\tp}[1]{\colorbox{tpgray}{#1}} \begin{...
2
votes
1answer
83 views

Table inside fancyvrb with continuous colorbox?

So I'm trying to insert a table (with an image) in the middle of a \fancyvrb of R code. The \fancyvrb has a \colorbox around it in gray. Is there a way to get all three parts (verbatim pt1, table, ...
2
votes
2answers
2k views

Overlay specification with beamer and '\colorbox'

I use \colorbox in my slides to highlight part of the text (as if it was highlighted with a marker). The command also accepts beamer overlay specifications (e.g. \colorbox<1>{yellow}{Text}). ...
2
votes
1answer
78 views

How can I use `\renewcommand` to wrap `\colorbox` around `\Verb` by only changing the preamble?

What works: I have TeX files which contain code like: I want \texttt{this text} to have a background color. I want the \texttt to have a background color: I want \colorbox{lightgray}{\texttt{this ...
2
votes
2answers
425 views

Lstlisting with shaded background color adds block on bottom

Currently I have no idea why the shaded box adds this spacing at the bottom of my listing: I'm not sure if the shaded box adds this spacing after the caption or if the listing just adds this extra ...
2
votes
1answer
83 views

How do you remove spacing from multiple beamer color boxes on the same line?

I am working on my own Beamer theme for use in presentations. Along the bottom (in the footline) I want to have three color boxes in a row which have different colors. Within my theme.sty file I have ...
2
votes
1answer
77 views

Alignment of minipages and colorbox

I have this document which I try to reproduce in Latex. I am using the colorbox and minipage. But I got confused with an alignment. Can I get the expected results with current packages or should I try ...
2
votes
1answer
65 views

Is it possible to add colored text (spaces, or colored boxes) to a headrule?

I intend to use small colored boxes in front of sections in order to identify at which heading level the text is located, and I'd want my reader to quickly reference the heading level by color. My ...
2
votes
1answer
195 views

Different definitions of fboxsep in different parts of the code

Is it possible to define one value of \fboxsep to use in an \fbox, for example, and then use another value to use in, say, a \colorbox? Can you define such values locally?
2
votes
1answer
3k views

Breakable \colorbox? [duplicate]

Given a phrase in the middle of which TeX will place a return carriage, if we place this phrase within a \colorbox, TeX no longer places the return carriage and the phrase protrudes in the margin. Is ...
2
votes
1answer
55 views

How to set a fixed height to a colorbox?

I currently have a simple colorbox, I would like to increase its height. Is there a way to set a fixed height, or maybe a kind of padding? I added \hspace to add some space horizontally, but a \vspace ...
2
votes
2answers
83 views

Same font for listing and escaped latex

I'm trying to animate the C code. So I've used a colorbox to highlight the current row (How btw I can highlight the whole row?). My problem is, I'm not that familiar with fonts, so I do not know how ...
2
votes
1answer
169 views

How to make box sizes consistent and “glue” boxes together (in beamer)?

I have been putting together a new beamer template and cannot solve a few last problems. A minimal working example that highlights these problems is the following (it doesn't look minimal but I feel ...
2
votes
2answers
371 views

Adjusting vertical space around equation using \empheq package

I have been using a simple method for adding a framed, colored box around important equations I want to highlight. The empheq package has worked well. However, I am having a lot of trouble figuring ...
2
votes
1answer
292 views

\parbox inside \colorbox ends up being to wide

Can you tell me why the following code always ends up being to wide (minimal example)? It seems to be independent of the environment so I assume that \colorbox has some additional margin? How can I ...
1
vote
2answers
293 views

How to make a border for my own environment?

\documentclass{book} \title{Introduction to Latex} \author{Me} \date{} \usepackage[dvipsnames]{xcolor} \usepackage{exsheets} \SetupExSheets{counter-within={chapter}} \newenvironment{myquestion} {\...
1
vote
2answers
111 views

How to use several colors in one row in latex table

I need to write very long table (128 rows x 64 columns), with different colors in a rows. Also it have to have "color in color" within one row, so it can be interpreted as one row consists of several ...
1
vote
3answers
342 views

How to make \colorbox fill the color between underline and overline of a text?

I want the \colorbox to fill the content between underline and overline of a text. How can i achieve this? Currently, i use $\overline{\underline{\colorbox{light-gray}{\makebox [\textwidth][l]{\...
1
vote
1answer
55 views

Highlighting of words in table header displaces non-highlighted words

I have a quite simple table (even more reduced for minimum example) with some highlighting. By using \colorbox and \tikz\node (with and without inner sep argument) I create boxes around text, but the ...
1
vote
2answers
85 views

Add space below a \colorbox

I have created a new command using colorbox as follow: \newcommand{\resheading}[1]{{\small \colorbox{mygrey}{\begin{minipage}{0.975\textwidth}{\textbf{#1 \vphantom{p\^{E}}}}\end{minipage}}}} This is ...
1
vote
1answer
170 views

CV with timeline

Here you can find a latex template for Cvs. https://www.overleaf.com/articles/satish-kumars-cv/dngwrghdxxqh. I am facing an issue with the timeline environment. The code follows: \newcounter{...
1
vote
2answers
59 views

Automated a minipage+fcolorbox with a newenvironment [duplicate]

How could I create a new environment to automated the following code? \noindent\fcolorbox{white}{lightgray}{ \begin{minipage}{0.96\textwidth} some text in here \end{minipage} }
1
vote
2answers
50 views

Display colored strings in small font size

I want to display random strings made up of 's' and 'f' such that every s is white on a blue background and every f is white on a red background. I can make it work fine in normal text, but when I ...
1
vote
1answer
83 views

LaTeX break before box

I have a document involving multiple colorboxes containing 1-3 words each in a single line, separated by ,. Imagine typesetting a couple of boxes in a line, so that there's only 3cm of space to the ...
1
vote
1answer
610 views

How to create a colorbox with only one rounded corner [duplicate]

is there any posibility of creating a coloured text box with only one rounded corner? (Maybe using tikz) Thank You
1
vote
1answer
27 views

How to change the color of font in all text in '' \declaretheorem "

\documentclass[12pt]{article} \usepackage{lmodern} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{amsthm} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[...
1
vote
2answers
615 views

Baposter: adjust transparency of body of context boxes

I am framing a poster using \baposter and making use of \definecolor{boxcolor} to select the background colour of the body of the content boxes. I am able to adjust the shade and colour of the boxes ...
1
vote
1answer
84 views

how can we highlight a long title?

I want to highlight my title with a certain color. My title is long and it lays in 3 lines. How can I create a colorbox for the title? \title{My Desired Title} conflicts with the command \hl.
1
vote
1answer
76 views

Lines and colorboxes in background of the text

I am very new at latex and therefore I am not really sure what I am searching for, so maybe I thought someone of you could help me! I want - I am trying to modify some template for a cover letter, ...
1
vote
1answer
192 views

Highlight text in \mtctitle

I would like to produce a title for a table of contents that is highlighted in yellow. However the code \renewcommand{\mtctitle}{\colorbox{yellow}{Contents}} does not seem to work, instead giving ...
1
vote
1answer
221 views

colored columns with colored titles in beamer class

I'm trying to create a 2-column poster using the beamer documentclass. Each column is to be split into several blocks and each of these blocks has its own title. The titles should have a background ...