Skip to content

Commit

Permalink
Merge pull request #99 from neilt/fix_graphviz_latexml
Browse files Browse the repository at this point in the history
Fix graphviz dot files not building with LaTeXML
  • Loading branch information
neilt authored Nov 26, 2024
2 parents 2b4c2b2 + f6a03fa commit 6891811
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 36 deletions.
9 changes: 9 additions & 0 deletions ledgersmb-book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
96 changes: 60 additions & 36 deletions part-customization.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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''
Expand All @@ -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
Expand Down
19 changes: 19 additions & 0 deletions wf1.dot
Original file line number Diff line number Diff line change
@@ -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"];

}
11 changes: 11 additions & 0 deletions wf2.dot
Original file line number Diff line number Diff line change
@@ -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"]
}
}

0 comments on commit 6891811

Please sign in to comment.