Giter Site home page Giter Site logo

2pi / karnaugh-map Goto Github PK

View Code? Open in Web Editor NEW
55.0 4.0 12.0 554 KB

LaTeX package for drawing karnaugh maps with up to 6 variables

Home Page: https://www.ctan.org/pkg/karnaugh-map

TeX 98.23% Shell 1.77%
karnaugh-map latex karnaugh pgf variable-entered-map

karnaugh-map's People

Contributors

2pi avatar dettorer avatar oscargus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

karnaugh-map's Issues

FeatureRequest: specify colors of implicants

Hello, I want to reuse the color as you can see here for every \implicant another color will be used:
2020-02-29_21-45
green should be red also yellow and blue should be green since I want to create a DNF which is green and a KNF which is red so I can memorize it easier for me.
Would it be possible something like \implicant{}{}{}{} where another two {} will be another implicant but with the same color?

\newcount misplaced

The code of the package has several \newcount commands buried in definitions, which means that a whole new lot is allocated. For instance in a log file I read

\@karnaughmap@local@northwest@=\count295
\@karnaughmap@local@southeast@=\count296
\@karnaughmap@local@northwest@=\count297
\@karnaughmap@local@southeast@=\count298

and this will be replicated with new numbers at each call of the environment.

The correct programming style is to declare the counters at the outer level and then to set them to zero when needed. So all the \newcount declaration should go, say, at the beginning of the .sty file and the present \newcount<cs> instructions should become

\@karnaughmap@local@northwest@=\z@

and so on.

Name of output variable

It would be nice if one can state the name of the variable for which the Karnaugh map is drawn. Personally, I'm used to bottom right corner as

_|/
 / f

But I've seen other alternatives as well.

Support for more templates

Support for more templates will be nice to have.
For example, 8x4x1 maps are frequently used for 5 variable K-maps. I don't see anything blocking support for them.
Custom template specifications would be helpful in the long run.

I'll take a look and open a PR if I can.

Resulting equation

It is sometimes useful to write the resulting equation below the Karnaugh map. This can of course be done externally, but on the other hand, all the information required is already entered (implicants and variable names).

As an added bonus: each term can be colored as the corresponding implicant.

Second bonus: arrow from each term to the corresponding implicant.

FeatureRequest: Support for different indexing method for implicants

Currently the only way to index cells in the \implicant command is via the number value the cell has, that is sometimes rather counter-intuitive, since KV maps are numbered in a non-standard way. I propose a way of indexing the cells based on the x/y-Positions within the grid.

Example: Drawing an implicant from top right to bottom left on a 4x4 grid.

Current implementation: Type \implicant{0}{10}.

Problem: The indexing is counterintuitive, since you constantly have to calculate, which value corresponds to which cell.

Proposal: Index the grid from [0, 0] in the top left corner to [3, 3] in the bottom right. The above example could then be simplified to \implicant{0,0}{3,3}, which is more intuitive, since it is related to the cells position, not its index value. This is also just a syntax i thought of, it could be implemented differently.

Overlapping symbols with \autoterms

When using \autoterms in two successive k-maps, some cells have both a value and a - marking overlaid in them.

A small working example is below:

\documentclass{article}
\usepackage{karnaugh-map}

\begin{document}


    \begin{karnaugh-map}[2][2][1]
      \minterms{2}
      \maxterms{0, 1}
      \autoterms
    \end{karnaugh-map}

  \begin{karnaugh-map}[2][2][1]
    \minterms{0,1}
    \maxterms{3}
    \autoterms
  \end{karnaugh-map}

\end{document}

Inconsistent colouring of implicants

I created a Karnaugh map with six variables. The map does look nice, but it is difficult to recognize implicants which span more than one sub-map.

Example: one implicant covers minterms 38, 39, 46, 47 in sub-map [2] and minterms 54, 55, 62, 63 in sub-map [3]. I would expect that all cells share the same color, unless they are covered by more than one implicant. But the cells in map [2] are shown in pink and the cells in map [3] in lavender.

Request: Improve documentation about `\implicantedge`

I have had major headaches trying to understand the documentation of \implicantedge when working on a 4x2 Karnaugh map. I was trying to make a 2x1 implicant across the edge, and i was seriously struggling. I tried doing \implicantedge{0}{2} and \implicantedge{0}{2}{0}{2}, but neither worked. The only one that worked was \implicantedge{0}{0}{2}{2}.

My request is to show an example about a 2x1 (horizontal) and a 1x2 (vertical) implicantedge examples.
My second request is to add a section with common issues, the first being the order of operations. Some commands only work if the cell has not been filled. I also struggled a lot with this.

Support for tikzexternal

After including the package with \usepackage{karnaugh-map}, even an empty environment like \begin{karnaugh-map}\end{karnaugh-map} results in an error:

! File ended while scanning use of \tikzexternal@laTeX@collect@until@end@tikzpicture.
<inserted text> 
                \par 
<*> d:/Projects/LabPEl/E-51/E-51.tex
                                    
! Emergency stop.
<*> d:/Projects/LabPEl/E-51/E-51.tex
                                    
!  ==> Fatal error occurred, no output PDF file produced!

Position of input variables

Just found this excellent package and will post some improvement suggestions. One issue for each for simpler tracking.

I'm used to write the variables in the top left corner as

 \cd
  \
ab \

(Ugly image, but I think you get the idea, it is how it was done in the StackExchange code which I used earlier.)

It would be nice if this was optional in some way.

FeatureRequest: colour-blind compatible way to visually differentiate between implicants

This package produces beautiful visuals for karnaugh maps and the automatic colors for implicants greatly help learners with identification, especially for maps with more than 4 inputs, I use it to make corrections for my lessons.

I just realized though this approach won't work for colour-blind people, maybe we can make the outline of the implicants use different line styles (dotted, dashed, waved, โ€ฆ)?

\autoterms overrides everything after first filles cell

\autoterms overrides everything after the first filled cell. It fills everything with specified (or default) character except the first cell that was not empty. For example:

\begin{karnaugh-map}
  \minterms{2, 6, 9, 11, 13, 15}
  \autoterms[0]
\end{karnaugh-map}

In this example my pdf output shows 0s in every cell except cell 2. And in cells 6, 9, 11, 13 and 15 there are both 0 and 1 on top of each other.

EDIT: It appears this only happens it you put spaces after the commas in the minterms. It works fine with \minterms{2,6,9,11,13,15}.

No way to scale

Some way to scale the outputted tikzpictures (or style hooks in general) would be very useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.