シャドーボックス内にミニページを並べて 2 つのボックスを中央に配置する方法

シャドーボックス内にミニページを並べて 2 つのボックスを中央に配置する方法

高さの異なる2つのボックスがminipage並んでおり\fbox、それらは互いに中央に配置されています。

\documentclass{article}
\usepackage{fancybox}
\begin{document}
\noindent
\makebox[\textwidth]{%
\parbox{1.2\textwidth}{%
\setlength{\fboxsep}{10pt}%
\fbox{%
\begin{minipage}[c]{.53\textwidth}
text\\[8pt]
text\\[8pt]
text
\end{minipage}}%
\hfill
\fbox{%
\begin{minipage}[c]{.53\textwidth}
text \hrulefill\\
text \hrulefill\\
text \hrulefill
\end{minipage}}}}
\end{document}

しかし、私がminipage内部で使用した場合、それらは中央に配置されません\shadowbox

\documentclass{article}
\usepackage{fancybox}
\begin{document}
\noindent
\makebox[\textwidth]{%
\parbox{1.2\textwidth}{%
\setlength{\fboxsep}{10pt}%
\shadowbox{%
\begin{minipage}[c]{.53\textwidth}
text\\[8pt]
text\\[8pt]
text
\end{minipage}}%
\hfill
\shadowbox{%
\begin{minipage}[c]{.53\textwidth}
text \hrulefill\\
text \hrulefill\\
text \hrulefill
\end{minipage}}}}
\end{document}

ミニページを中央に配置するにはどうすればいいでしょうか\shadowbox?

答え1

を使ってボックスを中央に戻すことができます\raisebox。また、テキストがボックスがいっぱいすぎると警告していたので、影のためのスペースを残すために幅を少し狭めました。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{fancybox}
\begin{document}

\noindent
\makebox[\textwidth]{%
\parbox{1.2\textwidth}{%
\setlength{\fboxsep}{10pt}%
\fbox{%
\begin{minipage}[c]{.53\textwidth}
text\\[8pt]
text\\[8pt]
text
\end{minipage}}%
\hfill
\fbox{%
\begin{minipage}[c]{.53\textwidth}
text \hrulefill\\
text \hrulefill\\
text \hrulefill
\end{minipage}}}}

\bigskip

\noindent
\makebox[\textwidth]{%
\parbox{1.2\textwidth}{%
\setlength{\fboxsep}{10pt}%
\raisebox{-.5\totalheight}{\shadowbox{%
\begin{minipage}[c]{.52\textwidth}
text\\[8pt]
text\\[8pt]
text
\end{minipage}}}%
\hfill
\raisebox{-.5\totalheight}{\shadowbox{%
\begin{minipage}[c]{.52\textwidth}
text \hrulefill\\
text \hrulefill\\
text \hrulefill
\end{minipage}}}}}
\end{document}

答え2

また、adjustbox任意の垂直方向の配置を簡単に取得できるパッケージ:

ここに画像の説明を入力してください

コード:

\documentclass{article}
\usepackage{fancybox}
\usepackage{adjustbox}

\begin{document}

\noindent
\makebox[\textwidth]{%
\parbox{1.2\textwidth}{%
\setlength{\fboxsep}{10pt}%
\adjustbox{valign=c}{\shadowbox{%
\begin{minipage}[c]{.52\textwidth}
text\\[8pt]
text\\[8pt]
text
\end{minipage}}}%
\hfill
\adjustbox{valign=c}{\shadowbox{%
\begin{minipage}[c]{.52\textwidth}
text \hrulefill\\
text \hrulefill\\
text \hrulefill
\end{minipage}}}}}
\end{document}

関連情報