2

Open to any and all suggestions / alternative layouts. Need to be able to cleanly circle a number inside of a table. Currently I have this (stolen from elsewhere) and it produces output as attached.

pic

\usepackage{tikz}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

% A completed self assessment sheet (see end of this document).
\section{Self Assessment}

\begin{table}[h]
\begin{tabular}{llllllllllllll}
Level 1 & A & 18 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & \circled{10} \\
Level 2 & V & 12 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & \circled{10} \\
Level 3 & AA & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & \circled{9} & 10 \\
Level 4 & S & 12 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 5 & I & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 6 & S & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 7 & C & 6  & 0 & 1 & 2 & 3 & 4 & 5 & 6 & \circled{7} & 8 & 9 & 10 \\
Level 8 & R & 16 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 &   
\end{tabular}
\end{table}
4
  • 1
    Use c for the columns
    – egreg
    Nov 28, 2014 at 16:58
  • @egreg Where does the c go? Nov 28, 2014 at 17:00
  • 1
    \begin{tabular}{l l r *{11}{c} }
    – egreg
    Nov 28, 2014 at 17:01
  • @egreg hot damn get you a medal Nov 28, 2014 at 17:06

1 Answer 1

8

You want centered columns, but also to increase the interline space in the table.

\documentclass{article}
\usepackage{tikz}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{% <---- BEWARE
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

\begin{document}

\begin{table}
\centering
\renewcommand{\arraystretch}{1.4}

\begin{tabular}{l l r *{11}{c}}
Level 1 & A & 18 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & \circled{10} \\
Level 2 & V & 12 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & \circled{10} \\
Level 3 & AA & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & \circled{9} & 10 \\
Level 4 & S & 12 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 5 & I & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 6 & S & 10 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 & 10 \\
Level 7 & C & 6  & 0 & 1 & 2 & 3 & 4 & 5 & 6 & \circled{7} & 8 & 9 & 10 \\
Level 8 & R & 16 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & \circled{8} & 9 &
\end{tabular}

\end{table}
\end{document}

enter image description here

Since the redefinition of \arraystretch is issued in a table environment, it will be undone at the end of the environment, so it won't affect other tables.

Don't forget protecting end-of-lines.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.