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 forms the basis of the following KDE applications:
- KontrollerLab (sourceforge project page)
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:
for KDE4 apps
Compiling an (M4) Circuit Macro "Picture" inside 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
- 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.
- 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
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"
If the compilation was successfully, the following message should be displayed in the "Log and Messages" pane
[M4CM] quick.m4 => quick.pdf (m4cm)
The steps followed by m4cm(.py) will be shown in the "Output" pane
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
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.