Graphics, Figures & TablesHighlight Line of Tables

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
joshua_smith_158
Posts: 15
Joined: Sun Aug 30, 2015 11:13 pm

Highlight Line of Tables

Post by joshua_smith_158 »

Hi all,

In order to highlight the results in a Lyx Table I need to put a red box around a table column. Any idea on how to do so?

I tried \colortbl, \boxed but didn't work.

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Highlight Line of Tables

Post by Stefan Kottwitz »

Hi Joshua,

have a look at this example: Highlighting in a formula.

That method also works with tabular instead of matrix or array.

Stefan
LaTeX.org admin
joshua_smith_158
Posts: 15
Joined: Sun Aug 30, 2015 11:13 pm

Highlight Line of Tables

Post by joshua_smith_158 »

Stephen, thanks a lot! This is awesome. Since I use Lyx (Beamer in Lyx more specifically) and not Latex, I put

Code: Select all

\usepackage{amsmath} 
\usepackage{tikz} 
\usetikzlibrary{fit} 
in the preamble. So, I need to put

Code: Select all

\newcommand{\overlay}[2][]{\tikz[overlay, remember picture, #1]{#2}} \tikzset{ highlighted/.style = { draw, thick, rectangle, rounded corners, inner sep = 0pt, fill = red!15, fill opacity = 0.5 } } \newcommand{\highlight}[1]{% \overlay{ \node [fit = (left.north west) (right.south east), highlighted] (#1) {}; } } \newcommand{\flag}[2]{\overlay[baseline=(#1.base)] {\node (#1) {$#2$};}} 
just before the table?
I tried but I got an error message.

Thanks a lot again!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Highlight Line of Tables

Post by Stefan Kottwitz »

Hi Joshua!

Sorry I'm traveling without Internet (test voyage of an unfinished cruise ship) so I could not answer.
joshua_smith_158 wrote: I tried but I got an error message.
Please tell us the error message.

Generally it would be good if you would post the code you tried as .lyx attachment in the forum, and even better as LaTeX export. (reduced copy, but compilable or bringing the error)

Stefan
LaTeX.org admin
Post Reply