3

You know how most fonts and typography in general have characters/glyphs of various widths? Like if you compare a regular font:

A E I O U
Z X C V B
a e i o u
z x c v b

They don't quite line up perfectly like a fixed width or monospace font does:

A E I O U  
Z X C V B  
a e i o u  
z x c v b  

I've just discovered how it's possible to align parts of a LaTeX document (still getting the hang of it) and I was curious to find out if it's possible to align and center every individual character of an ordinary font, so as to emulate fixed width characters of monospaced fonts.

If you look closely the actual characters are not all necessarily the same width, but the characters and the empty space around them amount to the same dimensions, which is what makes me think it might be possible:
A E I O U
a e i o u
Z X C V B
z x c v b

Some more obvious comparisons:
1 I ! | .
0 W ?

Anyway, it could be quite useful to me, if it's possible. Might end up just being to ugly for this life, but I'd like to give it a shot if anyone can think of a way to do it.

3

I use a tabbed stack, with an input space as the tab character (it does not show in the output). I also force all columns to be equal width, which will take on the widest character in the matrix.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tabstackengine}
\begin{document}
\setstackTAB{ }
\fixTABwidth{T}
\tabbedCenterstack{
A E I O U\\
a e i o u\\
Z X C V B\\
z x c v b\\
1 I ! | .\\
0 W ? — … 
}
\end{document}

enter image description here

I can employ a negative tab gap, \setstacktabbedgap{-4pt}, to squeeze the columns together, but then the em-dash and ellipsis overlap:

enter image description here

2

A simple solution is to use the listingspackage with fixed width columns:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{listings}

\lstset{
    columns=fixed,
    literate={—}{{---}}1 {…}{{...}}1
}

\begin{document}
\begin{lstlisting}
A E I O U
a e i o u
Z X C V B
z x c v b

1 I ! | .
0 W ? — …
\end{lstlisting}
\end{document}

enter image description here

Note that listings doesn't work well with Unicode characters (TeX.SX has several questions on that matter), so I used the literate option as a quick fix here.

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.