I created a table in Lyx and I would like to put a square around a column to highlight the results without using the ERT command. Is that possible? I found that \colortbl and \mystrut can be useful but I don't see how to implement them. Thanks a lot for any help!
-
Might we see the code for your table? It would be easier to help.– BernardJan 10, 2016 at 1:23
-
I'm using Beamer in Lyx and not Latex. If I export to Latex, the code is \begin{tabular}{lcccc} \hline \hline & {\small{}Mean} & {\small{}St. Dev.} & {\small{}Min} & {\small{}Max}\tabularnewline \hline \hline \hline & & & & \[-5ex]\tabularnewline \end{tabular}– Francesca TondaJan 10, 2016 at 19:07
-
I can help only on the code. I'll try to see how it can be done. You should post in your question a small compilable code. Which column would you like to highlight?– BernardJan 10, 2016 at 19:29
-
Sure, here it is. Wanted to highlight col C (i.e. put a red rectangle around it).– Francesca TondaJan 10, 2016 at 20:15
-
documentclass[english]{beamer} \usepackage{mathpazo} \renewcommand{\sfdefault}{lmss} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{amsmath} \usepackage{amssymb} \usepackage{graphicx} \PassOptionsToPackage{normalem}{ulem} \usepackage{ulem} \makeatletter– Francesca TondaJan 10, 2016 at 20:16
1 Answer
Here is a simple solution with pstricks
: I define a node
at the top of the column, another node at the bottom, and I connect them with a \ncbox
command. The width of the box is automatically calculated thanks to the eqparbox
package: top node and bottom node use a system of tags which is used to compute the largest node. Note you have to use the --enable-write18
switch for pdflatex
, if the distribution is MiKTeX
, --shell-escape
if it is TeX Live
. Alternatively, you can compile with xelatex
\documentclass[a4paper, x11names]{article}
\usepackage{array}
\usepackage{eqparbox}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}
\newlength\boxsize
\begin{document}
\begin{postscript}
\renewcommand\arraystretch{1.5}
\begin{tabular}{lcccc}
\hline \hline
& {\small{}Mean} & \Rnode{T}{\eqmakebox[H]{\small{}St. Dev.}} & {\small{}Min} & {\small{}Max}\\
\hline \hline \hline
Blah & Blah & \Rnode{B}{\eqmakebox[H]{Blah}} & Blah & Blah \\[-5ex]
\tabularnewline
\end{tabular}
\setlength{\boxsize}{\dimexpr\eqboxwidth{H}/2+\fboxsep\relax}
\ncbox[linecolor=PaleVioletRed3, boxsize=\boxsize, nodesep=4pt]{T}{B}
\end{postscript}
\end{document}
-
That is fantastic, many thanks! Any idea on how to use the -shell-escape in Lyx? Jan 10, 2016 at 20:46
-
Unfortunately, I don't use it, and couldn't tell you, but it should be in some configuration file, where pdflatex.exe is mentioned. Also, you don't need it if your engine is
xelatex
.– BernardJan 10, 2016 at 20:50 -
@FrancescaTonda see Tools > Preferences > File Handling > Converters. Read Help > Customization for more information on how to modify the underlying commands that LyX runs. Jan 10, 2016 at 22:44