Cheese and Lettuce on | 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 with subscripts.

1. Select the |
   |, and create a rectangle, as shown in Figure 11.16.

   Figure 11.16: Artificial Neuron Example--Adding a Rectangle

   Select the |
   |, and create a circle, as shown in Figure 11.17.

   Figure 11.17: Artificial Neuron Example--Adding a Circle

2. To make the logistic function symbol, select the |
   |, and do a single segment (Figure 11.18(a)). Then use the |
   | 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.)

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

3. 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
   labelled Cap Style (see Figure 11.19). Next select the button labelled Select... 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.

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

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

4. Select the |
   |, and add in the arrows as illustrated in Figure 11.21.

   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 press Okay. Select the |
   |, and add in the text, as illustrated in Figure 11.22.

   Figure 11.22: Artificial Neuron Example--Adding Text

   If you want to include your image into a LaTeX document as a `pgfpicture` environment, it would look better if you put the text into maths mode, and use subscripts. To do this first select the
   , and then select Edit->Text->Edit text.... This will open up the edit text dialog box. Click on the Different button, and enter the text as it should be in the LaTeX file (Figure 11.23.) Do this for each
   . In addition, 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 Jpgfdraw.)

   Figure 11.23: Artificial Neuron Example--Editing Text

5. Select the |
   | 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).

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

6. Use the Edit->Text->Font Style->All Styles... to change the font size to 25 and change both the anchor settings to Center, see Figure 11.25. (You don't need to change the anchor settings if you have the |
   | setting enabled, as it will change when you justify the
   in step 9.)

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

   If you want to export your image into a LaTeX document, you will need to set the LaTeX equivalent text to `$\Sigma$`. As before, this is done by selecting the
   and using the Edit->Text->Edit text... menu item to open the Edit Text dialog box (Figure 11.26(b)).

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

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

   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.)

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

Cheese and Lettuce on | Bus