About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Smile for the Camera: a new cybercrime short story ebook.
Previous: Cheese and Lettuce on Toast  Up: Step-by-Step Examples  Next: Bus  


An Artificial Neuron

This example illustrates setting line styles and adding text. The final image looks best as a pgf picture included in a LaTeX document, as then you can use maths fonts.

  1. The normal font size for my LaTeX document will be 10pt, so I first need to make sure this is set using the Settings->Configure TeX/LaTeX Settings menu item to open the TeX/LaTeX Settings dialog window. Make sure the Normal Font Size value is set to 10 in the Document Settings tab.

  2. Select the rectangle tool, and create a rectangle, as shown in Figure 11.16.

    neuron1
    Figure 11.16: Artificial Neuron Example--Adding a Rectangle
    Select the ellipse tool, and create a circle, as shown in Figure 11.17.

    neuron2
    Figure 11.17: Artificial Neuron Example--Adding a Circle

  3. To make the logistic function symbol, select the open curve tool, and do a single segment (Figure 11.18(a)). Then use the edit path tool to adjust the curvature, as shown in Figure 11.18(b). (If you have enabled the grid lock, you may find it easier to disable it while you are editing the curvature control points.)

    neuron3a
    (a)
    neuron3b
    (b)
    Figure 11.18: Artificial Neuron Example--creating a sigmoidal curve: (a) adding an open curve segment; (b) edit segment to adjust curvature.

  4. Next set the current line style to have an end arrow. Note that lines with end markers look best with a butt cap style, so this should also be set. This can be done as follows:

    Use the Settings->Styles menu item to display the current styles dialog box. Select the tab labelled Line Style to display the line style panel. Select Butt from the drop-down list labelled Cap Style (see Figure 11.19). Next click on the Select chooseup button located on the same row as End Marker to open the end marker dialog box (illustrated in Figure 11.20). Select the radio button labelled Use Marker. This will enable the marker chooser panel. Select the tab labelled Arrows and select Pointed 60. Select Okay to close the end marker dialog box and select Okay to close the styles dialog box.

    neuronlinestyle
    Figure 11.19: Artificial Neuron Example--Setting the Current Line Style

    neuronendmarker
    Figure 11.20: Artificial Neuron Example--End Marker Dialog Box

  5. Select the open line tool, and add in the arrows as illustrated in Figure 11.21.

    neuron4
    Figure 11.21: Artificial Neuron Example--Adding Arrows
    Use Settings->Styles to open the current styles selector, and set the font family to "Serif" and the font size to 10pt, and then press Okay. Select the maths tool, and add in the text, as illustrated in Figure 11.22. (I've used the Superscripts and Subscripts block in the symbol selector to insert the subscripts.)

    neuron5
    Figure 11.22: Artificial Neuron Example--Adding Text

    Since I have the maths tool with the maths-mode mappings on, the LaTeX alternative text automatically has the maths-shift characters inserted and the Unicode subscripts have been converted to _1 etc. You can see the LaTeX alternative text if you select the text area and use Edit->Text->Edit text. This will open up the edit text dialog box shown in Figure 11.23.

    neuron6
    Figure 11.23: Artificial Neuron Example--Editing Text

    Now select all of the text on the left (x1, x2 and xn) and use the Edit->Text->Font Style->All Styles dialog box to change the horizontal anchor parameter to Right. (Note that you will not see any difference to the image in FlowframTk.)

  6. Select the maths tool and start a text area in the rectangle. I want to use a capital sigma to indicate a summation, and as I don't know the magic combination of characters to access that symbol, I used the Insert Symbol dialog box. To do this, either use the popup menu and select Insert Symbol, or press the Ins key. The required symbol can now be selected from the dialog box (illustrated in Figure 11.24). This is the summation symbol (U+2211) from the Mathematical Operators block, not the Greek capital sigma from the Mathematical Alphanumeric Symbols block.

    neuron7
    Figure 11.24: Artificial Neuron Example--Insert Symbol Dialog Box

  7. Use the Edit->Text->Font Style->All Styles to change the font size to 25 and change both the anchor settings to Centre, see Figure 11.25. (You don't need to change the anchor settings if you have the automatic anchor update setting enabled, as it will change when you justify the text area in step 10.)

    neuron8
    Figure 11.25: Artificial Neuron Example--Setting the Font Style

    As before, if you used the maths tool with the maths-mode mappings enabled, the LaTeX alternative text should already be correctly set, but you can check by selecting the text area and using the Edit->Text->Edit text menu item to open the Edit Text dialog box (Figure 11.26(b)).

    neuron9a
    (a)
    neuron9b
    (b)
    Figure 11.26: Artificial Neuron Example--setting the equivalent LaTeX symbol: (a) selected text; (b) setting LaTeX equivalent.

  8. The ∑ would look much better if it was centred inside the rectangle. To do this select the ∑ and the rectangle, then group them either by clicking on the group objects button or by using the Transform->Group menu item. Then select the Transform->Justify->Centre menu item, and then the Transform->Justify->Middle menu item. The text area should now be centred inside the rectangle (Figure 11.27).

    neuron10
    Figure 11.27: Artificial Neuron Example--Justifying Objects

    To include the image inside a LaTeX document, save the image to a LaTeX file using the File->Export menu item, and then include it in your document (assuming the file was called neuron.tex):

    \begin{figure}
    \centering
    \input{neuron}
    \caption{An Artificial Neuron}
    \end{figure}
    
    (Remember to use the pgf package.) The image will appear in the LaTeX document as illustrated in Figure 11.28. (For best results use either PDFLaTeX or LaTeX and dvips as some dvi viewers may not be able to interpret the pgf specials.)

    neuron
    Figure 11.28: Artificial Neuron Example--Image as it Appears in a LaTeX Document



Previous: Cheese and Lettuce on Toast  Up: Step-by-Step Examples  Next: Bus  

© 2014 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs