# Problem aligning two alphabets

I'm trying to align two alphabets in such a way that each letter is aligned to the one below such that they fit on the page. I'm having real difficulty of doing this any suggestions would be great i've tried as much as i can. Here is as close as i've managed to get.

\begin{align*}
&\text{Plaintext:\;\;\; }\text{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\\
&\text{Ciphertext:  }\;\text{Z Y X W V U T S R Q P O N M L K J I H G F E D C B A}
\end{align*}


Best regards and much thanks Jay

Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

I would use the tabular environment and a monospace font.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\text{Plaintext:\;\;\; }\text{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\\
&\text{Ciphertext:  }\;\text{Z Y X W V U T S R Q P O N M L K J I H G F E D C B A}
\end{align*}

\noindent\begin{tabular}{ll}
Plaintext: & \texttt{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\\
Ciphertext: & \texttt{Z Y X W V U T S R Q P O N M L K J I H G F E D C B A}
\end{tabular}
\end{document}


• Thank you for the welcome I'll make sure to read the starter guide, your solution worked a treat so thank you for that. – Dead_Ling0 Oct 19 at 21:23

If you don't want to change font, you might use something like this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array,tabularx,rotating}

\begin{document}

\begin{sidewaystable}
\centering\setlength\tabcolsep{2.5pt}%
\begin{tabularx}\linewidth{l*{26}X}
Plaintext: &A &B &C &D &E &F &G &H &I &J &K &L &M &N &O &P &Q &R &S &T &U &V &W &X &Y &Z\\
Ciphertext: &Z &Y &X &W &V &U &T &S &R &Q &P &O &N &M &L &K &J &I &H &G &F &E &D &C &B &A\\
\end{tabularx}
\end{sidewaystable}

\end{document}


A tabular is better; one can also go the extra mile and simplify the input. With w{c}{1em} we get a fixed width cell; I also set the intercolumn space to zero, because in this application it's not needed.

The \tl_map_function:nN instruction splits the first argument into tokens and applies to each one the specified function, whose duty here is to add & in front of the letter.

\documentclass{article}
\usepackage{xparse,array}

\ExplSyntaxOn

\NewDocumentCommand{\cipher}{m}
{% #1 = a permutation of 26 letters
}

{
\group_begin:
\setlength{\tabcolsep}{0pt}
\begin{tabular}{l@{\hspace{1em}}*{26}{w{c}{1em}}}
Plaintext:
Ciphertext:
\end{tabular}
\group_end:
}

\cs_new:Nn \__deadlingo_cipher_cell:n { & #1 }

\ExplSyntaxOff

\begin{document}

Here is one cipher
\begin{center}
\cipher{Z Y X W V U T S R Q P O N M L K J I H G F E D C B A}
\end{center}
and here's another one, usually called ROT13,
\begin{center}
\cipher{N O P Q R S T U V W X Y Z A B C D E F G H I J K L M}
\end{center}

\end{document}


If you prefer a monospaced font:

\documentclass{article}
\usepackage{xparse,array}

\ExplSyntaxOn

\NewDocumentCommand{\cipher}{m}
{% #1 = a permutation of 26 letters
}

{
\group_begin:
\setlength{\tabcolsep}{0pt}\ttfamily
\begin{tabular}{l@{\hspace{1em}}*{26}{w{c}{1em}}}
\normalfont Plaintext:
\normalfont Ciphertext:
\end{tabular}
\group_end:
}

\cs_new:Nn \__deadlingo_cipher_cell:n { & #1 }

\ExplSyntaxOff

\begin{document}

Here is one cipher
\begin{center}
\cipher{Z Y X W V U T S R Q P O N M L K J I H G F E D C B A}
\end{center}
and here's another one, usually called ROT13,
\begin{center}
\cipher{N O P Q R S T U V W X Y Z A B C D E F G H I J K L M}
\end{center}

\end{document}