Graphics, Figures & Tablespst-node/pstricks object inside equation environment?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
deniss
Posts: 11
Joined: Tue Aug 04, 2009 9:06 pm

pst-node/pstricks object inside equation environment?

Post by deniss »

I need to typeset a few cluster diagrams (statistical mechanics) and planning to use the handy pst-node in pstricks to do that. Basically, it's some circles and connecting lines.

However, I wanted to display the diagram(s) inside an equation environment. Is it possible to contain the pspicture environment inside equation environment, perhaps by using \mbox? Is it possible to issue pstricks commands inside an \mbox?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

deniss
Posts: 11
Joined: Tue Aug 04, 2009 9:06 pm

pst-node/pstricks object inside equation environment?

Post by deniss »

Never mind. Yes, it is possible, and here is the code to do it:

Code: Select all

\begin{equation}
\makebox[3.2cm][l]{\rule[-1.366cm]{0cm}{2.732cm}\Cnode[radius=0.5cm](0.5,-0.866){A}\rput(0.5,-0.866){a}
\Cnode[radius=0.5cm](2.5,-0.866){B}\rput(2.5,-0.866){b}
\Cnode[radius=0.5cm](1.5,0.866){C}\rput(1.5,0.866){c}
\ncline{A}{B}
\ncline{A}{C}
\ncline{B}{C}}
\end{equation}
cluster_example.png
cluster_example.png (6.49 KiB) Viewed 1862 times
The \rule command was used to create an invisible strut and stretch the box vertically over the image, since nodes themselves do not take up any space. This way, proper amount of vertical space is allotted to the equation so that it does not affect surrounding text.
Post Reply