LaTeX图片环境 Picture environment

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

时间: 2024-10-14 00:12:33

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

Mac LaTex中文环境搭建

为了在博客上写公式,折腾了一晚上Mac上的LaTex的环境搭建,本文对步骤进行记录. 系统:Mac OSX 10.10.5 软件准备 1) MacTex 2015 Distribution (Tex的Mac发行版) 2) Skim 1.4.16 (轻量级pdf阅读器,与下面的LaTexTools配合使用,即时编译+预览) 3) Sublime Text 2 (LeTax编辑器) 4) Sublime Text 2 相关插件 1. Package Control (包管理工具) 2. LaTeXT

在Mac OS X下搭建Latex编辑环境

在这里分享一下如何在Mac下搭建Latex编辑环境的方法 首先当然是Google Mac Latex寻找已有的Blog教程,然后发现Mac上常用Sublime Text来编辑,因此搜索Mac sublime Latex,就找到了以下两个网页: http://www.readern.com/sublime-text-latex-chinese-under-mac.html http://economistry.com/2013/01/installing-and-using-latex-for-m

Mybatis源码分析:环境设置Environment

Mybatis环境配置类Environment 在初始化Mybatis框架时,需要配置environment元素,该元素允许有多个,方便我们在不同环境下切换后端的存储.拥有一个id属性用于该环境,此id必须唯一,否则后续配置会覆盖前面的配置,该元素拥有两个子元素(事务管理器),(数据源),这两个元素后续会进行讲解,目前只需要记住名称即可.如下便是的相关配置,该配置定义了dev,test,prod三种环境 <configuration> <!--引入外部资源 --> <prop

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

Ubuntu下的文档编辑虽然有libreoffice,但对中文和公式的排版始终不如ms office,因此要想写出高质量的文档,只能靠latex了,现在随着xeCjk的开发,中文文档在ubuntu下的排版已经非常棒了,已经足够支持和成熟,其组合是:texlive2014+texmaker+lyx+中文字体,这样在ubuntu下就可以开发出完美的中文文档了. 转入正题,以下的方法在3台电脑上成功安装(在64位系统上安装): 1.首先安装texlive2014,不推荐用官方源sudo apt-get

Latex图片显示问题(1)

用latex编译后,若用dvipdf生成pdf文件,则其中有个eps图的左侧会显示不完全:若是用dvips--pspdf生成pdf文件,图像显示没问题. 这种情况的问题出在,加载 graphicx 宏包的时候没有加任何驱动选项,所以在 LaTeX 的时候,默认使用 dvips 这个驱动模式.因此,在 LaTeX - DVIPDFM(x) 工具链的时候图片显示会出问题.也就是必须使用 LaTeX - dvips - ps2pdf 这个工具链才行.

latex图片处理

插图的基本命令是 \begin{figure}[!hbp]\centering\includegraphics[width=0.7\textwidth]{图片名称}\caption{标题名称}\label{fig1}\end{figure} 1,其中图片名称应包括图片的路径,但是如果把图片和源文件放在一个文件夹这,则只写名称就可以了. 2, [width=0.7\textwidth]是指定图片的相对大小,这里指图片的宽度为页面的0.7倍. 3,如果把\caption{标题名称}写在\includ

latex:公式环境

1.单行公式环境 equation 单行公式环境equation可将一个公式,不管多长都可排版为一行,并给出一个序号.而由系统提供的displaymath环境等效于公式宏包提供的equation*环境. equation和displaymath都只能用于编排单行公式,期间,换行命令无效,而换段命令为非法,它将造成编译终端,引发系统给出错误信息. 代码: \begin{equation} f(x)=3x^{2}+6(x-2)-1 \end{equation} 2.1 使用align共十足环境将公式

[Elixir003]通过环境变量(Environment Variables)来管理config

在elixir的config中我们有时会使用的到一些不想暴露出来的配置项,常用的作法是如Phoenix #config/prod.exs use Mix.Config ... # Finally import the config/prod.secret.exs # which should be versioned separately. import_config "prod.secret.exs" 在上面,我们可以把不应该暴露的项(如数据库passwd,auth_token...

latex:矩阵环境

矩阵的最大列数值是在MaxMatrixCols计数器中设定的,默认值是10.可使用计数器设置命令修改其值,例如需要用到15列:\setcounter{MaxMatrixCols}{15};当超宽矩阵排写完成后应随机将其再改回到默认值. 1.行间距离 1.1 公式宏包amsmath提供了6中行间公式形式的矩阵环境matrix.pmatrix.Bmatrix.bmatrix.vmatrix.Vmatrix, 这些矩阵环境必须置于数学模式中,它们的使用方法类似于数组环境array,但比它简单,没有位置