如何在 minipages 中设置本地页码

如何在 minipages 中设置本地页码

今天过得真好!如何在 minipages 中设置页码?请看代码:

\documentclass[11 pt]{extarticle}
\usepackage[a4paper, top=1 cm, bottom=1.5 cm, left=1cm, right=1cm]{geometry}

\begin{document}

\subsection*{(B)}
Blah,blah,blah.
\vskip 0.2 cm
\fbox{
\begin{minipage}{.45\textwidth}
\subsubsection*{First step.}
Some text1.
\vskip 5 mm
%\includegraphics[scale=0.4]{Q5b1.png}
\end{minipage} 
}
%--
\hskip 0.5 cm
\fbox{
\begin{minipage}{.45\textwidth}
\subsubsection*{Second step.}
Some text 2. 
\vskip 3 mm
%\includegraphics[scale=0.4]{Q5b2.png}
\end{minipage} 
}

\vskip 0.5 cm
\fbox{
\begin{minipage}{.45\textwidth}
\subsubsection*{Third step.}
Some text3. 
\vskip 3 mm
%\includegraphics[scale=0.4]{Q5b3.png}
\end{minipage} 
}

\end{document}

答案1

这可能是一种可行的方法或良好的起点。当然,很多细节可以根据您的实际需求进行改进,而这些需求无法从您的原始问题中确定。以下是结果...

输出

在此处输入图片描述 代码

代码是完全自我解释的。事实上,我引入了宏\MNP(让人想起 minipage)来为您完成这项工作。第一个参数是块标题,第二个参数是描述。请注意,第二个参数以 分隔\endMNP

\documentclass[11pt]{extarticle}
\usepackage{geometry}
    \geometry{%
        a4paper,
        top=1cm,
        bottom=1.5cm,
        left=1cm,
        right=1cm
        }

\usepackage{mwe}


\newcounter{pg}
\setcounter{pg}{1}


\long\def\MNP#1#2\endMNP{%
    \fbox{%
        \begin{minipage}[t]{.47\textwidth}
        \subsubsection*{#1}
        \parskip.3em
        #2
        \smallskip\par
        \hfill{\footnotesize\bfseries\thepg}
        \addtocounter{pg}{1}%
        \end{minipage}}\hfill}



\begin{document}
\parindent0pt


\subsection*{(B)}
Blah, blah, blah.
\bigskip


%-------------------------
\MNP{Title of this block}
    Some very interesting description.

    Further notes to the previous description involved inside this block.
    Further notes to the previous description involved inside this block.
\endMNP
%-------------------------
% no empty line
%-------------------------
\MNP{First step.}
    Some text1.
    \medskip\par
    {\centering
    \includegraphics[scale=0.2]{example-image-a}\par}
    Some description
    Some description
    Some description
    Some description
\endMNP
%-------------------------



\vskip1cm



%-------------------------
\MNP{Second step.}
    Some text1.
    \vskip5mm
    \centering
    \includegraphics[scale=0.4]{example-image-b}\par
\endMNP
%-------------------------
\MNP{Another title.}
    Some text.
    \vskip5mm
    \centering
    \includegraphics[scale=0.2]{example-image-c}\hfil
    \includegraphics[scale=0.2]{example-image}\par
\endMNP
%-------------------------
\end{document}

相关内容