summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ditaa/README
blob: 34be8bbd1fc4f699a0757d32f095f0e8b119197e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
= The LaTeX ditaa package

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.

```
\begin{ditaa}{ditaa caption example}{ditaaexample}
    +-----+     +----+     +---+
    |Store+---->|This+---->|One|
    +--+--+     +----+     +---+
       |
       V
    +-----+
    |THIS |
    +--+--+
       |
       V
    +-----------+     +--+
    |another one+---->|Hi|
    +-----------+     +--+
\end{ditaa}

```

The source above will be converted into a following diagram and incorporated in your final PDF.

.Figure Rendered Ascii Art
[#img-sunset]
[caption="Figure 1: ",link=resources/rendered.png]
image::resources/rendered.png[Rendered Ascii Art,480,300]

== Prerequisites
https://github.com/asciidoctor[Asciidoctor @ *GitHub*]

* 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...
* You need to give an option ```--shell-escape``` to your LaTeX compiler (such as ```pdflatex```, ```latex```, etc) command whichever you use.


== How to use

* Place the ```ditaa.sty``` file at the same directory as your ```.tex``` file.
* Create ```ditaa``` directory under the directory you have for the other non-ditaa images. This package will create ```.ditaa``` and ```.png``` files.
* Do ```usepackage[imagepath=IMAGEPATH]{ditaa}``` beffore ```\begin{document}```. The IMAGEPATH is the directory you have images.
* Compile your  ```.tex``` files as usual, but giving  ```--shell-escape``` option to your ```(pdf)latex``` command.

== Tips
Online sites such as [ascii-flow](http://stable.ascii-flow.appspot.com/#Draw) will be your friends!

== Future Works
* Make it possible to define caption and filename independently.
* ~~Improve the way to define resource directory.~~
* ~~Make it possible to specify image size.~~ (Now you can specify image width. See the example)
* I want to use this in OverLeaf. Publish in CTAN? Help me. I'm a LaTeX newbie.

== References
* 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.