迷你頁面與文字方塊的高度不同

迷你頁面與文字方塊的高度不同

使用時minipage,第二列中有一個文字方塊。當我在第二列中使用時fbox,第一列的文字會向下移動,因此兩側的高度不會保持相同。這是代碼;

\begin{minipage}[t]{0.5\textwidth}
\textbf{Items:}
\begin{itemize}
\item Item1
\item Item2
\item Item3
\item Item3
\end{itemize}
\textcolor{red}{\textbf{Def:}} Cumulative distribution function (cdf ): is the probability that the variable takes a value less than or equal to X.

    \textbf{Items:}
    \begin{itemize}
    \item Item1 
    \item Item1
    \item Item1
    \item Item1
    \end{itemize}
    \textcolor{red}{\textbf{Def:}}  TCumulative distribution function (cdf ): is the probability that the variable takes a value less than or equa l to X.
    \end{minipage}
    %second column
    \begin{minipage}[t]{0.5\textwidth}
    \fbox{%
      \parbox{\textwidth}{%
        \begin{center}
          Useful mnemonics:
          \begin{itemize}
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \end{itemize}
        \end{center}
      }%
    }

    \end{minipage}

這段程式碼的輸出是這樣的;
在此輸入影像描述

請告訴我如何排列它們以使兩列(或迷你頁面)保持相同的高度。謝謝你!

答案1

在此輸入影像描述

\begin{minipage}[T]{0.48\textwidth}
\textbf{Items:}
\begin{itemize}
\item Item1
\item Item2
\item Item3
\item Item3
\end{itemize}
\textcolor{red}{\textbf{Def:}} Cumulative distribution function (cdf ): is the probability that the variable takes a value less than or equal to X.

    \textbf{Items:}
    \begin{itemize}
    \item Item1 
    \item Item1
    \item Item1
    \item Item1
    \end{itemize}
    \textcolor{red}{\textbf{Def:}}  TCumulative distribution function (cdf ): is the probability that the variable takes a value less than or equa l to X.
    \end{minipage}
    %second column
    \begin{minipage}[T]{0.48\textwidth}
    \fbox{%
      \parbox{\textwidth}{%
        \centering
          Useful mnemonics:
          \begin{itemize}
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
          \end{itemize}
      }%
    }
    \end{minipage}

使用[T]對齊minipages 的選項,並且不要透過留下 來耗盡所有水平空間0.02\textwidth,例如\begin{minipage}[T]{0.48\textwidth}就可以了。

答案2

這使得\parbox...與兩個minipage環境保持一致,並透過使用 修復壞框\noindent,消除 s 之間的空間minipage並減少 的寬度,\parbox為 的線條和邊距留出空間\fbox

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\noindent
\begin{minipage}[t]{0.5\textwidth}
\textbf{Items:}
\begin{itemize}
  \item Item1
  \item Item2
  \item Item3
  \item Item3
\end{itemize}
\textcolor{red}{\textbf{Def:}} Cumulative distribution function (cdf ): is the probability that the variable takes a value less than or equal to X.

\textbf{Items:}
\begin{itemize}
  \item Item1
  \item Item1
  \item Item1
  \item Item1
\end{itemize}
\textcolor{red}{\textbf{Def:}}  TCumulative distribution function (cdf ): is the probability that the variable takes a value less than or equa l to X.
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
\fbox{%
  \parbox[t]{.95\textwidth}{%
    \begin{center}
      Useful mnemonics:
      \begin{itemize}
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
        \item "OIL RIG -- \textbf{O}xidation \textbf{I}s \textbf{L}oss of electrons, \textbf{R}eduction \textbf{I}s \textbf{G}ain of electrons
      \end{itemize}
    \end{center}
  }%
}%
\end{minipage}
\end{document}

對齊無壞盒

相關內容