TableForm[BooleanTable[{a0,a1,a2,a3,f3},{a0,a1,a2,a3}],TableHeadings->{None,{Subscript[a, 0],Subscript[a, 1],Subscript[a, 2],Subscript[a, 3],Subscript[b, 3]}},TableAlignments->Center]

I used these code to generate a truth table, but how to convert the output to an image? I have tried Export["f3.png",mytable],but it is not the same as the out[84], so how to export an image like the same as original output? enter image description here

  • 1
    $\begingroup$ Export["f3.png", Rasterize@mytable]? $\endgroup$ – kglr Dec 3 '18 at 7:49
  • $\begingroup$ Please show us the complete code text. $\endgroup$ – xzczd Dec 3 '18 at 7:50
TableForm[BooleanTable[{a0, a1, a2, a3, f3}, {a0, a1, a2, a3}], 
  TableHeadings -> {None, {Subscript[a, 0], Subscript[a, 1], 
     Subscript[a, 2], Subscript[a, 3], Subscript[b, 3]}}, 
  TableAlignments -> Center] // Rasterize

Try the following. First add the row of titles to your table:

    tab = Join[{{Subscript[a, 0], Subscript[a, 1], Subscript[a, 2], 
    Subscript[a, 3], Subscript[b, 3]}}, 
  BooleanTable[{a0, a1, a2, a3, f3}, {a0, a1, a2, a3}]]

Then let us make an image out of it:

    Rasterize[GraphicsGrid[tab, ItemAspectRatio -> 0.5, 
Dividers -> {False, 2 -> True}], RasterSize -> 800, ImageSize -> 400]

Here I show a part of it:

enter image description here

You can play with the parameters: ItemAspectRatio, RasterSize and ImageSize to achieve the desired size and general view of the table.

You can, further, select the result, fo to Menu/File/SaveSelectionAs and save it in one of the graphics formats. Alternatively, you can export it as a graphics file.

Have fun!

  • $\begingroup$ Almost done, but the column in b3 should be the result of b3, you still did well, thank you. $\endgroup$ – 余星佑 Dec 5 '18 at 11:02
  • $\begingroup$ I give an idea, and all the rest is up to you. $\endgroup$ – Alexei Boulbitch Dec 5 '18 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.