From f6a03fa84427232aaa9185cd78be6305d9cf9414 Mon Sep 17 00:00:00 2001 From: neiltiffin Date: Sat, 23 Nov 2024 07:09:17 -0600 Subject: [PATCH] Fix graphviz dot files not building with LaTeXML --- ledgersmb-book.tex | 9 ++++ part-customization.tex | 96 ++++++++++++++++++++++++++---------------- wf1.dot | 19 +++++++++ wf2.dot | 11 +++++ 4 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 wf1.dot create mode 100644 wf2.dot diff --git a/ledgersmb-book.tex b/ledgersmb-book.tex index d8b9d97..f0237a8 100644 --- a/ledgersmb-book.tex +++ b/ledgersmb-book.tex @@ -65,11 +65,20 @@ \newcommand{\graphicswidth}{0.8\textwidth} \newcommand{\autoscreenshotdir}{auto-screenshots} +% Required to allow LaTeXML to handle graphviz +\usepackage{ifpdf} + % For use of next line in description list \usepackage{enumitem} \setlist[description]{style=nextline} +\ifpdf +% LaTeXML does not work with graphviz +% So we have to workaround that by only generating dot files when producing +% pdf files. The dot files are in the repository and if they need to be regenerated +% then they need to be deleted and regnerated by producing a new book pdf. \usepackage[pdf]{graphviz} +\fi % For fixing the postition of figures using H \usepackage{float} diff --git a/part-customization.tex b/part-customization.tex index 992c889..103d7b7 100644 --- a/part-customization.tex +++ b/part-customization.tex @@ -59,29 +59,41 @@ \section{Workflow configuration} will be \texttt{posted}. E-mailing an invoice does not change its state: it remains posted. Instead, a new workflow is created which manages state of the e-mail. -\begin{figure} -\digraph[scale=0.4]{wf1}{ - rankdir=LR; - subgraph invoice { - graph [label="Invoice"]; - cluster = true; - saved -> posted [label="post"]; - posted -> reversed [label="reverse"]; - }; - - subgraph email { - graph [label="email"]; - cluster = true; - created -> sent [label="send"]; - }; - - posted -> created [label="e-mail"]; - posted -> posted [label="e-mail"]; - + \IfFileExists{./wf1.pdf}{ + \begin{figure}[H] + \centering + % \includegraphics[width=0.8\textwidth]{dmc-create-step1.png} + % HTML processing does not handle cropping of this image, need to figure out why? + % \includegraphics[width=\graphicswidth, trim={0pt 50 0 0}, clip]{\autoscreenshotdir/setup-pl-login.png} + \includegraphics[width=\graphicswidth]{wf1.pdf} + \caption{Workflow triggered from another workflow} + \label{fig:triggered-workflow} + \end{figure} +}{ + \begin{figure} + \digraph[scale=0.4]{wf1}{ + rankdir=LR; + subgraph invoice { + graph [label="Invoice"]; + cluster = true; + saved -> posted [label="post"]; + posted -> reversed [label="reverse"]; + }; + + subgraph email { + graph [label="email"]; + cluster = true; + created -> sent [label="send"]; + }; + + posted -> created [label="e-mail"]; + posted -> posted [label="e-mail"]; + + } + \caption{Workflow triggered from another workflow} + \label{fig:triggered-workflow} + \end{figure} } -\caption{Workflow triggered from another workflow} -\label{fig:triggered-workflow} -\end{figure} Actions belonging to a state may (or may not) be available. This is determined by one or more conditions. Examples are ``is the posting date of the transaction in a closed period'' @@ -103,21 +115,33 @@ \section{Workflow configuration} By adding a condition on this action, it can be made required for invoices over 100.000 USD (but not for other invoices). -\begin{figure} -\digraph[scale=0.4]{wf2}{ - rankdir=LR; - subgraph invoice { - graph [label="Invoice"]; - cluster=true; - saved -> posted [label="post (<100.000)"]; - saved -> submitted [label="submit (>100.000)"]; - submitted -> posted [label="post"]; - posted -> reversed [label="reverse"] - } +\IfFileExists{./wf2.pdf}{ + \begin{figure}[H] + \centering + % \includegraphics[width=0.8\textwidth]{dmc-create-step1.png} + % HTML processing does not handle cropping of this image, need to figure out why? + % \includegraphics[width=\graphicswidth, trim={0pt 50 0 0}, clip]{\autoscreenshotdir/setup-pl-login.png} + \includegraphics[width=\graphicswidth]{wf2.pdf} + \caption{Conditional workflow actions} + \label{fig:conditional-workflows} + \end{figure} +}{ + \begin{figure} + \digraph[scale=0.4]{wf2}{ + rankdir=LR; + subgraph invoice { + graph [label="Invoice"]; + cluster=true; + saved -> posted [label="post (<100.000)"]; + saved -> submitted [label="submit (>100.000)"]; + submitted -> posted [label="post"]; + posted -> reversed [label="reverse"] + } + } + \caption{Conditional workflow actions} + \label{fig:conditional-workflows} + \end{figure} } -\caption{Conditional workflow actions} -\label{fig:conditional-workflows} -\end{figure} By changing association of the \texttt{save} action with its code, the application will act differently when saving the invoice. Customizations may associate new behaviors with existing diff --git a/wf1.dot b/wf1.dot new file mode 100644 index 0000000..44d14bd --- /dev/null +++ b/wf1.dot @@ -0,0 +1,19 @@ +digraph wf1 { +rankdir=LR; +subgraph invoice { +graph [label="Invoice"]; +cluster = true; +saved -> posted [label="post"]; +posted -> reversed [label="reverse"]; +}; + +subgraph email { +graph [label="email"]; +cluster = true; +created -> sent [label="send"]; +}; + +posted -> created [label="e-mail"]; +posted -> posted [label="e-mail"]; + +} diff --git a/wf2.dot b/wf2.dot new file mode 100644 index 0000000..2a1134f --- /dev/null +++ b/wf2.dot @@ -0,0 +1,11 @@ +digraph wf2 { +rankdir=LR; +subgraph invoice { +graph [label="Invoice"]; +cluster=true; +saved -> posted [label="post (<100.000)"]; +saved -> submitted [label="submit (>100.000)"]; +submitted -> posted [label="post"]; +posted -> reversed [label="reverse"] +} +}