# How to change font type face only in table environment?

Why doesn't the \ttdefault change the font in the table? I want to change font for a single table only.

\begin{table}[h!]
\singlespacing
\footnotesize
\ttdefault
\caption{Some caption.}
\label{tab:xxx}\centering
\begin{tabularx}{\textwidth}{XXX}
\toprule
test1 & test2 & test3 \\
test1 & test2 & test3 \\
test1 & test2 & test3 \\
\bottomrule
\end{tabularx}
\end{table}
-
Welcome to TeX.sx! \ttdefault is not a font changing command; you probably want \ttfamily, put it just before the tabularx –  egreg May 4 '13 at 12:35

If you need to have the entire table, including the caption, typeset in monospaced font, you can achieve this by inserting the sequence

\renewcommand{\familydefault}{\ttdefault}\normalfont

immediately following the \begin{table} instruction:

\documentclass{article}
\begin{document}
\begin{table}
\renewcommand{\familydefault}{\ttdefault}\normalfont
\caption{The table's caption} \label{tab:tt}
\centering
\begin{tabular}{cc}
\hline