3

In the code

\begin{picture}(250,75)
% draw triangle
\put(15,10){\line(1,0){50}}
\put(65,10){\line(0,1){50}}
\put(65,60){\line(-1,-1){50}}
% draw square
\put(100,10){\line(1,0){50}}
\put(150,10){\line(0,1){50}}
\put(150,60){\line(-1,0){50}}
\put(100,60){\line(0,-1){50}}
% draw circle
\put(200,35){\circle{40}}
\end{picture}

What does (250,75) mean? It is said to be the space area of 250 times 75 units on the page to put the picture in. But if I change these values to (10,150) then how come figures still show up after 10 units on x axis, as Ii only allowed 10 times 150 area on paper and figures should not show up after 10 units on X axis.

4

The notation (x,y) (with numbers in place of *x$ and y) means a coordinate; in this case the coordinate of the upper right corner of the bounding box, expressed in multiples of \unitlength. The lower left corner is (0,0). All coordinates in the picture environment are considered in the same fashion.

This means that your picture will be considered to have a width of 250\unitlength and a height of 75\unitlength. The default value of \unitlength is 1pt, but it can be changed with \setlength.

Note that objects in the picture that fall outside the stated bounding box will be drawn nonetheless and will overlap the text next to the picture, so it's your responsibility to properly set the bounding box.

\documentclass{article}

\begin{document}

\rule{250pt}{1pt}

\medskip

\begin{picture}(250,75)
% draw triangle
\put(15,10){\line(1,0){50}}
\put(65,10){\line(0,1){50}}
\put(65,60){\line(-1,-1){50}}
% draw square
\put(100,10){\line(1,0){50}}
\put(150,10){\line(0,1){50}}
\put(150,60){\line(-1,0){50}}
\put(100,60){\line(0,-1){50}}
% draw circle
\put(200,35){\circle{40}}
% draw the bounding box
\put(0,0){\line(1,0){250}}
\put(250,0){\line(0,1){75}}
\put(250,75){\line(-1,0){250}}
\put(0,75){\line(0,-1){75}}
\end{picture}

\medskip

\setlength{\unitlength}{0.5pt}
\begin{picture}(250,75)
% draw triangle
\put(15,10){\line(1,0){50}}
\put(65,10){\line(0,1){50}}
\put(65,60){\line(-1,-1){50}}
% draw square
\put(100,10){\line(1,0){50}}
\put(150,10){\line(0,1){50}}
\put(150,60){\line(-1,0){50}}
\put(100,60){\line(0,-1){50}}
% draw circle
\put(200,35){\circle{40}}
% draw the bounding box
\put(0,0){\line(1,0){250}}
\put(250,0){\line(0,1){75}}
\put(250,75){\line(-1,0){250}}
\put(0,75){\line(0,-1){75}}
\end{picture}

\end{document}

enter image description here

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.