Latex块结构

Latex图形和图形是使用图形环境创建的, 该环境用于:

\begin{figure}.....\end{figure}

同样, 也可以使用图形环境来创建块。
你必须针对不同的目的研究不同主题的各种框图。
【Latex块结构】该框图包含多个大小不同的框。你可以在框内提及任何文字。这也是表示类似于图形的信息的有效方法。你可以使用箭头等来确定从一个框到另一个长度不同的框的方向。
在Latex中用来表示框的命令是:
\framebox{x_dimension, y_dimension}[position]{text}

在此, x和y尺寸表示框在x和y轴上的尺寸。该位置用于确定要显示的文本的位置。
如果要为特定程序设置公共单位长度, 则可以使用\ setlength命令。该命令写为\ setlength {\ unitlength} {0.23in}。
用于放置图片元素的命令为\ put。
该命令写为\ put {x坐标, y坐标} {图片元素}。
有两种绘制块结构的方法。第一个是通过使用标准命令, 而另一个是通过使用Tikz环境。
标准指令方式 此方法仅包含标准命令的使用。不能单独使用任何环境或不同的命令。这些步骤非常棘手, 但是一旦概念清楚了, 你就可以轻松理解和实施该过程。
你可以根据自己的设计或模式制作任何框图。
让我们考虑一个简单的框图示例。
每个命令的说明在相应命令的前面进行了说明。
\documentclass[12pt]{article}\begin{document}\begin{figure}[h]\setlength{\unitlength}{0.14in} % used to set the unit length\centering % used for centering Figure\begin{picture}(30, 16) % these are the dimension of the picture environment having 32 length units width and 15 units height.\put(0, 5){\framebox(8, 3){$Transformer$}}\put(12, 5){\framebox(6, 3){$Rectifier$}} % the distance between the point on the x-axis is used to determine the gap between the particular block\put(22, 5){\framebox(6, 3){$Smoothing$}} % the point on x-axis is the distance from the origin of a particular framebox\put(31, 5){\framebox(6, 3){$Regulator$}}\put(-3, 6.5){\vector(1, 0){3}}\put(8, 6.5){\vector(1, 0){4}} % here, the x and y-axis point in the put command is used to fix the arrow on the particular block\put(18, 6.5){\vector(1, 0){4}}\put(28, 6.5){\vector(1, 0){3}}% spacing between the arrow and the block can be adjusted according to the x and y-axis coordinate on both the put commands\put(37, 6.5){\vector(1, 0){4}} \put(-9, 6.5) {$230V AC Mains$} \put(38, 7.5) {$Regulated$} \put(38, 6.5) {$5V DC$} \end{picture}\caption{A Block diagram of regulated power supply} % title of the Figure containing blocks or the title of a whole diagram of blocks\label{fig:block} % label to refer figure in text\end{figure}\end{document}

%之后的文字只是为了你更好地理解。 Latex会忽略%字符之后的文字。
输出:
上面代码的输出是如下所示的框图:
Latex块结构

文章图片
现在考虑使用上述方法的复杂框图。
此示例的代码如下:
\documentclass[12pt]{article}\begin{document}\begin{figure}[h]\setlength{\unitlength}{0.15in} \centering \begin{picture}(30, 16) \put(0, 5){\framebox(5, 3){$A$}} % the place of the block is at the origin\put(10, 8){\framebox(5, 3){$B$}}\put(10, 2){\framebox(5, 3){$C$}} \put(20, 13){\framebox(5, 3){$D$}} \put(20, 8){\framebox(5, 3){$E$}} \put(20, 4){\framebox(5, 3){$F$}}\put(20, 0){\framebox(5, 3){$G$}} \put(28 , 6){\framebox(5, 3){$H$}} % here, the position of block finishes \put(-3, 6.5){\vector(1, 0){3}} % from here the location and distance of arrow are specified\put(5.2, 6.5){\vector(1, -1){3}}\put(5.2, 6.5){\vector(1, 1){3}} % here the value after the vector command, i.e., {3}, signifies the length of the arrow. The higher the value, the higher will be the size of the arrow\put(8, 3.5){\vector(1, 0){2}} \put(8, 9.5){\vector(1, 0){2}} % the position of points is adjusted according to the distance from the origin, i.e., block A\put(15, 3.5){\vector(1, 0){3}} % arrow commands from block C\put(18, 3.5){\vector(1, -1){2}} \put(18, 3.5){\vector(1, 1){2}} % arrow commands from the arrow from block C\put(15, 9.5){\vector(1, 0){5}} \put(15, 9.5){\vector(1, 1){5}} % arrow commands from block B% the value of less than 1 on the y-axis in vector command is not specified here\put(25, 9.5){\vector(1, -1){3}} % arrow from block E to block H\put(25, 5.5){\vector(1, 1){3}} % arrow from block F to block H\put(33, 7.5){\vector(1, 0){4}}\put(-5, 6.5) {$Starting$} \put(33, 7.5) {$End$} \end{picture}\\\caption{A simple example of a complex block diagram} \label{fig:block} \end{figure}\end{document}

你可以使用上述命令为特定的箭头和块创建任何框图。你还可以根据需要调整箭头和块的大小, 尺寸以及距离。
输出:
Latex块结构

文章图片
你可以使用上述命令在块内或箭头上插入任何文本, 并可以指定写入特定文本的距离。

    推荐阅读