Minipage 格式不正确

Minipage 格式不正确

我需要帮助。为什么Block B打印在下面Block A?我需要正确打印Block A

\documentclass[10pt]{article} % Font size - 10pt, 11pt or 12pt.

\usepackage[hmargin=1.25cm, vmargin=1.5cm]{geometry} % Document margins.

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rfoot{{\sffamily Last update: \today}}

\renewcommand{\headrulewidth}{0pt} % Get rid of the default rule in the header.

\begin{document}

\begin{minipage}[t]{0.5\textwidth} % Start the left-hand side of the page.
\vspace{0pt} % Trick for alignment.
Block A.
\end{minipage} % End the left-hand side of the page.

\hfill % ----------------------------------------------------------------------

\begin{minipage}[t]{0.44\textwidth} % Start the right-hand side of the page.
\vspace{0pt} % Trick for alignment.
Block B.
\end{minipage} % End right-hand side of the page.

\end{document}

答案1

\documentclass[10pt]{article} % Font size - 10pt, 11pt or 12pt.

\usepackage[hmargin=1.25cm, vmargin=1.5cm]{geometry} % Document margins.

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rfoot{{\sffamily Last update: \today}}

\renewcommand{\headrulewidth}{0pt}% Get rid of the default rule in the header.

\begin{document}

\noindent
\begin{minipage}[t]{0.5\textwidth}% Start the left-hand side of the page.
Block A.
\end{minipage}% End the left-hand side of the page
\hfill % ----------------------------------------------------------------------
\begin{minipage}[t]{0.44\textwidth}% Start the right-hand side of the page.
Block B.
\end{minipage}% End right-hand side of the page.

\end{document}

我已移动您之前的空格,%因为这些空格会在输出中产生不需要的空白,我删除了小页面之间的段落分隔符,并删除了vspace阻止小页面在其第一行基线对齐的“技巧”。

相关内容