
El siguiente código produce una figura que se superpone con mi texto en LaTeX. Parece como si el látex no creara espacio para esta figura. ¿Alguien puede ayudarme con eso?
\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}
Respuesta1
Esto parece muy similar al problema enEl entorno pspicture superpone texto en la figura flotante.
Hice algunos cambios en su código; en particular, eliminé los comandos align*
y psmatrix
y en su lugar usé un pspicture
que puede usarse como
\begin{pspicture}(xmin,ymin)(xmax,ymax)
El \psgrid
comando es útil durante la construcción para determinar los valores apropiados de xmin
, xmax
, ymin
y ymax
.
Código
\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}
Respuesta2
Casi todos los objetos de PSTricks tienen un ancho y alto de 0 puntos para permitir la sobrescritura de forma predeterminada. Tienes que reservar algo de espacio (horizontalmenteyverticalmente - un cuadro) si desea colocar otros objetos alrededor de él. Esto se hace de forma predeterminada utilizando el pspicture
entorno o un \parbox
o... cualquier otra cosa que reserve espacio. Está utilizando coordenadas absolutas en su ejemplo, razón por la cual no puede usarlas sin definir un cuadro. Aquí hay un ejemplo que usa un valor predeterminado \parbox
(usar a pspicture
es la mejor opción; ¡consulte la respuesta de 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}