# Creating a rhombus in LaTeX

I want to build an E/R diagram in LaTeX such that there should be rhombus for representing the relations and squares for representing the entity sets. I dont want to import graphics in LaTeX i.e. import the graphics after drawing it in some other image drawing software but want to do it in LaTeX itself.Could someone suggest me some good links to read from??

-
I would highly recommend tikz. Here are a few questions on this site that might be useful: neural-network-representation, produce-the-following-exact-hexagon, connect-tikz-nodes-running-around-nodes – Peter Grill Jan 16 '12 at 6:24
I have used the tikz-er2 library for drawing the E/R diagram but i want to draw the referential integrity i.e and a line followed by a closing bracket to represent referential integrity How could i do that in tikz-er2? – noddy Jan 16 '12 at 8:43

You can do this easily with TikZ.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes}

\colorlet{relation@colour}[rgb]{blue}
\colorlet{entity@colour}[rgb]{red}

\tikzset{relation/.style={%
shape=diamond,draw=relation@colour!50!gray,
ultra thick,fill=relation@colour!25!white,
minimum height=2em},
entity/.style={%
shape=rectangle,draw=entity@colour!50!gray,
ultra thick,fill=entity@colour!25!white,
minimum height=2em}}

\begin{document}

\begin{tikzpicture}
\draw (0,0) node(tikz) [entity] {TikZ}
(tikz.east) + (1,0)
node(draws)[relation,anchor=west] {draws}
(draws.east) + (1,0)
node(er diagrams)[entity,anchor=west] {\textsc{er} diagrams}
(tikz) -- (draws)
(draws) -- (er diagrams);
\end{tikzpicture}

\end{document}


.

As a matter of fact, TikZ also provides an er library. The following shows how to use it.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{er}

\begin{document}

\begin{tikzpicture}
\draw (0,0) node(tikz) [entity] {TikZ}
(tikz.east) + (1,0)
node(draws)[relationship,anchor=west] {draws}
(draws.east) + (1,0)
node(er diagrams)[entity,anchor=west] {\textsc{er} diagrams}
(tikz) -- (draws)
(draws) -- (er diagrams);
\end{tikzpicture}

\end{document}

-

A simple example, run it with xelatex or latex->dvips->ps2pdf

\documentclass{article}
\usepackage{pst-node,pst-dbicons}
\begin{document}