Skip to content

Commit 65d9962

Browse files
committed
take \tikzpicture out of karnaugh-map environment
This allows the user to place their own tikzpicture environment around the karnaugh-map-inner environment, which makes the package compatible with tikz externalization.
1 parent 15b844f commit 65d9962

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

karnaugh-map.dtx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,17 @@
329329
% ^^A ##########################################################################
330330
% ^^A ##########################################################################
331331
\NewDocumentEnvironment{karnaugh-map}{D(){} s O{4} O{4} O{1}} {%
332+
\begin{tikzpicture}
333+
\IfBooleanTF{#2}{%
334+
\begin{karnaugh-map-inner}(#1)*[#3][#4][#5]%
335+
}{%
336+
\begin{karnaugh-map-inner}(#1)[#3][#4][#5]%
337+
}
338+
}{%
339+
\end{karnaugh-map-inner}
340+
\end{tikzpicture}
341+
}
342+
\NewDocumentEnvironment{karnaugh-map-inner}{D(){} s O{4} O{4} O{1}} {%
332343
\begingroup
333344
% parse environment options
334345
\setkeys{karnaugh-map}{#1}%
@@ -366,7 +377,6 @@
366377
% to parse remaining arguments and finish initialization.
367378
\@karnaughmap@func@karnaughstart@%
368379
}{
369-
\end{tikzpicture}
370380
\endgroup
371381
}
372382
\DeclareDocumentCommand{\@karnaughmap@func@karnaughstart@}{oooooo} {%
@@ -564,14 +574,14 @@
564574
Existing templates have the following dimensions: 2x2x1, 2x4x1, 4x2x1, 4x4x1, 4x4x2, and 4x4x4.
565575
}%
566576
\fi
567-
\begin{tikzpicture}[
577+
\tikzset{
568578
LineStyleA/.style={semithick,solid},
569579
LineStyleB/.style={semithick,dash dot dot},
570580
LineStyleC/.style={thin,double distance=0.8pt},
571581
LineStyleD/.style={ultra thick},
572582
LineStyleE/.style={semithick,dashed},
573583
LineStyleF/.style={semithick,densely dotted},
574-
]
584+
}
575585
% grid {[START]
576586
% for all dimensions
577587
\draw[color=black, ultra thin] (0,0) grid (\@karnaughmap@var@mapsizex@,\@karnaughmap@var@mapsizey@);

0 commit comments

Comments
 (0)