3

I'd very much appreciate a bit of help on this subject.

I am trying to obtain an alignment between those two lines as shown in the picture below.

enter image description here

I can only manage to do it like this :

enter image description here

I also tried the tabular version, but no success, and if I put all of the letters in columns it will get too wide..

enter image description here

Here's my code:

\begin{table}[ht]
\begin{center}
\scriptsize
\bgroup
\def\arraystretch{0.5}
\begin{tabular}{*{31}{c}}

A \u A \^A B C D E F G H I \^I J K L M N O P Q R S \c S T \c T U V W X Y Z\\
\hspace{0.5pt}\\
\hline
\hspace{0.5pt}\\
K O \c S \^I U J R W \u A N \^A F D B Y Q H V G I E P \c T A X Z T S L C M\\
\end{tabular}


$$\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c||}
\hline
A & \u A & \^ A & B & C & D & E & F & G & H & I & \^ I & J & K & L & M & N & O & P & Q & R & S & \c S & T & \c T & U & V & W & X & Y & Z\\
\hline
K & O & \c S & \^ I & U & J & R & W & \u  A & N & \^ A & F & D & B & Y & Q & H & V & G & I & E & P & \c T & A & X & Z & T & S & L & C & M\\
\hline
\end{tabular}$$
2

3 Answers 3

3

Here's a solution which (a) employs a tabular* environment (with its overall width set to \textwidth) and (b) employs the \midrule macro of the booktabs package to draw a well-spaced horizontal line. Hence, there's no need to fiddle with \arraystretch.

enter image description here

\documentclass{article}
\usepackage{booktabs} % for \midrule macro
\begin{document}

\begingroup % limit scope of next instruction to current group
\setlength\tabcolsep{0pt} % let LaTeX determine amount of intercolumn padding
\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{31}{c}}
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 \\ 
\midrule
K & O & Ș & Î & U & J & R & W & Ă & N & Â & F & D & B & Y &
Q & H & V & G & I & E & P & Ț & A & X & Z & T & S & L & C & M \\
\end{tabular*}
\endgroup

\end{document}
1
3

Welcome to TeX.SX! I think, your approach using a tabular is already nice. You should probably not use vertical lines and omit the \hlines above and below the tabular. And there is no need to typeset the tabular in math mode. You can adjust the spacing by re-setting \arraystretch and \tabcolsep. In order to make these adjustments only for this tabular, you should place everything inside a group.

By the way, as long as you encode your file in UTF-8, you can type in the accented letters directly and, due to this fact, even use the proper characters for Romanian (S and T with comma below).

\documentclass{article}

\begin{document}

\noindent\begingroup
\renewcommand\arraystretch{1.5}   % change vertical spacing
\setlength\tabcolsep{1.6pt}       % change horizontal spacing
\begin{tabular}{ccccccccccccccccccccccccccccccccc} 
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 \\ \hline 
K & O & Ș & Î & U & J & R & W & Ă & N & Â & F & D & B & Y & 
Q & H & V & G & I & E & P & Ț & A & X & Z & T & S & L & C & M \\ 
\end{tabular}
\endgroup

\end{document}

enter image description here

1
  • This is very helpful! Also, thanks a lot for the tip encoding in UTF-8. Cheers. Aug 11, 2022 at 13:30
3

With tabularray package and X columns:

\documentclass{article}
\usepackage{tabularray}

\begin{document}

\noindent\begingroup
\begin{tblr}{colsep=0pt, colspec={*{31}{X[c]}}}
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 \\ 
    \hline
K & O & Ș & Î & U & J & R & W & Ă & N & Â & F & D & B & Y &
Q & H & V & G & I & E & P & Ț & A & X & Z & T & S & L & C & M \\
\end{tblr}
\endgroup
\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .