[Tex/LaTex] How to change the font of a LaTeX table to typewriter font

fontstablestypewriter

I want to create a table in LaTeX, and this table needs to be in typewriter font.

I have found Typesetting Tables with LaTeX, but I don't understand how to use it.

How could I do this?

Best Answer

If the entire content of your tables, including the caption, needs to be set in typewriter or monospaced font, the following code (to be inserted in your document's preamble) will do the font switching for you transparently:

\makeatletter
\renewenvironment{table}%
  {\renewcommand{\familydefault}{\ttdefault}\selectfont
  \@float{table}}
  {\end@float}
\makeatother

On the other hand, if you want only the "tabular" portion of a table (but not the caption) to be typeset in typewriter font, you're probably best off (i) inserting the command \texttt{%, on a line by itself, right before the \begin{tabular}{...} line and (ii) adding a solitary closing brace, }, immediately after the \end{tabular} instruction. Happy TeXing!