我想将 放在\parbox
由 绘制的图形中pstricks
。pspicture
环境位于 环境内部figure
。例如:
\documentclass[singlecolumn, nofootinbib, notitlepage]{revtex4-1}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pstricks}
\usepackage{pst-solides3d}
\usepackage{pst-poly}
\begin{document}
\begin{figure}[htb]
\begin{pspicture}[showgrid=true](-3,-3)(3,3)
\rput[tl](-2, 2){\parbox{4cm}{I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. }}
\end{pspicture}
\label{some label}
\end{figure}
\end{document}
由于某种原因\parbox
,不是对齐,就像在 a 中一样\parbox
,但它居中。但是,如果我不将pspicture
环境放在 afigure
环境中,那么\parbox
是合理的,如下例所示:
\documentclass[singlecolumn, nofootinbib, notitlepage]{revtex4-1}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pstricks}
\usepackage{pst-solides3d}
\usepackage{pst-poly}
\begin{document}
\begin{pspicture}[showgrid=true](-3,-3)(3,3)
\rput[tl](-2, 2){\parbox{4cm}{I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. I want this text to be justified. }}
\end{pspicture}
\end{document}
我怎样才能将对齐的文本放入环境pspicture
内的figure
?换句话说,我该如何修改第一个例子,使文本对齐\parbox
(而不是居中)?如果有其他可行的替代方案\parbox
(即在这种情况下对齐),我也可以接受。
答案1
在肠道深处revtex4-1
它实际上附加\centering
到\@parboxrestore
浮点数的开头:
\appdef\@xfloat@prep{%
\appdef\@parboxrestore{\centering}%
}%
\@xfloat@prep
是一个调用的宏,用于为浮动环境准备一些预设。
这意味着\parbox
浮点型中的所有构造都将以 发出\centering
。避免这种情况的最快方法是\let\centering\relax
在使用 之前发出\parbox
:
\documentclass{revtex4-1}% http://ctan.org/pkg/revtex4-1
\usepackage{pstricks}% http://tug.org/PSTricks/main.cgi/
\begin{document}
\begin{figure}[htb]
\begin{pspicture}[showgrid=true](-3,-3)(3,3)
\rput[tl](-2, 2){\let\centering\relax\parbox{4cm}{I want this text to be justified.
I want this text to be justified. I want this text to be justified. I want this
text to be justified. I want this text to be justified. I want this text to be justified. }}
\end{pspicture}
\label{some label}
\end{figure}
\end{document}
为了采取更全球化的方法,只需\@xfloat@prep
在序言中重新定义:
\makeatletter
\def\@xfloat@prep{%
\ltx@footnote@pop
\def\@mpfn{mpfootnote}%
\def\thempfn{\thempfootnote}%
\c@mpfootnote\z@
\let\H@@footnotetext\H@@mpfootnotetext
}%
\makeatother
答案2
使用表格而不是\parbox
\rput[tl](-2, 2){\tabular{p{4cm}}I want this text to be justified.
I want this text to be justified. I want this text to be justified. I want this
text to be justified. I want this text to be justified. I want this text to be
justified.
\endtabular}