类型的计数标记并希望从表中删除垂直线

类型的计数标记并希望从表中删除垂直线

问题:1 按照以下mwe,我想要第五行像\而不是/。

\documentclass{article}
\usepackage[misc]{ifsym}

\newcount\tallycount
\newcommand{\dotally}{%
\loop\ifnum\tallycount>4\relax\StrokeFive\
\advance\tallycount by-5\repeat
\ifcase\tallycount\or\StrokeOne\or\StrokeTwo\or
\StrokeThree\or\Strokefour\else ERROR\fi\unskip}

\newcommand{\tally}{\afterassignment\dotally\tallycount }

\begin{document}
\tally 10

\end{document}

问题:2 我如何使用下表第二列中的计数标记。此外,我不想在表格第五行中单词“total”后面有一行。

\documentclass[12pt, letterpaper]{article}
\usepackage[a4paper,top=0.8 in,bottom=0.8 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
    \begin{tabular}{|c|c|c|}
    \hline \rule[-1ex]{0pt}{3.7ex} \textbf{x} & \textbf{Tally Marks} & \textbf{y}\\ 
    \hline \rule[-1ex]{0pt}{3.7ex} A &  & $8$\\ 
    \hline \rule[-1ex]{0pt}{3.7ex} B &  & $14$\\ 
    \hline \rule[-1ex]{0pt}{3.7ex} AB &  & $13$\\ 
    \hline \rule[-1ex]{0pt}{3.7ex} O &  & $10$\\ 
    \hline \rule[-1ex]{0pt}{3.7ex} \textbf{Total} &  & $\boldsymbol{45}$\\ 
    \hline 
\end{tabular} 
\end{document} 

答案1

编辑: 宏定义有误\tally\Strokefour您应该使用\StrokeFour

除此之外,您对页面大小的定义也存在争议。是“信纸”大小还是“A4”大小?在下面的例子中,我考虑了您在geometry选项中输入的 A4(我将其简化为所有页面边的边距相等)。

关于表格,看看下面的例子是否是你想要的:

\documentclass[12pt, letterpaper]{article}
    \usepackage[a4paper,margin=1 in]{geometry}
    \usepackage[utf8]{inputenc}
    \usepackage[misc]{ifsym}
    \usepackage{amsmath,amssymb}

\newcount\tallycount
\newcommand{\dotally}{%
    \loop\ifnum\tallycount>4\relax\StrokeFive\  
         \advance\tallycount by-5%
    \repeat%
    \ifcase \tallycount\or\StrokeOne\or\StrokeTwo\or\StrokeThree\or\StrokeFour
    \else   ERROR
    \fi%
    \unskip}
\newcommand{\tally}{\afterassignment\dotally\tallycount }

    \begin{document}   
\renewcommand{\arraystretch}{1.2}
    \begin{tabular}{|c|c|c|}
    \hline
\textbf{x}      & \textbf{Tally Marks}
                                & \textbf{y}    \\  \hline
A               &   \tally 8    & $8$           \\  \hline
B               &   \tally 14   & $14$          \\  \hline
AB              &   \tally 13   & $13$          \\  \hline
O               &   \tally 10   & $10$          \\  \hline
\multicolumn{1}{c}{\textbf{Total}}
                & \multicolumn{1}{c}{}
                & \multicolumn{1}{c}{\textbf{45}}
\end{tabular}
    \end{document}

在此处输入图片描述

然而,在我看来,如果省略垂直线并采用水平使用规则,表格会看起来更美观booktabs

\documentclass[12pt]{article}
    \usepackage[a4paper,margin=1 in]{geometry}
    \usepackage[utf8]{inputenc}
    \usepackage[misc]{ifsym}
    \usepackage{amsmath,amssymb}

    \usepackage{booktabs}

\newcount\tallycount
\newcommand{\dotally}{%
    \loop\ifnum\tallycount>4\relax\StrokeFive\  
         \advance\tallycount by-5%
    \repeat%
    \ifcase \tallycount\or\StrokeOne\or\StrokeTwo\or\StrokeThree%\or\StrokeFour
    \else   ERROR
    \fi%
    \unskip}
\newcommand{\tally}{\afterassignment\dotally\tallycount }

    \begin{document}   
\renewcommand{\arraystretch}{1.2}
    \begin{tabular}{ccc}
    \toprule
\textbf{x}      & \textbf{Tally Marks}
                                & \textbf{y}    \\  
    \midrule
A               &   \tally 8    & $8$           \\
B               &   \tally 14   & $14$          \\
AB              &   \tally 13   & $13$          \\
O               &   \tally 15   & $15$          \\
    \bottomrule
\multicolumn{1}{c}{\textbf{Total}}
                & \multicolumn{1}{c}{}
                & \multicolumn{1}{c}{\textbf{50}}
\end{tabular}
    \end{document}

这里我将“O”行从 10 改为 15,以显示三个带笔划的组。编译过程没有错误,并给出以下结果:

在此处输入图片描述

相关内容