summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-02-21 00:25:33 +0000
committerKarl Berry <karl@freefriends.org>2017-02-21 00:25:33 +0000
commit412da490d9754458e0cb477df83c2eb5c37d44d0 (patch)
treea2a30836e356b151be53b3bbc039e7cce0987f1e
parenta50c2b65438f2654a3024426b92803035c9ae871 (diff)
karnaugh-map (20feb17)
git-svn-id: svn://tug.org/texlive/trunk@43271 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/karnaugh-map/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/karnaugh-map/example.pngbin7478 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/karnaugh-map/karnaugh-map.pdfbin226034 -> 241232 bytes
-rw-r--r--Master/texmf-dist/source/latex/karnaugh-map/karnaugh-map.dtx120
-rw-r--r--Master/texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty32
5 files changed, 108 insertions, 46 deletions
diff --git a/Master/texmf-dist/doc/latex/karnaugh-map/README.md b/Master/texmf-dist/doc/latex/karnaugh-map/README.md
index 448d8fb7dfa..6203d1f32d0 100644
--- a/Master/texmf-dist/doc/latex/karnaugh-map/README.md
+++ b/Master/texmf-dist/doc/latex/karnaugh-map/README.md
@@ -18,4 +18,4 @@ Last but not least it contains commands for drawing implicants on top of the map
The karnaugh-map package source is hosted at [https://github.com/2pi/karnaugh-map](https://github.com/2pi/karnaugh-map) as well as the [bugtracker](https://github.com/2pi/karnaugh-map/issues).
## License
-This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/).
+This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). Contributors include [Oscar Gustafsson](https://github.com/oscargus).
diff --git a/Master/texmf-dist/doc/latex/karnaugh-map/example.png b/Master/texmf-dist/doc/latex/karnaugh-map/example.png
deleted file mode 100644
index a9b6724d317..00000000000
--- a/Master/texmf-dist/doc/latex/karnaugh-map/example.png
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/karnaugh-map/karnaugh-map.pdf b/Master/texmf-dist/doc/latex/karnaugh-map/karnaugh-map.pdf
index 5395f17164d..472e5a65d62 100644
--- a/Master/texmf-dist/doc/latex/karnaugh-map/karnaugh-map.pdf
+++ b/Master/texmf-dist/doc/latex/karnaugh-map/karnaugh-map.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/karnaugh-map/karnaugh-map.dtx b/Master/texmf-dist/source/latex/karnaugh-map/karnaugh-map.dtx
index b60fd4fd07d..c097998717a 100644
--- a/Master/texmf-dist/source/latex/karnaugh-map/karnaugh-map.dtx
+++ b/Master/texmf-dist/source/latex/karnaugh-map/karnaugh-map.dtx
@@ -1,18 +1,18 @@
% \iffalse meta-comment
-% Copyright (C) 2015 by Mattias Jacobsson
-% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/).
+% Copyright (C) 2015, 2016, 2017 Mattias Jacobsson and contributors
+% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). Contributors include [Oscar Gustafsson](https://github.com/oscargus).
% \fi
%
% \iffalse
%
%<package>
%<package>%%
-%<package>%% Copyright (C) 2015 by Mattias Jacobsson
-%<package>%% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/).
+%<package>%% Copyright (C) 2015, 2016, 2017 Mattias Jacobsson and contributors
+%<package>%% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). Contributors include [Oscar Gustafsson](https://github.com/oscargus).
%<package>%%
%<package>
%<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{karnaugh-map}[2015/10/09 v1.0 Draw Karnaugh Maps]
+%<package>\ProvidesPackage{karnaugh-map}[2017/02/20 v1.1 Draw Karnaugh Maps]
%
%<*driver>
\documentclass{ltxdoc}
@@ -22,13 +22,14 @@
\usepackage{float}% for documentation
\usepackage{hyperref}% for documentation
\setlength{\parindent}{0pt}
- \setlength{\parskip}{0.7em}
+ \setlength{\parskip}{0.6em}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\OnlyDescription
\begin{document}
\DocInput{karnaugh-map.dtx}
+ \PrintChanges
\end{document}
%</driver>
% \fi
@@ -531,14 +532,7 @@
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
- \foreach \cell in {#1} {%
- % only write to cell if it is empty otherwise fail silently
- \IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {-};
- }
- }
- % update \@karnaughmap@var@usedcells@
- \expandafter\def\expandafter\@karnaughmap@var@usedcells@\expandafter{\@karnaughmap@var@usedcells@#1,}
+ \terms{#1}{-}
}
% ^^A ##########################################################################
% ^^A ##########################################################################
@@ -549,7 +543,6 @@
% \fi
% \end{macro}
%
-% \newpage
% \begin{macro}{\manualterms}
% The |\manualterms| command fills the 0th cell with the first element in the argument, the 1st cell with the second element in the argument, and so on. If any of the cells already is filled, it is left as it was.
%
@@ -609,6 +602,7 @@
% \fi
% \end{macro}
%
+% \newpage
% \begin{macro}{\maxterms}
% The |\maxterms| command fills the specified cells with ''0'' if they aren't already filled. Order of the cell numbers does not matter.
%
@@ -638,14 +632,7 @@
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
- \foreach \cell in {#1} {%
- % only write to cell if it is empty otherwise fail silently
- \IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {0};
- }
- }
- % update \@karnaughmap@var@usedcells@
- \expandafter\def\expandafter\@karnaughmap@var@usedcells@\expandafter{\@karnaughmap@var@usedcells@#1,}
+ \terms{#1}{0}
}
% ^^A ##########################################################################
% ^^A ##########################################################################
@@ -685,10 +672,52 @@
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
+ \terms{#1}{1}
+}
+% ^^A ##########################################################################
+% ^^A ##########################################################################
+% ^^A #### /CODE ####
+% ^^A ##########################################################################
+% ^^A ##########################################################################
+% \end{macrocode}
+% \fi
+% \end{macro}
+%
+% \begin{macro}{\terms}
+% \changes{v1.1}{2017/02/06}{Support user specified term content and variable entered maps}
+% The |\terms| command fills the specified cells with the specified content if they aren't already filled. Order of the cell numbers does not matter.
+%
+% \textbf{Usage:}
+%
+% \begin{tabularx}{\textwidth}{l X}
+% \small{|\terms|} & \\
+% \small{\marg{cells}} & \small{Comma separated list of cells to fill with content} \\
+% \small{\marg{content}} & \small{Content to fill the cells with} \\
+% \end{tabularx}
+%
+% \textbf{Example:}
+%
+% Fill the top left and right cell with ''X''.
+% \begin{verbatim}
+%\begin{karnaugh-map}
+% \terms{0,2}{X}
+%\end{karnaugh-map}
+% \end{verbatim}
+% \iffalse code
+% \begin{macrocode}
+% ^^A ##########################################################################
+% ^^A ##########################################################################
+% ^^A #### CODE ####
+% ^^A ##########################################################################
+% ^^A ##########################################################################
+\DeclareDocumentCommand{\terms}{m m} {%
+ % bail if outside environment karnaugh-map
+ \@karnaughmap@func@bailoutsideenvironment@{}
+ %
\foreach \cell in {#1} {%
% only write to cell if it is empty otherwise fail silently
\IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {1};
+ \path (\@karnaughmap@func@decimaltobin@{\cell}) node {#2};
}
}
% update \@karnaughmap@var@usedcells@
@@ -1185,6 +1214,32 @@
% }
% \end{multicols}
%
+% \newpage
+% \begin{multicols}{2}
+% [Draw a variable entered map.]
+% \begin{verbatim}
+%\begin{karnaugh-map}[4][2][1][$ab$][$c$]
+% \maxterms{0,2,4,5,6}
+% \minterms{3}
+% \terms{1}{$d$}
+% \terms{7}{$d'$}
+% \implicant{1}{3}
+% \implicant{3}{7}
+%\end{karnaugh-map}
+% \end{verbatim}
+% \columnbreak
+% \resizebox{\columnwidth}{!}{
+% \begin{karnaugh-map}[4][2][1][$ab$][$c$]
+% \maxterms{0,2,4,5,6}
+% \minterms{3}
+% \terms{1}{$d$}
+% \terms{7}{$d'$}
+% \implicant{1}{3}
+% \implicant{3}{7}
+% \end{karnaugh-map}
+% }
+% \end{multicols}
+%
% \section{Dependencies}
% \begin{itemize}
% \item tikz
@@ -1192,5 +1247,20 @@
% \item xstring
% \end{itemize}
%
-% \PrintIndex
+% \newpage
+% \section{Miscellaneous}
+% \subsection*{Resizing}
+% The karnaugh maps produced with this package have a prespecified size which can not be changed. However you can resize the karnaugh map to your desired size. Resizing can be done using the |\resizebox| command from the graphicx package. Scaling the karnaugh map to fill the column width while preserving the aspect ratio can be done as follows.
+% \begin{verbatim}
+%\resizebox{\columnwidth}{!}{
+% \begin{karnaugh-map}
+% \end{karnaugh-map}
+%}
+% \end{verbatim}
+%
+% \subsection*{Comma separated lists}
+% Anywhere in this package where a comma separated list is used data should only be comma separated. Therefore a comma and space separeated list will for example \textit{not} work properly.
+%
+% An example of errorious usage related to the \small{\marg{cells}} parameter in the terms related commands can result in multiple zeros, ones and other terms overlapping in the same cell in the outputted karnaugh map.
+%
\endinput
diff --git a/Master/texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty b/Master/texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty
index 877cb0806bf..f4b4eb98eb4 100644
--- a/Master/texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty
+++ b/Master/texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty
@@ -10,12 +10,12 @@
%%
%%
-%% Copyright (C) 2015 by Mattias Jacobsson
-%% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/).
+%% Copyright (C) 2015, 2016, 2017 Mattias Jacobsson and contributors
+%% This work, karnaugh-map, is written from the ground up by Mattias Jacobsson. However the general implementation idea is based on the work published on [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com) by [Ignasi](https://tex.stackexchange.com/users/1952/ignasi) found [here](https://tex.stackexchange.com/a/140581) and [here](https://tex.stackexchange.com/a/36879) which is licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). karnaugh-map is therefore licensed under [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/). Contributors include [Oscar Gustafsson](https://github.com/oscargus).
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{karnaugh-map}[2015/10/09 v1.0 Draw Karnaugh Maps]
+\ProvidesPackage{karnaugh-map}[2017/02/20 v1.1 Draw Karnaugh Maps]
%%
%% Dependencies
@@ -313,14 +313,7 @@
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
- \foreach \cell in {#1} {%
- % only write to cell if it is empty otherwise fail silently
- \IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {-};
- }
- }
- % update \@karnaughmap@var@usedcells@
- \expandafter\def\expandafter\@karnaughmap@var@usedcells@\expandafter{\@karnaughmap@var@usedcells@#1,}
+ \terms{#1}{-}
}
\DeclareDocumentCommand{\manualterms}{m} {%
% bail if outside environment karnaugh-map
@@ -351,23 +344,22 @@
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
- \foreach \cell in {#1} {%
- % only write to cell if it is empty otherwise fail silently
- \IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {0};
- }
- }
- % update \@karnaughmap@var@usedcells@
- \expandafter\def\expandafter\@karnaughmap@var@usedcells@\expandafter{\@karnaughmap@var@usedcells@#1,}
+ \terms{#1}{0}
}
\DeclareDocumentCommand{\minterms}{m} {%
% bail if outside environment karnaugh-map
\@karnaughmap@func@bailoutsideenvironment@{}
%
+ \terms{#1}{1}
+}
+\DeclareDocumentCommand{\terms}{m m} {%
+ % bail if outside environment karnaugh-map
+ \@karnaughmap@func@bailoutsideenvironment@{}
+ %
\foreach \cell in {#1} {%
% only write to cell if it is empty otherwise fail silently
\IfSubStr{\@karnaughmap@var@usedcells@}{,\cell,}{}{%
- \path (\@karnaughmap@func@decimaltobin@{\cell}) node {1};
+ \path (\@karnaughmap@func@decimaltobin@{\cell}) node {#2};
}
}
% update \@karnaughmap@var@usedcells@