1

I have a table with a small width and I would like to frame it, so that the frame doesn't have 100% width of the page but rather is closely around the table.

\begin{tabular}{r@{ $\rightarrow$ }l}
    er & é\\
    ir & i\\
    dre & u\\
    oir & u\\
\end{tabular}
5
  • 1
    \fbox{your super table} perhaps. Or put in an another, outer table
    – user31729
    Oct 4, 2015 at 15:04
  • @ChristianHupfer Not suggesting tcolorbox? ;-)
    – user11232
    Oct 4, 2015 at 15:08
  • @HarishKumar: Too much overhead :D
    – user31729
    Oct 4, 2015 at 15:09
  • @Larivact: Depends on the way
    – user31729
    Oct 4, 2015 at 15:17
  • @MartinSchröder Thanks :) This is my first day of using TeX and I am overwhelmed ... with joy.
    – Larivact
    Oct 4, 2015 at 15:35

1 Answer 1

5

There are some options:

  • \fbox{table environment}
  • \begin{tabular}{|c|}...inner table environment \end{tabular}
  • \frame{} (Not used it ever so far and it's not shown here)
  • tcolorbox (Harish Kumar ;-)` as one more sophisticated way

This list isn't complete of course.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}

\begin{document}

\fbox{%
  \begin{tabular}{r@{ $\rightarrow$ }l}
    er & é\\
    ir & i\\
    dre & u\\
    oir & u\\
  \end{tabular}
}


\begin{tabular}{|@{}c@{}|}
\hline
\begin{tabular}{r@{ $\rightarrow$ }l}
    er & é\\
    ir & i\\
    dre & u\\
    oir & u\\
\end{tabular}
\tabularnewline
\hline
\end{tabular}




\begin{tcolorbox}[enhanced jigsaw,halign=center,boxrule=1pt,boxsep=0mm,left=2pt,right=2pt,sharp corners,width=3cm,colback=yellow,drop fuzzy shadow=blue]

\begin{tabular}{r@{ $\rightarrow$ }l}
    er & é\\
    ir & i\\
    dre & u\\
    oir & u\\
\end{tabular}
\end{tcolorbox}


\end{document}

enter image description here

2
  • 1
    And there is \frame{}. Oct 4, 2015 at 15:19
  • @MartinSchröder: Thanks, I added your suggestion
    – user31729
    Oct 4, 2015 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .