| 1 |
= The LaTeX ditaa package |
| 2 |
|
| 3 |
With this, you will not need to bring your diagrams outside your ```.tex``` file and not to worry about wiring such files for diagrams, and tools (Microsoft Visio, PowerPoint, Libre Office tools, as such) from which they are created. |
| 4 |
|
| 5 |
``` |
| 6 |
\begin{ditaa}{ditaa caption example}{ditaaexample} |
| 7 |
+-----+ +----+ +---+ |
| 8 |
|Store+---->|This+---->|One| |
| 9 |
+--+--+ +----+ +---+ |
| 10 |
| |
| 11 |
V |
| 12 |
+-----+ |
| 13 |
|THIS | |
| 14 |
+--+--+ |
| 15 |
| |
| 16 |
V |
| 17 |
+-----------+ +--+ |
| 18 |
|another one+---->|Hi| |
| 19 |
+-----------+ +--+ |
| 20 |
\end{ditaa} |
| 21 |
|
| 22 |
``` |
| 23 |
|
| 24 |
The source above will be converted into a following diagram and incorporated in your final PDF. |
| 25 |
|
| 26 |
.Figure Rendered Ascii Art |
| 27 |
[#img-sunset] |
| 28 |
[caption="Figure 1: ",link=resources/rendered.png] |
| 29 |
image::resources/rendered.png[Rendered Ascii Art,480,300] |
| 30 |
|
| 31 |
== Prerequisites |
| 32 |
https://github.com/asciidoctor[Asciidoctor @ *GitHub*] |
| 33 |
|
| 34 |
* You need to have http://ditaa.sourceforge.net/[ditaa] installed. (Need to be able to run ```ditaa``` from your command line). Fortunately, recent package managers such as ```apt``` allow you to install it with a single command line ```sudo apt install ditaa```. ```brew``` let me do similar ```sudo brew isntall ditaa``` on my mac. For windows, sorry, please let me know how to do that... |
| 35 |
* You need to give an option ```--shell-escape``` to your LaTeX compiler (such as ```pdflatex```, ```latex```, etc) command whichever you use. |
| 36 |
|
| 37 |
|
| 38 |
== How to use |
| 39 |
|
| 40 |
* Place the ```ditaa.sty``` file at the same directory as your ```.tex``` file. |
| 41 |
* Create ```ditaa``` directory under the directory you have for the other non-ditaa images. This package will create ```.ditaa``` and ```.png``` files. |
| 42 |
* Do ```usepackage[imagepath=IMAGEPATH]{ditaa}``` beffore ```\begin{document}```. The IMAGEPATH is the directory you have images. |
| 43 |
* Compile your ```.tex``` files as usual, but giving ```--shell-escape``` option to your ```(pdf)latex``` command. |
| 44 |
|
| 45 |
== Tips |
| 46 |
Online sites such as [ascii-flow](http://stable.ascii-flow.appspot.com/#Draw) will be your friends! |
| 47 |
|
| 48 |
== Future Works |
| 49 |
* Make it possible to define caption and filename independently. |
| 50 |
* ~~Improve the way to define resource directory.~~ |
| 51 |
* ~~Make it possible to specify image size.~~ (Now you can specify image width. See the example) |
| 52 |
* I want to use this in OverLeaf. Publish in CTAN? Help me. I'm a LaTeX newbie. |
| 53 |
|
| 54 |
== References |
| 55 |
* https://github.com/deselaers/latex-beamerposter[latex-beamerposter]: I learned a lot from this; such as how to package my .sty, how to organize directories under my repo for LaTeX style package, etc. |
| 56 |
|