# draw a rectangle with a solid dot in each corner

I want to draw a rectangle with a solid dot in each corner. How can I do this?

-
Hi and welcome to TeX.sx. In its current form, your question might not receive many answers. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the add comment function. – Marco Daniel Apr 9 '12 at 12:00
Yes, please clarify. What I posted, it told me initially that my question was not up to standards. – Harold Rosenberger Apr 9 '12 at 12:04
Do you use tikz or pstricks? – Marco Daniel Apr 9 '12 at 12:06

This is to give a variant from Marco's answer, concerning the Tikz part of his answer. It looks more like the pstricks answer and does not require that you enter the coordinates twice.

The code is

\documentclass[border=5pt]{standalone}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\draw plot[mark=*,mark size = 1pt,mark options={color=red}] coordinates {(0,0)(1,0)(1,1)(0,1)} -- cycle;

\end{tikzpicture}
\end{document}


plot will give straight lines segments if you don't ask for a smooth plot from coordinates.

The result is

-

To draw inside LaTeX you can use the package tikz or pstricks. Both packages have their drawbacks and benefits.

### PSTricks:

Compile the following example with xelatex or latex-ps-pdf

\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(0,0)(4,4)
\psline[showpoints=true](1,1)(3,1)(3,3)(1,3)(1,1)
\end{pspicture}
\end{document}


You get the result:

### TikZ

Compile with pdflatex:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (0,0) rectangle (4,4);
\draw (1,1) rectangle(3,3);
\foreach \x/\y in {1/1,3/1,3/3,1/3}
\fill (\x,\y) circle (2pt);
\end{tikzpicture}
\end{document}


You get:

-
\documentclass{scrartcl}
\usepackage{tikz}
\begin{document}

coordinate [pos=0] (#1sw)
coordinate [pos=1] (#1ne)
(#1sw |- #1ne)  coordinate (#1nw)
(#1sw -| #1ne)  coordinate (#1se)
}}}

\tikzset{pt/.style={circle,fill=#1,inner sep=0mm,minimum size=4pt}}

\begin{tikzpicture}
\draw (0,0) rectangle (4,4) [add reference=R];
\foreach \c in {sw,se,nw,ne}{ \path  (R\c) coordinate[pt=red] ;}
\end{tikzpicture}
\end{document}


-