Generally I agree with lockstep that circling might not be the best way to highlight text. In addition to his suggestions, you could also try using a light gray background.
Having said that, here is a way to circle text using TikZ:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,shapes.geometric}
\newcounter{nodemarkers}
\newcommand\circletext[1]{%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-a) at (0,1.5ex) {};%
#1%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-b) at (0,0){};%
\tikz[overlay,remember picture,inner sep=2pt]
\node[draw,ellipse,fit=(marker-\arabic{nodemarkers}-a.center) (marker-\arabic{nodemarkers}-b.center)] {};%
\stepcounter{nodemarkers}%
}
\begin{document}
\begin{tabular}{*6{c}}\hline
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\\hline
bla & bla & \circletext{bla} & bla & bla & bla \\
bla & bla & bla & bla & bla & bla \\
ble & ble & ble & bla & \circletext{bla} & bla \\
bla & bla & bla & bla & bla & bla \\ \hline
\end{tabular}
\end{document}
The \circletext
command defines a node to the left and right of the text and then fits an ellipse around them. More fanciful graphics are of course possible, this is a rather basic example (since I do not know what your table looks like). Two LaTeX runs are necessary to have everything show up in the right place.
Edit: Here is an example of how to mark arbitrary blocks. Ellipses don't look good with large blocks, so it is using rounded rectangles instead:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,shapes.misc}
\newcommand\marktopleft[1]{%
\tikz[overlay,remember picture]
\node (marker-#1-a) at (0,1.5ex) {};%
}
\newcommand\markbottomright[1]{%
\tikz[overlay,remember picture]
\node (marker-#1-b) at (0,0) {};%
\tikz[overlay,remember picture,thick,dashed,inner sep=3pt]
\node[draw,rounded rectangle,fit=(marker-#1-a.center) (marker-#1-b.center)] {};%
}
\begin{document}
\begin{tabular}{*6{c}}\hline
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\\hline
bla & bla & \marktopleft{c1}bla & bla & bla & bla \\
bla & bla & bla & bla & bla & bla \\
ble & ble & ble & bla & bla\markbottomright{c1} & bla \\
bla & bla & bla & bla & bla & bla \\
bla & \marktopleft{c2}bla & bla & bla & bla\markbottomright{c2} & bla \\ \hline
\end{tabular}
\end{document}
Normally a typewriter face is used to format shell commands. Just using \texttt
everywhere is not very pleasing semantically though. Furthermore, if you ever want to change how shell commands are typeset you would have to go through your code and check every occurence of \texttt
, determine if it is used to typeset a shell command and then possibly change it. Better would be to define a new command for this specific purpose. It makes it easy to see what you are typesetting and it allows you to change your mind about the typesetting quite easily at a later time. To define a new command we can use the LaTeX command \newcommand{cmd}[num of args]{definition}
. This approach also allows us to wrap the extra indentation and newlines inside of the command. It would look like this:
\newcommand{\shellcmd}[1]{\\\indent\indent\texttt{\footnotesize\# #1}\\}
It could then be used like this:
\documentclass{article}
\newcommand{\shellcmd}[1]{\\\indent\indent\texttt{\footnotesize\# #1}\\}
\begin{document}
\noindent Consider the following command:
\shellcmd{apt-get --purge remove rubygems}
This removes the \texttt{rubygems} package.
\end{document}
To the following effect:
You should note the initial newline in the command. If you want to use it at the start of the line, you could define a starred version that doesn't have the initial newline. For this the suffix pacakge is best suited. You can then define a starred version without the initial newline as follows:
\WithSuffix\def\shellcmd*#1{\indent\indent\texttt{\footnotesize\# #1}\\}
Best Answer
That's an interesting feature.....
\cellcolor
works better (and by using\cellcolor
on just some of the cells you can highlight smaller parts of the display)You can use
\cellcolor
also on the nested matrix: