
LaTeX TikZ for Cryptographers - lordqwerty
https://www.iacr.org/authors/tikz/
======
rerx
I never liked the syntax of TikZ and that things like computing points on a
parametrized curve correctly are difficult due to the limitations of TeX...

Asymptote [0] is a great alternative to prepare precise illustrations
programmatically, which also integrates neatly with LaTeX. Making figures like
[1] for a thesis (all lines and intersection points computed exactly) was
actually fun.

But for diagrams with lines and boxes I would really just use Inkscape.

[0] [http://asymptote.sourceforge.net/](http://asymptote.sourceforge.net/)

[1] [https://imgur.com/a/7QzsbDP](https://imgur.com/a/7QzsbDP)

~~~
baby
I always use keynote for diagrams with lines and boxes, I really like how
simple it is to do something nice.

I agree with your sentiment on tikz though, it is not a pleasure to write.

------
btown
TikZ (and all the abstractions you can build on it) is one of my favorite
parts of the LaTeX ecosystem. At its core is a layout engine where you
describe how nodes and lines are laid out relative to others, and it spaces
everything for you. [https://github.com/jluttine/tikz-
bayesnet](https://github.com/jluttine/tikz-bayesnet) , for instance, is a
lightweight wrapper that lets you represent graphical models with code like:

    
    
        \node[latent, left=of y, yshift=0.5cm] (mu) {$\mu$} ;
    

Now that I'm no longer in academia, I've lost my muscle memory for the syntax,
but every time I need to build a flowchart, I think back on this with
fondness. If someone were to repackage this with a cloud-based IDE and
autocomplete (maybe using something like
[https://latexbase.com/](https://latexbase.com/) ), maybe slightly kinder
syntax, I could see it meeting a business need even for non-technical users
who are fed up with the difficulty of "fitting something in" in a large
PowerPoint flowchart.

There's also
[http://sketch4latex.sourceforge.net/](http://sketch4latex.sourceforge.net/)
for 3D drawing, which is equally cool.

------
blt
TikZ is a microcosm of LaTeX itself: powerful, expressive, able to automate
repetitive tasks, beautiful output -- but sometimes, it takes _forever_ to do
something that would take a few mouse clicks in a GUI tool.

~~~
kashyapc
I completely hear you. Despite my extremely limited skills with TikZ, My brain
"somehow" stubbornly insists to keep chugging along with TikZ, spending
unreasonable amounts of time. But I _love_ the end result; the way text and
diagrams meld so cleanly. Nothing comes close.

On the unreasonable amount of time spent: Last December, "merely" to get the
arrows right neatly arranged, I spent more than 2 hours :-(. See the
transition from: _wonky-arrows1.png_ \--> _wonky-arrows2.png_ \--> _much-
better-arrows3.png_ \--> _even-better-arrows4.png_ (the "final") here[1].

In two months I have another deadline to produce some technical material with
TikZ diagrams (that's my choice, though). I'm determined to become more
efficient at it.

[1]
[https://kashyapc.fedorapeople.org/temp/tikz/](https://kashyapc.fedorapeople.org/temp/tikz/)

~~~
rerx
... but the text in the boxes still has a weird baseline. Sorry to spoil the
fun, but if you just invested a few hours to learn how to work with Inkscape,
you would become much more efficient sooner.

At some point during my PhD I accepted that LaTeX is not the right tool for
graphical work. Stubbornly I was still texing my slides with Beamer, but half
their content was figures prepared in Inkscape.

~~~
jessaustin
_...weird baseline._

Is that caused by the tails of the letters "y" and "p"? The one box that
doesn't have a tailed letter, "base", looks fine. There should be a way to
tell the system to use the normal font baseline instead of something it can
figure out geometrically.

~~~
rerx
I'm sure there is a way to tell TikZ about that.

In Inkscape you would just shift-click all words and click the baseline icon
in the align-and-distribute panel.

The thing with preparing figures is that you want to iterate rapidly on small
changes. That works so much better without a mental context switch between
code and result and without having to wait for the compilation to finish
(significant if the figure is embedded in a large document).

If you had to prepare hundreds of very similar diagrams that all need to look
great, then I could understand the point of using TikZ for such a job.

Typesetting document text is different because LaTeX does a great job _by
default_.

------
throwawaymath
I wish I had known about this when I was writing my dissertation.

This looks reasonably complete for a lot of the mathematical diagrams in
cryptography. It would be nice if the supersingular isogeny support included
more diagrams than just the Diffie Hellman key exchange protocol, but they’re
a relatively recent are of study so it makes sense. But there are a lot of
isogeny diagrams (such as endomorphisms, volcanoes and random walks) beyond
SIDH.

For example, Luca De Feo’s 2017 article on isogeny mathematics in cryptography
[1] (pages 10,11,13,18,21,27,28,32,35) and the 2011 Feo-Jao-Plut paper
introducing isogeny key exchange [2] (pages 4,6,8,9,10) both have very
beautiful, full-color diagrams to walk through very complex concepts. Luca De
Feo has a tendency to put the TeX of his papers and slides on GitHub [3], so
I’ve reused some of his diagrammatic code before :). I recall spending hours
on some diagrams to make them look as nice as these.

Lattice-based constructions sometimes need good diagrammatic code as well, but
thankfully you can mostly get by without it (even though lattice depictions
can be pretty, as one of De Feo’s GitHub packages shows) - for instance, note
the relative lack of diagrams in Peikert’s well-known survey on lattice
cryptography [4].

____________________

1\. [https://arxiv.org/abs/1711.04062](https://arxiv.org/abs/1711.04062)

2\.
[https://eprint.iacr.org/2011/506.pdf](https://eprint.iacr.org/2011/506.pdf)

3\. [https://github.com/defeo](https://github.com/defeo)

4\. [https://web.eecs.umich.edu/~cpeikert/pubs/lattice-
survey.pdf](https://web.eecs.umich.edu/~cpeikert/pubs/lattice-survey.pdf)

------
mrb
There is a great selection of examples of TikZ at
[http://www.texample.net/tikz/examples/](http://www.texample.net/tikz/examples/)

------
chj
When I first saw TikZ code, I can't imagine how it could possibly work.
Mystically beautiful.

~~~
VMG
The versatility stuns me to this day
[http://www.texample.net/tikz/examples/all/](http://www.texample.net/tikz/examples/all/)

------
steventhedev
Is the code that powers this open source? It would be useful to collect
snippets for other fields

~~~
maxnoe
Yes, and it has a documentation counting > 1000 pages:

[https://ctan.org/pkg/pgf](https://ctan.org/pkg/pgf)
[https://sourceforge.net/projects/pgf/](https://sourceforge.net/projects/pgf/)

~~~
steventhedev
I meant the code for the site, not TikZ/PGF

