- Introduction :
What is picture environment ?
- Picture environment is used to represent diagrams using different commands. We put commands using co-ordinates.
- There's nothing to be afraid or confused of anything. LaTeX picture environment is purely based on coordinate geometry.
- To learn picture environment you have to have a basic knowledge on coordinate geometry, then it's just a piece of cake :)
- Basics :-
Before we start to learn Picture environment there are somethings common for any diagram we do
1. \setlength{\unitlength}{1cm}\begin{picture}(20,15)\end{picture}
⨳ We may have to use the above mentioned code before we start any kind of diagram. First get this typed and all the codes comes in between \begin{picture}(20,15) & \end{picture}
⨳ Here you may have observed that we have used 1cm here which is not always mandatory
⨳ The 1 cm denotes the size of the image. To make a larger image we may use larger values like 2cm, 3cm ...
⨳ Similarly After begin picture we may see that we have used the value (20,15)
⨳ It denotes the maximum values that the x & the y coordinate has.
⨳ This too is not mandatory to use only 20,15 always. But this value can be used for a wide range of diagrams and it works properly.
⨳ Always remember that in a bracket we add two numbers (Number 1 , Number 2).
⨳ Here Number 1 will be the x coordinate and Number 2 will be the y coordinate no matter what is the diagram you make .
- \put(,){} command :-
Here we shall learn about the \put command which is widely used in various places on making a diagram
2. \put(point on x-axis , point on y-axis){Your text or Command}
Here ,
⨳ Point on x-axis means it the number of units from point 0 on x-axis & the point on y-axis is the number units from point 0 on y-axis .
Example :-
See the picture given below , here the point (,) is at 4 on x - axis & at point 4 on y - axis & your text is point (,) , totally your command will be \put(4,4){Your text/Command}
- Marking a Point :-
Say you wanna mark some point like A on a figure you've draw,to do so we may follow these steps,
⪼ First write \put(,){} Here your text A will go into {} that bracket and the place at which the marking is gonna be placed at.
⪼ So its can be (1,1) or (2,1)(0,0). For different values it gets placed at different places on the plane.
⪼ Whenever we draw something it's like drawing on a graph paper so when you use (1,1) it means if you were drawing on a graph then the point A will be located on the place where you'll mark (1,1) in a graph paper.
⪼ So here it will be like \put(1,1){A}
⪼ You may also add fonts and they would be started like \put(1,1){\sf A}
- Drawing a line :-
The command is,
3. \put(point on x-axis,point on y-axis){\line(Direction of the line){length of line}}
Example :-
See the picture given below
⨳ Here the point on x-axis is 3 & the line is starting from co - ordinates (0,0) so here we used \put(0,0) and here in text we used the command \line(1,0){length} so it draws a line with direction (1,0) with some length .
⨳ Not just straight lines we may also draw crossed lines say like a side of a triangle.
⨳ For that we have to change the direction of the line which is the () after the line command and change the length of the line by changing the values in the {} bracket.
⨳ In the above image we saw that the line was given a direction 1,0 which means if you mark the point 1,0 then the line you draw will follow it .
⨳ In the below picture we see that the the line is given a direction (1,2) which means if we mark the point 1,2 then the line we draw will follow that point.
We may also draw a smaller line which need not touch or cross the point we used for the direction.
- Drawing arrows :-
Picture environment is not just for lines we may also draw arrows using the vector command
4. \put(0,0){\vector(Direction of the arrow){Length of the arrow}}
⨳ This draws an arrow as per the direction you keep. This command is similar to the line command(\line(0,0){}). We simply use \vector instead of \line to draw an arrow.
⨳ Not just straight arrows crossed ones are also possible, as per your direction the arrow given.
⨳ It is not mandatory only to use positive values, negative ones can also be used.
- \qbezier Curves :-
The name sounds complicated but it's actually super easy. Earlier we were drawing straight lines giving them direction and length. Here we shall directly draw them by joining the coordinates. Go take a graph sheet!! :D
⨳ A qbezier code looks like :- \qbezier()()()
Here you may observe three () . These brackets are the starting point, the point where it gets bent and the ending point
⨳ We shall do the base first. Let's start from the origin 0,0 then end it at 4,0.
⨳ To draw straight lines using \qbezier we have to repeat the same values we used in the first (). That is we bend the line where it starts and so it becomes a straight line.
⨳ Which means for the base of the triangle we shall use \qbezier(0,0)(0,0)(4,0). This would give us the below shown line
(0,0) (0,0) (4,0)
↑ ↑ ↑
Starting point Bending Point Ending Point
⨳ Its just simply like the thing you do on a graph sheet. Mark the points 0,0 & 4,0 then join them to get a straight line, similarly we do that here without the graph sheet!!
Next comes the other 2 sides
⨳ So we know that the sides will be starting on the same point as the base did. So the point will again start on 0,0.
⨳ Here we said that it would be an equilateral triangle so we shall use 2,3 as the ending point [Just for an example you may use different values for different figures] and that would give us the below given figure.
Then finally the last side
Now that we drew the two sides, time to draw the third one... Yay!!
⨳ The final thing to be done is to join the points 4,0 and 2,3. Which means the starting point is 4,0 and the ending point is 2,3.
⨳ We may also start it from 2,3 and end it on 4,0 both work and would finally give us the below shown triangle!!
The final code will be,
\setlength{\unitlength}{1cm}\begin{picture}(20,15)\qbezier(0,0)(0,0)(4,0)\qbezier(0,0)(0,0)(2,3)\qbezier(4,0)(4,0)(2,3)\end{picture}
- Drawing a circle :-
The command is \put(0,0){\circle{diameter}}
Here in the given command, in the brackets [ {diameter} ] is where you type the diameter of the circle . So in the preview , the number you type in the diameter is the diameter of the circle in the preview
Note:- The maximum diameter of the circle is 1.4cm . So , if you want to get a circle of diameter more than a diameter of 1.4cm , you can use the command \qbezier(,)(,)(,). The code of such a circle is given on the codes section
- Drawing a shaded circle :-
The command is \put(0,0){\circle*{}} it is similar to circle command given above , so just keep a ‘*’ after circle in the command , it draws a shaded circle.
- At last \multiput(,)(,){}{} command :-
It looks tough but it is soo easy & saves your time .
Example command :-
\multiput(x1,y1)(x2,y2){number of objects}{object}
Here
(x1,y1) is the starting point of the object & (x2,y2) is the space or number of units in between them .
Example :-
If we want to draw two verticle lines of same length & 2 units difference in between them , then your command will be \multiput(0,0)(2,0){2}{\line(0,2){2cm}}
- Conclusion
- They may all look complicated and long, but are really simple when you start to think they are easy
- They are just coordinate geometry with some commands not rocket science
- I hope they are easy to understand and you may contact the team regarding your doubts :)
Designed and uploaded by
Team Coder