TikzEdt A semigraphical Tikz editor

## Documentation

This is the documentation for users. The Documentation for developers can be found here.

## TikzEdt

TikzEdt is an editor for the Tikz language, used to encode vector graphics in Latex documents.

#### What TikzEdt can and cannot do for you

Typically, when producing graphics for use in LaTeX documents, you have the choice between:
• Using a scripting language, like Tikz or pstricks to directly code the image.
• Using an external WYSIWYG drawing program (like Inkscape, !OpenOffice Draw, or even MS Powerpoint), export your dawing as pdf or eps, and include it in your tex-file.
Both approaches have advantages and disadvantages. Usually the manually coded graphics are higher quality, but more effort to produce. In particular, positioning items in code such that proportions "look good" can be painful. Real time preview programs like ktikz already help a lot. The goal of TikzEdt is to go one step further and combine WYSIWYG and code editing, so that ideally you can generate graphics coded in TikZ in little more effort than what would need with a vector drawing program, but still retain the full flexibility and high quality look of Tikz drawings. TikzEdt is however not a replacement for full-featured WYSIWYG vector graphics editor. It assists you writing TikZ code, but still you will have to learn the TikZ language, since only a few TikZ commands are accessible through TikzEdt's WYSIWYG tools. If you do not want to deal with TikZ coding, you probably are better off using Inkscape or one of its commercial counterparts.

## Getting started

To use TikzEdt, you need a working Latex installation. The authors use the MiKTeX distribution. We strongly recommend to do a full installation of all packages, or at least of all TikZ-related packages. Also, you need .NET 4. the setup program will complain and direct you to the appropriate download page if you don't have it installed already.

#### Hello World

Start TikzEdt and enter the following code:
\begin{tikzpicture}
\node (h) at (1,1) {hello};
\node (w) at (3,3) {world};
\draw (h) edge (w);
\end{tikzpicture}

If all goes well, you will see the compiled preview of your document on the right hand side, plus two red crosses at the locations of the nodes. Try dragging the red crosses with the mouse and watch the code update itself.

## Overview of features

TikzEdt assists you in the following ways:
• By providing a good text editor with syntax highlighting and code completion (CTRL-SPACE), powered by AvalonEdit. You can customize the syntax highlighting and code completion by editing the appropriate xml-files.
• By providing real time preview of the compiled TikZ picture as you type. The preview is speeded up by using precompiled headers.
• By an extensible snippet library that you can display or hide by pressing the "Snippets" button on the left of TikzEdt's window. Insert snippets by double click or using the context menu. You can write your own snippets usinging the snippet editor (Menu Settings->Snippet Editor), or by editing the xml file TheSnippets.xml.
• By the WYSIWYG tools accessible through an overlay displayed on top of the compiled tikz image.
Except for the last, these features are pretty standard, so let us discuss only the WYSIWYG part in more detail. This is also the part that is hardest to implement and took most of our development time.

#### The WYSIWYG tools

Name Description
1 Move This tool allows you to select and shift around coordinates. Just mark some items and drag and drop.
2 Node Insert new nodes, like \node at (3,4) {?}. Replace the ? by whatever text you want to show at that position.
3 Edge This tool connects two coordinates or nodes by a Tikz edge, like \draw (v1) edge (mynode). If you select unnamed coordinates to connect, a node tag is inserted, with a unique name like v13.
4 Path This tool produces a series of lines.
5 Smooth Curve Draw a smooth curve through specified points. Double click to closethe curve, right click or press ESC to stop drawing and leave the curve open.
6 Bezier Curve Draw a Bezier curve.
7 Rectangle Produces a rectangle, press CTRL to make a square.
8 Ellipse Produces an ellipse, press CTRL to make a circle.
9 Arc/Pie Draw an arc segment. Press CTRL to draw a Pie segment instead.
10 Edit Arc/Pie Lets you edit arc segments in a better way than with the Move tool.
11 Grid Draw a grid.
By default the code will be inserted at the end of the tikzpicture environment in your TikZ code. You can also select Tikz scope's for editing by double clicking or through the context menu. Then a thick border is drawn around the scope and items are inserted at the end of the scope. For example:
\begin{tikzpicture}
% some stuff
\begin{scope}
% some more here
% --- when the scope is selected for editing, items are inserted here ---
\end{scope}
% blablabla
% --- when the scope is selected, items are inserted here ---
\end{tikzpicture}


#### Which TikZ objects appear in the overlay

You will note that not all elements in your TikZ file are represented in the overlay. This has two reasons:
• It does not make sense to edit some Tikz elements move with the mouse. For example, if you draw a TikZ \matrix, the position of the matrix elements cannot be changed directly, but is determined during the typesetting. Hence it does not make sense to make those positions editable.
• The position of coordinates has to be determined by TikzEdt. The authors cannot reimplement Latex/Tikz completely and hence some TikZ features are not WYSIWYG-supported in TikzEdt.
Only coordinates, which are editable, and whose absolute position can be "easily" determined appear in the overlay and can hence be modified with the mouse by drag and drop.

#### Can the overlay fail?

Determining and modifying the positions of nodes is rather intricate programmatically. We tried to make sure that (i) even if only part of the TikZ code can be understood by TikzEdt, WYSIWYG editing of the remainder of the code still works, and (ii) that your code will never get corrupted by the WYSIWYG editor. In the current beta phase, in case you encounter problems (we don't hope so, of course), you should:
1. Either turn off the WYSIWYG features by switching to "Preview Mode" in the "View" menu, and use TikzEdt merely as a text editor with preview.
2. Or enclose the conflicting part of your code in %/* ... %*/. The part ... in the middle will be ignored by the parser and will not appear on the overlay.
3. In any case, we are happy if you report the problem and send us the conflicting file, so that we can improve TikzEdt.

#### Coordinate systems and tranformations

TikzEdt supports TikZ coordinate transformations, but currently not canvas transformations. In particular, you can use the WYSIWYG features with polar coordinates, and things should behave as you expect. For example, try to move the node in this example:
\begin{tikzpicture}
\draw (-4,4) rectangle (4,4);
\node[draw, fill, minimum size=5] at (30:2);
\end{tikzpicture}


• \begin{}-completion: If you type \begin{bla} + RETURN, TikzEdt automatically inserts an \end{bla}. This feature can be turned off in the settings dialog.
• Put the caret at some position in the text editor and right click->Mark item in overlay. Then the location of the item is highlighted in the preview on the right. (Note: Make sure the caret is really at the right position, not just the mouse....)
• The other way around, you can jump to the source code corresponding to some item in the overlay using the context menu or mouse double click.

## Command line arguments

Flag Description
-p, --portable Use the application directory to store user settings. Note: the application directory must be writable.
-h Turn on hardware rendering. This makes TikzEdt faster, but is less "safe" than software rendering.