\Minipage 无法正常工作以及如何有效地使用它?

\Minipage 无法正常工作以及如何有效地使用它?

创建一份试卷,只需要一些关于如何暗示的想法问题2在问题下方平行出现类似分成两半的内容 [附图供参考],并非每个问题的提示都有两列 [例如:问题 1],每个问题的提示都是独一无二的。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{ragged2e}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{geometry}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{multirow,multirow}
\usepackage{tikz}

\title{Stack Exchange Questions}
\author{karthi }
\date{March 2022}

\begin{document}


%-----------------------------------------------------------
%                        QUESTION ID
%-----------------------------------------------------------
\newcommand{\questionID}[2]{
    \vspace{2.5mm}
    \begin{center}
\begin{raggedright}
\textbf{\underline{{Question: #1}}}\hfill\textit{Mark: #2}\\
\end{raggedright}
    \end{center}}



%-----------------------------------------------------------
%                        HINT
%-----------------------------------------------------------
\newcommand{\hints}[1]{
    \vspace{2.5mm}
    \begin{raggedright}
    \textbf{Hint:}\\
    #1\\
    \end{raggedright}
    \rule{\textwidth}{0.15}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%                                   QUESTION NUMBER :  [1]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------------------------------------------------------------------------
%                                  TAGS
%---------------------------------------------------------------------------
%start-of-the-question
\questionID{1}{}%#

%---------------------------------------------------------------------------
%                                  QUESTION
%---------------------------------------------------------------------------
\question
{
What is the area of this rectangle ?

\tikzset{every picture/.style={line width=0.75pt}}
\centering
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw   (46,58) -- (203.8,58) -- (203.8,129) -- (46,129) -- cycle ;
\draw (106,139) node [anchor=north west][inner sep=0.75pt]   [align=left] {13 cm};
\draw (105,34) node [anchor=north west][inner sep=0.75pt]   [align=left] {13 cm};
\draw (213,83) node [anchor=north west][inner sep=0.75pt]   [align=left] {2 cm};
\draw (6,84) node [anchor=north west][inner sep=0.75pt]   [align=left] {2 cm};
\end{tikzpicture}
}%#

%---------------------------------------------------------------------------
%                                  HINT
%---------------------------------------------------------------------------

\hints{{
\begin{align*}
 \text{Length of the rectangle}  &= \rule{146}{0.5}\\
 \text{Breadth of the rectangle}  &= \rule{146}{0.5}\\
 \text{Area of the rectangle}  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  \text{Area of the rectangle}  &= \rule{146}{0.5} \hspace{1mm} cm^{2} \\
\end{align*}
}}%# 

%end-of-the-question
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%                                   QUESTION NUMBER :  [2]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------------------------------------------------------------------------
%                                  TAGS
%---------------------------------------------------------------------------
%start-of-the-question
\questionID{2}{}%#

%---------------------------------------------------------------------------
%                                  QUESTION
%---------------------------------------------------------------------------
\question
{Which of the following rectangle has an area equivalent to usepackage sq. m.
\smallskip

\tikzset{every picture/.style={line width=0.75pt}}

\centering

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw   (100,122) -- (233.8,122) -- (233.8,191) -- (100,191) -- cycle ;
\draw   (324,120) -- (457.8,120) -- (457.8,189) -- (324,189) -- cycle ;
\draw (50,152) node [anchor=north west][inner sep=0.75pt]   [align=left] {12 cm};

\draw (141,198) node [anchor=north west][inner sep=0.75pt]   [align=left] {24 cm};

\draw (275,148) node [anchor=north west][inner sep=0.75pt]   [align=left] {14 cm};

\draw (383,198) node [anchor=north west][inner sep=0.75pt]   [align=left] {20 cm};

\draw (68,100) node [anchor=north west][inner sep=0.75pt]   [align=left] {i.};

\draw (296,99) node [anchor=north west][inner sep=0.75pt]   [align=left] {ii.};


\end{tikzpicture}


}%#

%---------------------------------------------------------------------------
%                                  HINT
%---------------------------------------------------------------------------


\hints{
\begin{minipage}{0.4\linewidth}
{i. 
\begin{align*}
 \text{Length of the rectangle}  &= \rule{146}{0.5}\\
 \text{Breadth of the rectangle}  &= \rule{146}{0.5}\\
 \text{Area of the rectangle}  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  \text{Area of the rectangle}  &= \rule{146}{0.5} \hspace{1mm} (=/\neq) \text{ 170 sq. m} \\
\end{align*}}
\end{minipage}
\begin{minipage}{0.4\linewidth}
{ii. 
\begin{align*}
 \text{Length of the rectangle}  &= \rule{146}{0.5}\\
 \text{Breadth of the rectangle}  &= \rule{146}{0.5}\\
 \text{Area of the rectangle}  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  &= \rule{50}{0.5}\hspace{5mm} \text{x} \hspace{5mm} \rule{50}{0.5}\\
  \text{Area of the rectangle}  &= \rule{146}{0.5} \hspace{1mm} (=/\neq) \text{ 170 sq. m} \\
\end{align*}}
\end{minipage}

}%# 



%end-of-the-question
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

提示拆分

笔记: 我是 LaTeX 的新手,我计划在 Latex 中创建更多问题,如果您能为我当前的设计提出更好的布局建议,我将不胜感激,很高兴学习。

答案1

正确的语法minipage

\begin{minipage}[justification]{width}并以 结束\end{minipage}

对齐选项包括c水平居中、t顶部(水平对齐)和b底部(水平对齐)。

在宽度中您可以直接写下以厘米或英寸为单位的测量值;甚至使用\textwidth

例如,对于一个垂直居中、宽度为 5 厘米的小页面,您必须键入 \begin{minipage}[c]{5cm}并以 结尾\end{minipage}

如果您想使用该\textwidth选项,您可以输入\begin{minipage}[c]{0.5\textwidth}并用 关闭它\end{minipage}

祝您发短信愉快。

相关内容