How to automatically use typewriter font in arrays?
Something like this?
\documentclass{article}
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{T}{>{\ttfamily}c}
\begin{document}
\begin{center}
\begin{tabular}{ T | T }
p & ($\lnot$p) \\
\hline
1 & 0 \\
0 & 1 \\
\end{tabular}
\end{center}
\end{document}
Since \ttfamily
is a text-mode command, I suggest employing a tabular
environment rather than an array
environment.
I think you might have an XY-problem here.
With many OpenType fonts, you would be able to use the command
\addfontfeatures{Numbers={Monospaced,Lining}}
to get fixed-width numbers in a more-attractive font. You might wrap this in an environment, such as:
\newenvironment{arraymono}%
{\begingroup\addfontfeatures{Numbers={Monospaced,Lining}}\begin{array}}%
{\end{array}\endgroup}
You might also find the Unicode figure space, which is exactly as wide as a tabular digit, useful here:
\newcommand\figspace{^^^^2007}