Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem with MathML.

How can I draw a line through a column (row and column at the same time) in a matrix?

An example in TEX: Draw a line through one column of a matrix

share|improve this question

closed as off topic by Jake, Alan Munn, Lev Bishop, Xavier, lockstep May 19 '13 at 8:33

Questions on TeX - LaTeX Stack Exchange are expected to relate to TeX, LaTeX or related typesetting systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Does MathML provide any tagging scheme for lines striking through row and column? –  CV Radhakrishnan Sep 16 '12 at 3:44
    
I found "verticalstrike" and "horizontalstrike", but I do not know how to use it with matrices. developer.mozilla.org/en-US/docs/MathML/Element/menclose –  Pan Sep 16 '12 at 9:23
    
Thanks, have given a try and provided an example. Does that sound good enough? –  CV Radhakrishnan Sep 16 '12 at 11:17
    
Yes, of course. –  Pan Sep 17 '12 at 8:39

1 Answer 1

The following code seems to work:

   \def\vs#1{\Tg<menclose notation="verticalstrike">#1\Tg</menclose>}
   \Css{.array mtd{padding-top: 0em; padding-bottom:0em;}}

   \begin{equation}
   \begin{pmatrix}
   \vs{a+b} & 12 & a+b+c\\
   \vs{c-d} & \gamma^2 & 0\\
   \vs{a}   & \alpha-\beta & abc\\
   \vs{c-d} & \psi_n & d\\
   \end{pmatrix}
   \end{equation}

If you have a working version of TeX4ht, you will get the following MathML output:

          <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"
          class="equation">
            <mfenced separators="" open="(" close=")">
              <mrow>
                <mtable style="text-align:axis;" equalrows="false"
                columnlines="none none none none none none none none none"
                equalcolumns="false" class="array">
                  <mtr>
                    <mtd class="array" columnalign="center">
                      <menclose notation="verticalstrike">
                        <mi>a</mi>
                        <mo class="MathClass-bin">+</mo>
                        <mi>b</mi>
                      </menclose>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mn>1</mn>
                      <mn>2</mn>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mi>a</mi>
                      <mo class="MathClass-bin">+</mo>
                      <mi>b</mi>
                      <mo class="MathClass-bin">+</mo>
                      <mi>c</mi>
                    </mtd>
                  </mtr>
                  <mtr>
                    <mtd class="array" columnalign="center">
                      <menclose notation="verticalstrike">
                        <mi>c</mi>
                        <mo class="MathClass-bin">-</mo>
                        <mi>d</mi>
                      </menclose>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <msup>
                        <mrow>
                          <mi>&#947;</mi>
                        </mrow>
                        <mrow>
                          <mn>2</mn>
                        </mrow>
                      </msup>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mn>0</mn>
                    </mtd>
                  </mtr>
                  <mtr>
                    <mtd class="array" columnalign="center">
                      <menclose notation="verticalstrike">
                        <mi>a</mi>
                      </menclose>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mi>&#945;</mi>
                      <mo class="MathClass-bin">-</mo>
                      <mi>&#946;</mi>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mi>a</mi>
                      <mi>b</mi>
                      <mi>c</mi>
                    </mtd>
                  </mtr>
                  <mtr>
                    <mtd class="array" columnalign="center">
                      <menclose notation="verticalstrike">
                        <mi>c</mi>
                        <mo class="MathClass-bin">-</mo>
                        <mi>d</mi>
                      </menclose>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <msub>
                        <mrow>
                          <mi>&#968;</mi>
                        </mrow>
                        <mrow>
                          <mi>n</mi>
                        </mrow>
                      </msub>
                    </mtd>
                    <mtd class="array" columnalign="center">
                      <mi>d</mi>
                    </mtd>
                  </mtr>
                  <mtr>
                    <mtd class="array" columnalign="center"></mtd>
                  </mtr>
                </mtable>
              </mrow>
            </mfenced>
          </math>

The above MathML rendered in Firefox as here

share|improve this answer
    
I tested it: s1.directupload.net/images/120916/vmbhchy5.png –  Pan Sep 16 '12 at 17:29
    
Haven't you provided the \Css directive? Without suppressing top and bottom padding of <td> contents in the matrix array, the vertical rule will be broken across rows as in your example. Can you please confirm this? –  CV Radhakrishnan Sep 17 '12 at 0:57
    
A test with CSS-code "mtd{padding-top: 0em; padding-bottom:0em;}": s14.directupload.net/images/120917/qawbh7uj.png The exponents break the line. –  Pan Sep 17 '12 at 8:38
    
I am clueless, can you please take a look at: download.river-valley.com/misc/sx4.html ? –  CV Radhakrishnan Sep 17 '12 at 9:21
    
And screenshot of the page as rendered in my browser is at download.river-valley.com/misc/vs.png –  CV Radhakrishnan Sep 17 '12 at 9:22

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