TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was quite impressed by the figures generated by TikZ and wanted to try TikZ to generate a few figures (please see the attached image drawn using an external WYSWYG program). When I tried to reproduce the figures myself using TikZ I found it very difficult to control the shapes in required positions. What is the simplest method to draw!these figures using TikZ?

enter image description here

share|improve this question
Apart from the pgfmanual, I would recommend to look at http://texample.net/ or at the Graphics with TikZ article to begin coding with TikZ. – Clément Jul 15 '14 at 9:26
Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – Jubobs Aug 14 '14 at 12:08
up vote 14 down vote accepted

With next code you can obtain first example. All others can be easily done after reading first tutorial in TiKZ documentation (pgfmanual).

\draw [->] (-1.5,0)--(3,0);
\draw [->] (0,-1.5)--(0,3);
\draw[dashed] (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
\node[below left] at (0,0) {$x$};
\draw[shorten <=-1cm, shorten >=-3mm] (0,1)--(2,0) node [midway, above] {$A$};
\node[above right] at (0,1) {$\hat{x}$};

enter image description here

share|improve this answer
Thanks for the code. I could modify your code to get second and third figures. But still facing problems with the last figure! – Sooraj Jul 15 '14 at 7:34
@Sooraj Try something like \draw[dashed] (-1,0) to[bend right] (0,1); – Torbjørn T. Jul 15 '14 at 7:45
Use this. \draw[dashed] (-1,0) to [bend right] (0,1) to [bend right] (1,0) to [bend right] (0,-1) to [bend right] (-1,0); – Jesse Jul 15 '14 at 7:46
@Jesse: Or, equivalently, \draw[dashed, bend right] (-1,0) to (0,1) to (1,0) to (0,-1) to (-1,0); – Jake Jul 15 '14 at 11:48
@Jake -- Wow, thanks. – Jesse Jul 15 '14 at 15:25

A direct translation from TikZ (with 374 characters) to PSTricks (with 362 characters).



enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.