![如何在 Tikzpicture 中的 Minipage 环境中对齐文本](https://linux22.com/image/444990/%E5%A6%82%E4%BD%95%E5%9C%A8%20Tikzpicture%20%E4%B8%AD%E7%9A%84%20Minipage%20%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%AF%B9%E9%BD%90%E6%96%87%E6%9C%AC.png)
考虑以下代码---
\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
您可以\justifying
从ragged2e
包中使用它。
\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}