TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would be the best solution to make pgf-umlsd and externalize compatible?

The latter expects \end{tikzpicture} which is "hidden" within sequencediagram environment the first provides. I guess I could convert beginning and the ending of the environment into two commands explicitly invoked at the beginning and ending of the tikzpicture environment meant to be sequence diagram, but it wouldn't survive pgf-umlsd.sty update (i.e. changing environment definition), requiring copy-paste to be redone.

Is there any clever way to solve this problem with as minimal effort as possible and avoiding any copy-pasting?

Should the package author be convinced to provide some begin-like and end-like commands for use within tikzpicture environment?

% uncommenting above line gives following error:
% ! File ended while scanning use of \tikzexternal@laTeX@collect@until@end@tikzpicture.

Output of the above document

Let's assume for a moment that author provides three macros (or: we changed pgf-umlsd.sty ourselves):

  • \sdinit - layers declaration, required before starting tikzpicture
  • \sdbegin - sequence diagram header for use at the beginning of tikzpicture
  • \sdend - sequence diagram footer for use at the end of tikzpicture

Modifying above listing to use them:


makes externalize happy, but the output is different.

Output of the modified document

Right part of the rightmost box shadow disappeared. Why? What would be the best way to fix it?

share|improve this question

closed as unclear what you're asking by Paul Gessler, Svend Tveskæg, Guido, moewe, Mico Jan 13 '15 at 6:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Bonus question: Why the diagram is not in the middle of the page? What I have forgot about? – przemoc Feb 16 '13 at 23:42
Crippled shadow problem is related to a bounding box not covering all TikZ drawings. See TikZ External: Figure gets cropped. In this case adding \useasboundingbox ([shift={(0.2,0)}]current bounding box.east); before ending tikzpicture environment solves the problem. (I used 0.2 because it's a value used internally in pgf-umlsd as the offset of the first box, thus I get external PDF with symmetrical margins.) – przemoc Feb 17 '13 at 11:43
To your bonus question: use \begin{figure}\centering\begin{tikzpicture/sequencediagram}...\end{tikzpicture/‌​sequencediagram}\end{figure} – LaRiFaRi Jul 26 '13 at 17:43
@przemoc Self answering a question is good. Can you provide an answer, if you have solved the problem? Otherwise, please update the question. – egreg Dec 7 '13 at 21:14
@przemoc have you considered writing an answer? – Paul Gessler Aug 19 '14 at 1:51