6

To try to learn the picture environment, I decided to experiment with the placement of points on the page to see if I could really tell \LaTeX where to put stuff. What I found was that I can put stuff in correct relation to other stuff, but not in absolute positions on the page without nudging it to the correct location.

For example, the following code, which is intended to place a point at the upper left-hand corner of the page, does not:

\documentclass{article}
\usepackage[margin=0pt]{geometry}
\begin{document}
\setlength{\unitlength}{1cm}

\begin{picture}(0,0)
\put(0,0){\circle{1}}
\end{picture}

\end{document}

Instead, through some trial and error, I can basically get it to the upper left-hand corner with the following input:

\documentclass{article}
\usepackage[margin=0pt]{geometry}
\begin{document}
\setlength{\unitlength}{1cm}

\begin{picture}(0,0)
\put(-.53,.34){\circle{1}}
\end{picture}

\end{document}

Is there an extra .53cm hidden somewhere in the horizontal direction, and .34cm in the vertical, or maybe some padding on whatever box is created for the picture environment?

How can I place a point exactly where I want it on a page?

I would like to do this without the use of non-standard packages; in other words, I'd like to understand "primitives" well enough to create a solution to this problem. I'm new to \LaTeX, but not to programming in general.

Thanks.

8
  • 1
    Just in case you're interested: pst-abspos, a pstricks extension, can place objects at absolute positions on the page, using PostScript. – Bernard Sep 18 '15 at 20:23
  • What is a non-standard package? Why is geometry apparently standard? – cfr Sep 18 '15 at 22:10
  • @cfr I would not consider geometry to be standard. Please provide any definitions that you think would be helpful. – jpf Sep 19 '15 at 1:32
  • What I mean is that you are using geometry but asking for no non-standard packages. That suggests you either think geometry is standard or also want a solution which does away with that package (but you don't say this). – cfr Sep 19 '15 at 1:51
  • @cfr I'm a newbie at \LaTeX so I used the geometry package only because I'm not aware of another or easier way to set the margin to zero. Assuming the way I've used the non-standard geometry package to set the margin to zero is functionally correct (it sets the margin to zero), the problem remains (i.e. regardless of the way in which I've set the margin to zero). Please share if you know the way to set the margin to zero with only "primitives," or if the geometry package does not do this correctly. – jpf Sep 19 '15 at 2:03
1

You're telling that the picture takes no space; moreover you're placing the center of the circle in the wrong place and you're forgetting about the indentation.

\documentclass{article}
\usepackage[margin=0pt]{geometry}

\begin{document}

\setlength{\unitlength}{1cm}

\noindent
\begin{picture}(1,1)
\put(0.5,0.5){\circle{1}}
\end{picture}

\end{document}

Note that no glue is inserted from \topskip, because the picture height is larger than its value.

enter image description here

3
  • I appreciate the note about the indentation. Using your example, however, if I try \put(0,0){\circle{1}} it doesn't place the circle at (0,0). Have you tried \put(.5,.5){\circle{1}}\put(.5,.5){\circle*{1}}? Why is the solid circle smaller than the other? – jpf Sep 19 '15 at 1:20
  • The \noindent is important here. – jpf Sep 19 '15 at 2:16
  • @jpf Circles are available only at discrete sizes and LaTeX uses the largest one that doesn't go beyond the stated diameter; there are less filled circle than hollow ones. If you load pict2e, you get circles with “true” diameter, both hollow and filled. – egreg Sep 19 '15 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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