问题格式类似表格

问题格式类似表格

我正在准备一份文件,里面有一些问题,需要回答?它应该是这样的:(红色标记表示缩进/对齐)

![在此处输入图片描述

我创建了这个,但需要改进。我尝试使用表格,但表格左侧有一些不需要的缩进。我怎样才能正确对齐并制作出精确的图形?

\documentclass{article}

\begin{document}

\noindent Here is the question: The question is long enough in 2/3 sentences with a stem. The stem describes a scenario. 

\noindent Here is the fill in the blank or box for answering. \hfill             Total \fbox{\phantom{text}} types

\noindent The option box or fill in the blank may contain multiple lines but it should be the same length as the previous one. No m-
atter how long the question, length must be the same.  \hfill Total \fbox{\phantom{text}} fruits

\end{document}

答案1

尝试使用[t]op-aligned \parbox

在此处输入图片描述

\documentclass{article}

\begin{document}

\noindent Here is the question: The question is long enough in 2/3 sentences with a stem. The stem 
  describes a scenario. 

\bigskip

\noindent \parbox[t]{.6667\linewidth}{\strut Here is the fill in the blank or box for answering.}
  \hfill
  Total \fbox{\phantom{text}} types

\medskip

\noindent \parbox[t]{.6667\linewidth}{\strut The option box or fill in the blank may contain multiple 
  lines but it should be the same length as the previous one. No matter how long the question, length 
  must be the same.}
  \hfill
  Total \fbox{\phantom{text}} fruits

\end{document}

如果您始终没有段落缩进,那么您不妨\setlength{\parindent}{0pt}放弃使用\noindent

tabular您可以通过以下方式获得类似的结果/输出:

\documentclass{article}

\usepackage{array}

\begin{document}

\noindent Here is the question: The question is long enough in 2/3 sentences with a stem. The stem 
  describes a scenario. 

\bigskip

\noindent
\begin{tabular}{@{} p{.6667\linewidth} @{} >{\raggedleft\arraybackslash} p{.3333\linewidth} @{}}
  Here is the fill in the blank or box for answering. &
  Total \fbox{\phantom{text}} types
  \\[\medskipamount]
  The option box or fill in the blank may contain multiple 
  lines but it should be the same length as the previous one. 
  No matter how long the question, length must be the same. &
  Total \fbox{\phantom{text}} fruits
\end{tabular}

\end{document}

相关内容