
다음 코드는 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 환경은 Figure float의 텍스트를 오버레이합니다.
귀하의 코드를 몇 가지 변경했습니다. 특히 align*
및 psmatrix
명령을 제거하고 대신 다음 pspicture
과 같이 사용할 수 있는 a를 사용했습니다.
\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
( a를 사용하는 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}