Picture environment

If you need to include simple diagrams or figures in your document, the picture environment may be helpful. This article describes circles, lines, and other graphic elements created with LATEX.

Contents

Introduction

Images can be "programmed" directly in your LATEX file

\setlength{\unitlength}{1cm}
\thicklines
\begin{picture}(10,6)
\put(2,2.2){\line(1,0){6}}
\put(2,2.2){\circle{2}}
\put(6,2.2){\oval(4,2)[r]}
\end{picture}

The syntax of the picture is

\begin{picture}(width,height)(x-offset,y-offset)

the parameters are passed inside parentheses, width and height as you may expect, determine the width and the height of the picture; the units for this parameter are set by \setlength{\unitlength}{1cm}. The second parameter is optional and establishes the coordinates for the lower-left corner. Below a description of other commands:

\put(6,2.2){\oval(4,2)[r]}
will draw a oval centred in the point 4,2. The parameter [r] is optional, you can use rlt and b to show the right, left, top or bottom part of the oval. If absent the whole oval is drawn.
\put(2,2.2){\circle{2}}
draws a circle centred at the point (2,2.2) and whose diameter is 2.

In the next section the rest of the commands are described.

Open an example the picture environment in ShareLaTeX

Combining lines, circles and text

Different basic elements can be combined for more complex pictures

\setlength{\unitlength}{0.8cm}
\begin{picture}(12,4)
\thicklines
\put(8,3.3){{\footnotesize $3$-simplex}}
\put(9,3){\circle*{0.1}}
\put(8.3,2.9){$a_2$}
\put(8,1){\circle*{0.1}}
\put(7.7,0.5){$a_0$}
\put(10,1){\circle*{0.1}}
\put(9.7,0.5){$a_1$}
\put(11,1.66){\circle*{0.1}}
\put(11.1,1.5){$a_3$}
\put(9,3){\line(3,-2){2}}
\put(10,1){\line(3,2){1}}
\put(8,1){\line(1,0){2}}
\put(8,1){\line(1,2){1}}
\put(10,1){\line(-1,2){1}}
\end{picture}

In this example several lines and circles are combined to create a picture, then some text is added to label the points. Below each command is explained:

\thicklines
This changes the thickness of the lines, making them a bit thicker, you can also use \thinlines which has the opposite effect.
\put(8,3.3){{\footnotesize $3$-simplex}}
The text "3-simplex" is inserted at the point (8,3.3), the font size is set to footnotesize. The same command is used to label each point.
\put(9,3){\circle*{0.1}}
This draws a filled circle centred at (9,3) and it's diameter is 0.1. Is so small that is used as a point.

\put(10,1){\line(3,2){1}}

Draws a straight line, whose start point is at (10,1), it's length is 1 and it's direction is (3,2). As you see lines with arbitrary slopes are tricky to draw, some calculations must be performed for this.

Arrows can also be used inside a picture environment, let's see a second example

\setlength{\unitlength}{0.20mm}
\begin{picture}(400,250)
\put(75,10){\line(1,0){130}}
\put(75,50){\line(1,0){130}}
\put(75,200){\line(1,0){130}}
\put(120,200){\vector(0,-1){150}}
\put(190,200){\vector(0,-1){190}}
\put(97,120){$\alpha$}
\put(170,120){$\beta$}
\put(220,195){upper state}
\put(220,45){lower state 1}
\put(220,5){lower state 2}
\end{picture}

The syntax for vectors the same used for line

\put(120,200){\vector(0,-1){150}}
This renders a vector whose start point is (120,200), its length is 150 and the direction is (0,-1).

Open an example the picture environment in ShareLaTeX

Bézier curves

Bézier curves are special curves that are drawn using three parameters, one start point, one end point and a control point that determines "how curved" it is.

\setlength{\unitlength}{0.8cm}
\begin{picture}(10,5)
\thicklines
\qbezier(1,1)(5,5)(9,0.5)
\put(2,1){{Bézier curve}}
\end{picture}

Notice that the command \qbezier (quadratic Bezier curve) is not inside a \put command. The parameters that must be passed are:

  • A start point,
  • A control point and
  • An endpoint.

Picture is the standard tool to create figures in LATEX, as you see this is tool is sometimes too restrictive and cumbersome to work with, but it's supported by most of the compilers and no extra packages are needed. If you need to create complex figures, for more suitable and powerful tools see the TikZ package andPgfplots package articles.

Open an example the picture environment in ShareLaTeX

from: https://www.sharelatex.com/learn/Picture_environment

LaTeX图片环境 Picture environment的更多相关文章

  1. latex 常用环境(environment)

    align \begin{align} \overline{A \cup B} &= \overline{A} \cap \overline{B}, \\ \overline{A \cap B ...

  2. LaTex Verbatim 环境下使用数学符号

    参考: Write math and make a box with alltt environment LaTex Verbatim 环境下使用数学符号 在 Verbatim 环境下使用数学符号,需 ...

  3. LaTeX技巧96:LaTeX 图片控制命令,位置控制

    LaTeX技巧96:LaTeX 图片控制命令,位置控制 2012-04-05 17:25:44 zd0303 阅读数 28512更多 分类专栏: Latex   LaTeX 控制图片的位置,就是加感叹 ...

  4. Ubuntu下LaTex中文环境安装与配置

    转载自:http://www.linuxidc.com/Linux/2012-06/62456.htm LaTeX是一个强大的排版软件,但是其最初只是为英文排版而设计的.为了使其能够胜任中文排版的重任 ...

  5. Mac LaTex中文环境搭建

    为了在博客上写公式,折腾了一晚上Mac上的LaTex的环境搭建,本文对步骤进行记录. 系统:Mac OSX 10.10.5 软件准备 1) MacTex 2015 Distribution (Tex的 ...

  6. LATEX图片位置

    常用选项[htbp]是浮动格式: -『h』当前位置.将图形放置在正文文本中给出该图形环境的地方.如果本页所剩的页面不够,这一参数将不起作用. -『t』顶部.将图形放置在页面的顶部. -『b』底部.将图 ...

  7. Latex图片显示问题(1)

    用latex编译后,若用dvipdf生成pdf文件,则其中有个eps图的左侧会显示不完全:若是用dvips--pspdf生成pdf文件,图像显示没问题. 这种情况的问题出在,加载 graphicx 宏 ...

  8. ubuntu14.04配置中文latex完美环境(texlive+texmaker+lyx)

    Ubuntu下的文档编辑虽然有libreoffice,但对中文和公式的排版始终不如ms office,因此要想写出高质量的文档,只能靠latex了,现在随着xeCjk的开发,中文文档在ubuntu下的 ...

  9. Atom+latex+中文环境

    最近在写论文,的路上.很多idea都受限于官方给的模板不能够添加自己即时的中文idea,所以添加中文到文献中很有必要,这里记录自己添加中文的几个小步骤 1. 受限将atom中的latex packag ...

随机推荐

  1. 利用nodeJs anywhere搭建本地服务器环境【转载】

    首先去nodeJs官网下载最新版nodeJs     https://nodejs.org/en/ 安装成功后win+r打开cmd 输入node -help 或者node -v查看是否安装成功 装好后 ...

  2. CentOS系统初始化---不断更新中

    注意EOF不能有空格tab键 #get os version release=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides ...

  3. poj1321 棋盘问题(DFS)

    题目链接 http://poj.org/problem?id=1321 题意 给定一块棋盘(棋盘可能是不规则的),有k个相同棋子,将k个棋子摆放在棋盘上,使得任意两个棋子不同行,不同列,求有多少种不同 ...

  4. springMVC整合freemarker遇到的问题 maven

    java.lang.IllegalAccessError: tried to access method freemarker.ext.servlet.AllHttpScopesHashModel.& ...

  5. codevs 5294 挖地雷

    5294 挖地雷  时间限制: 1 s  空间限制: 1000 KB  题目等级 : 黄金 Gold   题目描述 Description 在一个地图上有N个地窖(N<=20),每个地窖中埋有一 ...

  6. [P3759][TJOI2017]不勤劳的图书管理员(分块+树状数组)

    题目描述 加里敦大学有个帝国图书馆,小豆是图书馆阅览室的一个书籍管理员.他的任务是把书排成有序的,所以无序的书让他产生厌烦,两本乱序的书会让小豆产生 这两本书页数的和的厌烦度.现在有n本被打乱顺序的书 ...

  7. HNOI2017滚粗记

    DAY0: 高三学长说了考前要么就完全颓废要么就完全学,所以我们就完全开启了颓废模式.上午教练带队去烈士公园游玩,中途机房歌神和QYS一直在谈论如何用LCT动态维护树的直径,ORZORZORZ.... ...

  8. bzoj 2821 分块

    分块: 先预处理,将原序列分成长度为len的许多块,计算从第i块到第j块的答案,(可以做到O(n*n/len)). 每次询问时,将询问的区间分成三部分,:左边,中间,右边,中间是尽量大的一个块区间,其 ...

  9. bzoj 1010 斜率优化DP

    我的第二道斜率DP. 收获: 1.假设两个位置:p<q<i,然后让某一位置优,看其满足什么性质,所谓斜率优化就是满足: (g[q]-g[p])/(f[q]-f[p])  op h[i] 要 ...

  10. bzoj1954 The xor-longest path

    Description  给定一棵n个点的带权树,求树上最长的异或和路径 Input The input contains several test cases. The first line of ...