1

I want to perform addition in columns with both letters and digits in LaTeX. I have the following code, but spacing between letters and digits is wrong:

$\begin{array}{r} +  \begin{array}{r}  $ABC$\\  $B0A$ \end{array}\\ \hline \begin{array}{r}  $CA0$  \end{array} \end{array} $

1 Answers1

1

We changed the font to the monospaced one. I enclose a TeX code and a preview of the result. I run pdflatex on this file.

%! pdflatex mal-ru.tex
\documentclass[russian]{article}
\usepackage[T2A,T1]{fontenc}
%\usepackage[koi8-r]{inputenc}
\usepackage[utf8]{inputenc}
\makeatletter
\DeclareRobustCommand{\cyrtext}{%
  \fontencoding{T2A}\selectfont\def\encodingdefault{T2A}}
\DeclareRobustCommand{\textcyr}[1]{\leavevmode{\cyrtext #1}}
\AtBeginDocument{\DeclareFontEncoding{T2A}{}{}}
\usepackage{fancyhdr}
\usepackage{amssymb}
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in
\headsep=0.25in 
\linespread{1} % Line spacing
% Set up the header and footer
\pagestyle{fancy}
\lhead{\textcyr{\char204\char232\char235\char238\char241\char229\char240\char228\char238\char226}
\textcyr{\char194\char235\char224\char228\char232\char236\char232\char240}} % Top left header
\chead{\textcyr{\char194\char241\char242\char243\char239\char232\char242\char229\char235\char252\char237\char224\char255}
\textcyr{\char240\char224\char225\char238\char242\char224} \textcyr{\char226}
\textcyr{\char203\char216\char202}} % Top center header
\rhead{} % Top right header
\lfoot{} % Bottom left footer
%\cfoot{Page\ \thepage\ of 1} % Bottom center footer
\cfoot{}\rfoot{} % Bottom right footer
\renewcommand\headrulewidth{0.4pt} % Size of the header rule
%\renewcommand\footrulewidth{0.4pt} % Size of the footer rule
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\makeatother
\usepackage{babel}
\begin{document}
\section*{Задание T3 Ребус [C', C, B]}
$
\begin{array}{r} +  
\begin{array}{r}  
  \texttt{ABC}\\  
  \texttt{B0A} 
\end{array}
\\ \hline 
\begin{array}{r}  
\texttt{CA0}
\end{array} 
\end{array}
$
\end{document}

mwe

Malipivo
  • 13,287