
次のコードは、LaTeX のテキストと重なる図を生成します。LaTeX はこの図のためのスペースを作成しないようです。誰か助けてくれませんか?
\documentclass[12pt,oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{float}
\usepackage{amsmath}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{qtree, amssymb, amsthm, graphicx,graphics, makeidx,esint,bm,pstricks,pst-node,pst-tree,algorithmic,algorithm}
\makeatother
\begin{document}
\begin{figure}[H]
\begin{align*}
\psmatrix
\cnodeput(0,-4){E}{ e_{n-1} }
\cnodeput(-2,-2){A}{ e_{n-2} }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](2,-2){C}{ e_{n-2}^* }
\cnodeput(-4,0){A1}{e_{n-3}}
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](0,0){A2}{ e_{n-3}^* }
\cnodeput(-6,2){A11}{ \ldots }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](-2,2){A12}{ \ldots }
\psset{nodesep=3pt}
\ncarc{->}{E}{A}
\ncarc{->}{E}{C}
\ncarc{->}{A}{A1}
\ncarc{->}{A}{A2}
\ncarc{->}{A1}{A11}
\ncarc{->}{A1}{A12}
\endpsmatrix
\end{align*}\caption{\label{fig:Selection-of-edges}Selection of edges in Algorithm}
\end{figure}
this is some text in the document
\end{document}
答え1
これは、pspicture 環境は図のフロートにテキストを重ねます
あなたのコードにいくつか変更を加えました。特に、コマンドalign*
とpsmatrix
コマンドを削除し、代わりにpspicture
次のように使用できるコマンドを使用しました。
\begin{pspicture}(xmin,ymin)(xmax,ymax)
このコマンドは、構築中に、、、およびの\psgrid
適切な値を決定するのに役立ちます。xmin
xmax
ymin
ymax
コード
\documentclass{article}
\usepackage{pstricks,pst-node}
\begin{document}
\begin{figure}
\centering
\begin{pspicture}(-7,-5)(3,3)
%\psgrid
\cnodeput(0,-4){E}{ $e_{n-1}$ }
\cnodeput(-2,-2){A}{ $e_{n-2}$ }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](2,-2){C}{ $e_{n-2}^*$ }
\cnodeput(-4,0){A1}{$e_{n-3}$}
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](0,0){A2}{$e_{n-3}^*$}
\cnodeput(-6,2){A11}{ \ldots }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](-2,2){A12}{ \ldots }
\psset{nodesep=3pt}
\ncarc{->}{E}{A}
\ncarc{->}{E}{C}
\ncarc{->}{A}{A1}
\ncarc{->}{A}{A2}
\ncarc{->}{A1}{A11}
\ncarc{->}{A1}{A12}
\end{pspicture}
\caption{\label{fig:Selection-of-edges}Selection of edges in Algorithm}
\end{figure}
this is some text in the document
\end{document}
答え2
ほぼすべてのPSTricksオブジェクトは、デフォルトで上書きできるように幅と高さが0ptになっています。いくらかのスペース(水平方向)を確保する必要があります。そして周囲に他のオブジェクトを配置したい場合は、垂直方向 (ボックス) に配置できます。これは、pspicture
環境または\parbox
または .... スペースを予約するその他のものを使用して、デフォルトで実行されます。例では絶対座標を使用しているため、ボックスを定義せずに使用することはできません。デフォルトを使用する例を次に示します\parbox
( を使用する方pspicture
がよい選択です。cmhughes の回答を参照してください)。
\documentclass[12pt]{book}
\usepackage{pst-node}
\begin{document}
\begin{figure}[!htb]
\centering
\psframebox{\parbox[b][8cm][r]{0.7\linewidth}{%
\rput[rt](0.7\linewidth,5cm){$\psmatrix
\cnodeput(0,-4){E}{ e_{n-1} }
\cnodeput(-2,-2){A}{ e_{n-2} }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](2,-2){C}{ e_{n-2}^* }
\cnodeput(-4,0){A1}{e_{n-3}}
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](0,0){A2}{ e_{n-3}^* }
\cnodeput(-6,2){A11}{ \ldots }
\cnodeput[fillstyle=crosshatch,hatchsep=6pt](-2,2){A12}{ \ldots }
\psset{nodesep=3pt}
\ncarc{->}{E}{A}
\ncarc{->}{E}{C}
\ncarc{->}{A}{A1}
\ncarc{->}{A}{A2}
\ncarc{->}{A1}{A11}
\ncarc{->}{A1}{A12}
\endpsmatrix$}}}
\caption{\label{fig:Selection-of-edges}Selection of edges in Algorithm}
\end{figure}
this is some text in the document
\end{document}