我是 LaTeX 的新手,我正在使用它编写如下问卷:
我当前的代码如下:
\begin{enumerate}
\item
Statement one.
\begin{tabular}{c c c c c c c}
\square & \square & \square & \square
& \square & \square & \square \\
Strongly agree & Moderately agree & Slightly agree &
Neither agree or disagree & Slightly disagree & Moderately disagree & Strongly disagree
\end{tabular}
\end{enumerate}
我收到此错误:
请告诉我我的代码有什么问题?
答案1
\square
是数学模式构造,需要数学分隔符,如$\square$
。由于 的每个字段tabular
在逻辑上与其他字段分开,因此必须为包含 的每个单元格添加数学模式\square
。我还添加了一个空白行,以在一行上形成答案选项。
对于圆圈,只需替换\square
为\bigcirc
。
如果全部的单元格tabular
处于数学模式,人们可能更愿意使用array
而不是tabular
,它本质上是 的数学模式版本tabular
。
\documentclass{article}
\usepackage[landscape,margin=1cm,]{geometry}
\usepackage{amssymb}
\begin{document}
\begin{enumerate}
\item
Statement one.
\begin{tabular}{c c c c c c c}
$\bigcirc$ & $\bigcirc$ & $\bigcirc$ & $\bigcirc$
& $\bigcirc$ & $\bigcirc$ & $\bigcirc$ \\
Strongly agree & Moderately agree & Slightly agree &
Neither agree or disagree & Slightly disagree & Moderately disagree & Strongly disagree
\end{tabular}
\end{enumerate}
\end{document}
答案2
如果您想避免重复输入的繁琐工作$...$
,您可以使用\Square
或\Circle
命令wasysym
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{wasysym}
\usepackage{array}
\begin{document}
\begin{enumerate}
\item Statement one.
\begin{tabular}[t]{c c c}
\Square & \Square & \Square \\
Strongly agree & Moderately agree & Slightly agree \\[2ex]
\bfseries\Circle \\
Neither agree or disagree \\[2ex]
\Square & \Square & \Square \\
Slightly disagree & Moderately disagree & Strongly disagree
\end{tabular}
\end{enumerate}
\end{document}