我想在这个长除法问题中添加一个小数位字符,所以问题是 211.73 div 50 而不是 21173 div 50。我不想再有一个专门用于小数的框,尽管如果没有其他选择,这是一个选择。我想让小数位字符准确地显示在网格线上。有没有简单的方法来实现这一点?
\documentclass[12pt,twoside]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{array}
\usepackage{tabu}
\begin{document}
\setlength{\tabcolsep}{2pt}
\def\arraystretch{1.3}
\begin{center}
\begin{tabu} to 4.4cm{|[Gray]*{8}{>{\fontsize{16}{32}\selectfont}X|[Gray]}}
\tabucline[0.5pt Gray]{-}
&&&&&\textcolor{red}{4}&\textcolor{red}{2} & \textcolor{red}{3} \\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{3-8}
5&0&)&2&1&1&7&3 \\
\tabucline[0.5pt Gray]{-}
&&-&2&0&0&&\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{3-6}
&&&&1&1&7&\\
\tabucline[0.5pt Gray]{-}
&&&-&1&0&0&\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{4-7}
&&&&&1&7&3\\
\tabucline[0.5pt Gray]{-}
&&&&-&1&5&0\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{5-8}
&&&&\textcolor{red}{R}&&\textcolor{red}{2}&\textcolor{red}{3}\\
\tabucline[0.5pt Gray]{-}
\end{tabu}
\end{center}
\end{document}
我制作了一张概念图来阐明我想要什么。
答案1
我不知道是否还有其他方法,但是用\tikzmark
很简单。
我还根据自己的喜好修改了单元格对齐方式,但是,当然,您可以保留您的喜好。
\documentclass[12pt,twoside]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{array}
\usepackage{tabu}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\tikzset{%
pics/linedot/.style={code={\fill[black] (-0.145,0.05) circle (1pt);}},
}
\begin{document}
\setlength{\tabcolsep}{2pt}
\def\arraystretch{1.3}
\begin{center}
\begin{tabu} to 4.4cm{|[Gray]*{8}{>{\fontsize{16}{32}\selectfont\centering\arraybackslash}m{1em}|[Gray]}}% I've put \centering\arraybackslash}m{1em} only because it seems to me that the alignment is better this way, of course you can leave you X
\tabucline[0.5pt Gray]{-}
&&&&&\textcolor{red}{4}&\tikzmark{a}\textcolor{red}{2} & \textcolor{red}{3} \\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{3-8}
5&0&)&2&1&1&\tikzmark{b}7&3 \\
\tabucline[0.5pt Gray]{-}
&&-&2&0&0&&\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{3-6}
&&&&1&1&\tikzmark{c}7&\\
\tabucline[0.5pt Gray]{-}
&&&-&1&0&\tikzmark{d}0&\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{4-7}
&&&&&1&\tikzmark{e}7&3\\
\tabucline[0.5pt Gray]{-}
&&&&-&1&\tikzmark{f}5&0\\ [-1pt]
\tabucline[0.5pt Gray]{-}\\[-20pt]\tabucline[1pt Black]{5-8}
&&&&\textcolor{red}{R}&&\tikzmark{g}\textcolor{red}{2}&\textcolor{red}{3}\\
\tabucline[0.5pt Gray]{-}
\end{tabu}
\end{center}
\begin{tikzpicture}[overlay,remember picture]
\foreach \i in {a,...,g}
\pic at (pic cs:\i) {linedot};
\end{tikzpicture}
\end{document}