M4 Circuit Macros - Kile Integration

From Peter Jan Randewijk
Jump to: navigation, search

Contents

Syntax Highlighting in Kile

Kile is a very powerful LaTeX editor but is also very easily customisable to allow for seamless (M4) Circuit Macro integration.

Katepart

Katepart forms the basis of the following KDE applications:

  • Kate
  • KWrite
  • Konqueror
  • KDevelop
  • Quanta
  • Kile
  • KTurtle
  • TaskJuggler
  • ProtoEditor
  • Kexi
  • PiKdev
  • KScope
  • Krusader
  • KConfigEdit
  • Klat
  • KBibTeX
  • Piklab
  • Protoeditor
  • KontrollerLab (sourceforge project page)
  • KPoGre

m4cm.xml was written for Katepart in order to allow all of the above KDE applications (only actually useful in Kile, Kate, KWrite, Krusader and maybe a few more...) to have syntax highlighting for all the :

  • M4 keywords,
  • (d/g)PIC keywords and
  • predefined Circuit Macros (currently up to version 7.9.5)

In order to "activate" syntax highlighting for (M4) Circuit Macros, copy m4cm.xml to:

  • /usr/share/kde4/apps/katepart/syntax

for KDE4 apps

KDE4 Examples

Syntax Highlighting in Kile under KDE4.

Syntax Highlighting in Kate under KDE4.

Compiling an (M4) Circuit Macro "Picture" inside Kile

Configuring Kile

  • from the Menu, choose "Settings" -> "Configure Kile..."
  • then from the Tree, Click on "Tools" -> "Build"
  • click on "New Tool" to add a new Build tool and name it (say) "M4CM"
    • for "Command", choose m4cm, i.e. the link in your /home/<username>/bin directory that points to m4cm.py
    • for "Options", chooose '%source' -pd in order to generate a PDF picture and to delete the EPS file afterwards

Adding the M4CM Build Tool to Kile - General Setup under KDE4.

  • click on the "Advance" tap
    • for "Type", choose "Run outside of Kile"
    • for "Class", choose "Compile"
    • for "Source extension, choose "m4" or "m4cm" depending on personal preference
    • for "Target extension, choose "pdf", this will allow KPDF of Okular (depending on you "ViewPDF" setting in Kile) to open the compiled PDF picture when you click on the ViewPDF icon on the toolbar.

Adding the M4CM Build Tool to Kile - Advanced Setup under KDE4.

  • click on the "Menu" tap
    • for "Add tool to Build menu", choose "compile" (technically correct) but I found that "convert" works nicely for the KDE4 Convert Drop Down List Icon on the Toolbar.
    • choosing an "Icon", is optional

Adding the M4CM Build Tool to Kile - Menu Setup.

Compiling an (M4) Circuit Macro file

An (M4) Circuit Macro file can now be "converted" from to a PDF in KDE4 by clicking on "Build" -> "Convert" -> "M4CM"

Compiling an (M4) Circuit Macro file from the Build -> Compile menu.

If the compilation was successfully, the following message should be displayed in the "Log and Messages" pane


[M4CM] quick.m4 => quick.pdf (m4cm)

[M4CM] Done!


The steps followed by m4cm(.py) will be shown in the "Output" pane

Kile's Output pane after a successful compilation of an (M4) Circuit Macro file in KDE4.

Adding M4CM to the Toolbar

In KDE4, M4CM will be automatically available under the "Convert" Drop Down List on the Tools Toolbar next to the "Compile" and "View" Drop Down Lists, see also the section below.

In KDE3, click "Settings" -> "Configure Toolbars..." and add "M4CM" to (say) the "Build" toolbar

Adding M4CM to Kile's Build Toolbar under KDE3.

An (M4) Circuit Macro file can now simply be compiled with m4cm by clicking on the M4CM icon on the "Build" toolbar.


Viewing the PDF output

To view the PDF output of m4cm, simply click on the "ViewPDF" icon.

Compiling an (M4) Circuit Macro file in Kile under KDE4. Viewing the output PDF file in Okular from Kile under KDE4.

Personal tools