引用文を余白の半分に配置する

引用文を余白の半分に配置する

下のテンプレートのように、ドキュメントに引用文を配置したいと思います。 理想的には、簡単に何度も使用できる新しい環境です。 引用文は余白の半分より上に、テキストの重要な事実を強調するために、太字の大きなフォントで配置する必要があります。

これを実現するにはどうしたらよいか、何かアイデアはありますか?

引用はさておき

答え1

wrapfigure環境(から)を使用することができますwrapfigパッケージ)。この環境は、メインテキストを囲むボックスを作成します。このボックスの幅と位置 ( left またはright、および両面ドキュメントの場合はinside またはoutside) を指定できます。さらに、このパッケージには、はみ出し幅の指定がネイティブに含まれています。

\begin{wrapfigure}{<position: l, r, i, or o>}[<overhang width>]{<total width of the wrapfigure>}
    <content of the wraping figure>
\end{wrapfigure}

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

\documentclass{article}
    \usepackage{lipsum}
    \usepackage{wrapfig}
    \usepackage{xcolor}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{r}[.1\textwidth]{.4\textwidth}%
            \textbf{\sffamily\Large\textcolor{blue!50!black}{``Good things might come to those who wait\dots''}}%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}

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


元の回答

このソリューションでは、 のネイティブ オーバーハング オプションの代わりに、parboxの内部でを使用します。したがって、上記の編集で提案されたものよりも大きくなります。wrapfigurewrapfig

このソリューションは環境wrapfigurewrapfigパッケージ)。このパッケージは、テキストが折り返されるフローティング ボックスを定義します。このボックスの幅と位置 (左または右) を指定できます。

\begin{wrapfigure}{<position: R or L>}{<width of the wrapfigure>}
    <content of the wraping figure>
\end{wrapfigure}

このボックスに引用文を記入します。テキストを余白に表示するために、このテキストを別のボックス、a の中に入れますparbox幅が広い環境によって定義されたものよりもwrapfigure:

\parbox{<width of the box>}{<content of the box>}

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


\documentclass{article}
    \usepackage{lipsum}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{xcolor}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{R}{.2\textwidth}%
        \parbox{.4\textwidth}{%
            \textbf{\sffamily\Large\textcolor{blue!50!black}{``Good things might come to those who wait\dots''}}%
        }%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}

明示的なボックスを持つ MWE:

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

\documentclass{article}
    \usepackage{lipsum}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{showframe}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{R}{.2\textwidth}%
        \fbox{\parbox{.3\textwidth}{\textbf{\Large Good things might come to those who wait\dots}}}%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}

関連情報