Is there an "easy" way to cross the row in a matrix with a line? I am trying to demonstrate to my students how to type in LaTeX their homework assignment on Boolean function. The below table is used during the construction of normal conjunctive and disjunctive form of a Boolean function. This is a "hand" made example.

example table how it should look like

  • I understand the question, but could you clarify the motivation? It seems to have become garbled... – qubyte Jan 29 '12 at 5:50
  • @Mark In order to construct normal form for Boolean function you cross the rows with output zero and then use rows with output 1 to construct the function. For example in first row which is not crossed you have 0 under p, 0 under q and 1 under r so the form for that row is \lnot p \wedge \lnot q \wedge r. Then you want to \vee that expression with expressions for two other raws which have output 1. I just want to use TeX to cross o output raws in the same fashion I did it by hand. – Predrag Punosevac Jan 29 '12 at 6:14
  • 2
    I think you misunderstood me. I understand the question, but the text is actually garbled. The second sentence is the problem. – qubyte Jan 29 '12 at 7:46
  • @Mark I wonder what was in my head when I typed that nonsense. Thank you so much for pointing the mistake!!! You should have immediately edited question yourself. – Predrag Punosevac Jan 29 '12 at 15:11
  • 1
    It's possible to do the full monty here and implement the entire matrix in TikZ, thus giving full access to all the entries as nodes. See tex.stackexchange.com/q/26866/86 for details. – Andrew Stacey Jan 29 '12 at 17:26

You can use tikz for this. Probably not the finest answer possible, but works for me:

\newcommand{\pmark}[1]{\begin{tikzpicture}[overlay,remember picture]\node(#1)at (-1em,.7ex){};\end{tikzpicture}}
\newcommand{\smark}[1]{\begin{tikzpicture}[overlay,remember picture]\draw(#1)--(0,.7ex);\end{tikzpicture}}
$f=\overline{a}\wedge\overline{b}\wedge c\wedge+\dots$
| improve this answer | |
  • Yeap, it sure does! Actually you did even better. Your code provides means of controlling the length and the position of the line so that one can cross arbitrary number of entries in the line. I am guessing it could be even modified for crossing columns (I have no idea why that would be useful). – Predrag Punosevac Jan 29 '12 at 15:07

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.