Showing first {{hits.length}} results of {{hits_total}} for {{searchQueryText}}{{hits.length}} results for {{searchQueryText}}

검색 결과 없음

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 Author: Josh Cassidy (August 2013) This five-part series of articles uses a combination of video and textual descriptions to teach the basics of creating LaTeX graphics using TikZ. These tutorials were first published on the original ShareLateX blog site during August 2013; consequently, today's editor interface (Overleaf) has changed considerably due to the development of ShareLaTeX and the subsequent merger of ShareLaTeX and Overleaf. However, much of the content is still relevant and teaches you some basic LaTeX—skills and expertise that will apply across all platforms. In this post we're going to be looking at creating flowcharts in TikZ. To get started we need to load up the tikz package, the shapes.geometric TikZ library and the arrows library. \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows} The tikzstyle command Now before we start the document we need to define the basic components of a flowchart. To do this we use the \tikzstyle command. First, let's define the block we're going to use for start and stop blocks. We'll name it startstop using curly brackets immediately following the command, then we add an equals sign before a set of square brackets. In the square brackets we enter all the formatting information. For this block we'll specify a rectangle with rounded corners. We'll give it a minimum width of 3cm and a minimum height of 1cm. We'll also ensure the text gets centred and we'll set both a draw and a fill colour. In this example we've set the fill colour to a colour that is 30% red mixed with 70% white: \tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30] Next we'll specify an input or output box. This time we want the block to be a parallelogram. To achieve this we ask for a trapezium and then alter the angles. The rest is very similar: \tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30] Next we'll add a \tikzstyle for process blocks using a rectangle and a style for decision blocks using a diamond: \tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30] \tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30] Finally we'll define a style for the arrows. For this we set the line thickness to thick, add an arrow head and specify the stealth arrow head: \tikzstyle{arrow} = [thick,->,>=stealth] Nodes Now we are ready to start building our flowchart. To do the we use the tikzpicture environment. We'll create our flowchart blocks using nodes and the tikzstyles we defined earlier. Nodes are very powerful as we can easily position them, make them draw a shape, heavily format them and give them some text. In square brackets at the end of the begin command we specify a node distance of 2cm. This is so that the nodes we use to build the blocks are automatically spaced 2cm apart from their centres: \begin{tikzpicture}[node distance=2cm] \end{tikzpicture} To add a node we use the \node command. We then add a label for the node in parenthesis. This label is how we refer to the node in the rest of the code. Then in square brackets we add the name of the \tikzstyle we want the node to conform to, along with any other formatting options. Then in curly brackets we add the text we want to appear in the block before closing the statement with a semicolon: \node (start) [startstop] {Start}; If we now compile the code you'll see our start block has appeared as expected: Now let's add an input block in below the start block. This time we need to tell the node where to position itself. To do this we enter below of followed by an equals sign and a node label into the square brackets. We could also use above of, right of or left of if we wanted the block to appear somewhere else. We'll tell it to position itself below the start block: \node (in1) [io, below of=start] {Input}; Now lets add in a process block and a decision block. \node (pro1) [process, below of=in1] {Process 1}; \node (dec1) [decision, below of=pro1] {Decision 1};