Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Complete and reformat conditionals.rst truth table #127

Closed
wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 22, 2020

Addresses #117

UPDATE: This PR was updated based on comments in the original issue asking that the table use don't care entries to collapse the table. Current version generates a table without images or emojis.

image

@ghost
Copy link
Author

ghost commented May 22, 2020

If you prefer it without the unicode chars I can revert that and put it back to X's.

It's hard to say how it'll look once published on your site, but the preview seems a little loud compared to the rest of the content:

image

UPDATED: After most recent commit the table is collapsed:

image

Use don't care entries to collapse the truth table in
conditionals.rst
@ghost
Copy link
Author

ghost commented May 26, 2020

The build failed on both attempts. I've seen this problem before when using unicode characters when Latex is involved. Unless someone knows how to work around this (I tried in the past for my own work and was unsuccessful) I'll switch back to 1's and 0's

! Package ucs Error: Unknown Unicode character 10060 = U+274C,
3220(ucs)                possibly declared in uni-39.def.
3221(ucs)                Type H to see if it is available with options.
3222
3223See the ucs package documentation for explanation.
3224Type  H <return>  for immediate help.
3225 ...                                              

The table would look like this if it used 1=valid, 0=invalid, X=don't care:

image

This would probably require a legend

@karenetheridge
Copy link
Member

googling tells me that only some latex implementations, not all, support unicode character embedding. Generally you need to use a code instead of the literal character, like you would for embedding non-ascii chars in html.

@ghost
Copy link
Author

ghost commented May 29, 2020

Update: Latest commit removes the symbols and just uses 1, 0, and x for valid, invalid, and don't care.

HTML Output looks like this:

image

PDF Output looks like this:

image

@ghost
Copy link
Author

ghost commented May 29, 2020

I see that there are svg files for pass/fail used in this doc and elsewhere. They might be suitable for the table. I'll take one more pass at this with the images.

@ghost
Copy link
Author

ghost commented May 29, 2020

Ok, I give up. I tried with the svg's and they work fine for html but aren't liked by latex. Looks like if you want images in the truth table you probably need to write some python or know sphinx/resturctured text (which I don't). Otherwise, you can just accept the text based table for now.

For the record the svgs would look nice if you can solve the problem of Latex (as they match the example icons):

image

Here's how I did it (which might be unacceptable because it fixes the sizes of the images)

.. |fail| image:: ../_static/fail.svg
    :width: 20pt
    :height: 20pt

.. |pass| image:: ../_static/pass.svg
    :width: 20pt
    :height: 20pt

====== ====== ====== ============
if     then   else   whole schema
====== ====== ====== ============
|fail|        |fail| |fail|
|fail|        |pass| |pass|
|pass| |fail|        |fail|
|pass| |pass|        |pass|
====== ====== ====== ============

@rupertchen
Copy link

@mdboom , as one of the last people to merge PRs in this repo, are you able to take a look at this one? Is there anything others could do to help?

@jdesrosiers
Copy link
Member

I was fixing another bug on the conditionals page and noticed the table wrong and fixed that as well. After merging today, I noticed this PR. I'm going to close this as fixed by #143. I used simple text for the symbols. If anyone wants to do something prettier, please open a new PR.

@michaelgwelch
Copy link

ghost is actually me. I had two accounts (one for work and one for personal). I deleted my work one and consolidated everything under personal. Glad to see this closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants