我想在 LaTeX 中对包含字母和数字的列执行加法。我有以下代码,但字母和数字之间的间距是错误的:
$\begin{array}{r} + \begin{array}{r} $ABC$\\ $B0A$ \end{array}\\ \hline \begin{array}{r} $CA0$ \end{array} \end{array} $
答案1
我们将字体改为等宽字体。我附上了一个 TeX 代码和结果预览。我pdflatex
在这个文件上运行。
%! 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}