如何在 Tikzpicture 中的 Minipage 环境中对齐文本

如何在 Tikzpicture 中的 Minipage 环境中对齐文本

考虑以下代码---

\documentclass{book}
\usepackage{tikz}
\usepackage{mwe}
\begin{document}
\thispagestyle{empty}
\begin{center} 
\begin{tikzpicture}
\node[preaction={fill=black,opacity=1.7,transform canvas={xshift=1.25mm,yshift=-1.5mm}},
draw,
fill=brown,text width=.95\linewidth, inner sep=5mm]
{{ 
\includegraphics[]{example-image}
\vspace{-75pt}
\begin{center}
\begin{minipage}{.91\linewidth}
\fontsize{13}{15}
\selectfont \textbf{``People like us who believe in physics know that the distinction between past, present, and future is only a stubbornly persistent illusion.'' \vskip 6pt \hfill \textsl{---A. Einstein}
}
\end{minipage}
\end{center}
}};
\end{tikzpicture}
\end{center}
\end{document}

输出结果如下:

在此处输入图片描述

问题:我怎样才能自动调整此 tikzpicture 中的小页面中的文本?

谢谢。

答案1

您可以\justifyingragged2e包中使用它。

乙

\documentclass{book}
\usepackage{tikz}
\usepackage{mwe}

\usepackage{ragged2e} % added <<<

\begin{document}
    \thispagestyle{empty}
    \begin{center} 
        \begin{tikzpicture}
            \node[preaction={fill=black,opacity=1.7,transform canvas={xshift=1.25mm,yshift=-1.5mm}},
            draw,
            fill=brown,text width=.95\linewidth, inner sep=5mm]
            {{%
                    \includegraphics[]{example-image}
                    \vspace{-75pt}
                    \begin{center}
                        \begin{minipage}{.91\linewidth}
                            \noindent   \justifying \fontsize{13}{15}\selectfont \textbf{``People like us who believe in physics know that the distinction between past, present, and future is only a stubbornly persistent illusion.'' \vskip 6pt \hfill \textsl{---A. Einstein}
                            }
                        \end{minipage}
                    \end{center}
            }};
        \end{tikzpicture}
    \end{center}
\end{document}

相关内容