Ms writer: Use @ instead of | for inline math delimiter.

The `|` delimiter had a bad interaction with tbl.
See discussion in #1839.
This commit is contained in:
John MacFarlane 2017-03-26 16:59:38 +02:00
parent 1b967d9036
commit e30d2c700a
4 changed files with 91 additions and 91 deletions

View file

@ -56,7 +56,7 @@ $else$
$endif$ $endif$
$if(has-inline-math)$ $if(has-inline-math)$
.EQ .EQ
delim || delim @@
.EN .EN
$endif$ $endif$
$if(title)$ $if(title)$

View file

@ -297,7 +297,7 @@ blockToMs opts (Table caption alignments widths headers rows) =
alignments iwidths) ++ "." alignments iwidths) ++ "."
colheadings <- mapM (blockListToMs opts) headers colheadings <- mapM (blockListToMs opts) headers
let makeRow cols = text "T{" $$ let makeRow cols = text "T{" $$
(vcat $ intersperse (text "T}@T{") cols) $$ (vcat $ intersperse (text "T}\tT{") cols) $$
text "T}" text "T}"
let colheadings' = if all null headers let colheadings' = if all null headers
then empty then empty
@ -307,7 +307,7 @@ blockToMs opts (Table caption alignments widths headers rows) =
return $ makeRow cols) rows return $ makeRow cols) rows
setFirstPara setFirstPara
return $ text ".PP" $$ caption' $$ return $ text ".PP" $$ caption' $$
text ".TS" $$ text "tab(@);" $$ coldescriptions $$ text ".TS" $$ text "delim(@@) tab(\t);" $$ coldescriptions $$
colheadings' $$ vcat body $$ text ".TE" colheadings' $$ vcat body $$ text ".TE"
blockToMs opts (BulletList items) = do blockToMs opts (BulletList items) = do
@ -453,7 +453,7 @@ inlineToMs opts (Math InlineMath str) = do
res <- convertMath writeEqn InlineMath str res <- convertMath writeEqn InlineMath str
case res of case res of
Left il -> inlineToMs opts il Left il -> inlineToMs opts il
Right r -> return $ text "|" <> text (escapeBar r) <> text "|" Right r -> return $ text "@" <> text (escapeBar r) <> text "@"
inlineToMs opts (Math DisplayMath str) = do inlineToMs opts (Math DisplayMath str) = do
res <- convertMath writeEqn InlineMath str res <- convertMath writeEqn InlineMath str
case res of case res of

View file

@ -3,43 +3,43 @@ Simple table with caption:
.PP .PP
Demonstration of simple table syntax. Demonstration of simple table syntax.
.TS .TS
tab(@); delim(@@) tab( );
r l c l. r l c l.
T{ T{
Right Right
T}@T{ T} T{
Left Left
T}@T{ T} T{
Center Center
T}@T{ T} T{
Default Default
T} T}
_ _
T{ T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T} T}
T{ T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T} T}
T{ T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T} T}
.TE .TE
@ -47,43 +47,43 @@ T}
Simple table without caption: Simple table without caption:
.PP .PP
.TS .TS
tab(@); delim(@@) tab( );
r l c l. r l c l.
T{ T{
Right Right
T}@T{ T} T{
Left Left
T}@T{ T} T{
Center Center
T}@T{ T} T{
Default Default
T} T}
_ _
T{ T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T} T}
T{ T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T} T}
T{ T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T} T}
.TE .TE
@ -92,43 +92,43 @@ Simple table indented two spaces:
.PP .PP
Demonstration of simple table syntax. Demonstration of simple table syntax.
.TS .TS
tab(@); delim(@@) tab( );
r l c l. r l c l.
T{ T{
Right Right
T}@T{ T} T{
Left Left
T}@T{ T} T{
Center Center
T}@T{ T} T{
Default Default
T} T}
_ _
T{ T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T} T}
T{ T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T} T}
T{ T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T} T}
.TE .TE
@ -138,38 +138,38 @@ Multiline table with caption:
Here's the caption. Here's the caption.
It may span multiple lines. It may span multiple lines.
.TS .TS
tab(@); delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n). cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
T{ T{
Centered Centered
Header Header
T}@T{ T} T{
Left Left
Aligned Aligned
T}@T{ T} T{
Right Right
Aligned Aligned
T}@T{ T} T{
Default aligned Default aligned
T} T}
_ _
T{ T{
First First
T}@T{ T} T{
row row
T}@T{ T} T{
12.0 12.0
T}@T{ T} T{
Example of a row that spans Example of a row that spans
multiple lines. multiple lines.
T} T}
T{ T{
Second Second
T}@T{ T} T{
row row
T}@T{ T} T{
5.0 5.0
T}@T{ T} T{
Here's another one. Here's another one.
Note Note
the blank line between rows. the blank line between rows.
@ -179,38 +179,38 @@ T}
Multiline table without caption: Multiline table without caption:
.PP .PP
.TS .TS
tab(@); delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n). cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
T{ T{
Centered Centered
Header Header
T}@T{ T} T{
Left Left
Aligned Aligned
T}@T{ T} T{
Right Right
Aligned Aligned
T}@T{ T} T{
Default aligned Default aligned
T} T}
_ _
T{ T{
First First
T}@T{ T} T{
row row
T}@T{ T} T{
12.0 12.0
T}@T{ T} T{
Example of a row that spans Example of a row that spans
multiple lines. multiple lines.
T} T}
T{ T{
Second Second
T}@T{ T} T{
row row
T}@T{ T} T{
5.0 5.0
T}@T{ T} T{
Here's another one. Here's another one.
Note Note
the blank line between rows. the blank line between rows.
@ -220,33 +220,33 @@ T}
Table without column headers: Table without column headers:
.PP .PP
.TS .TS
tab(@); delim(@@) tab( );
r l c r. r l c r.
T{ T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T}@T{ T} T{
12 12
T} T}
T{ T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T}@T{ T} T{
123 123
T} T}
T{ T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T}@T{ T} T{
1 1
T} T}
.TE .TE
@ -254,25 +254,25 @@ T}
Multiline table without column headers: Multiline table without column headers:
.PP .PP
.TS .TS
tab(@); delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n). cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
T{ T{
First First
T}@T{ T} T{
row row
T}@T{ T} T{
12.0 12.0
T}@T{ T} T{
Example of a row that spans Example of a row that spans
multiple lines. multiple lines.
T} T}
T{ T{
Second Second
T}@T{ T} T{
row row
T}@T{ T} T{
5.0 5.0
T}@T{ T} T{
Here's another one. Here's another one.
Note Note
the blank line between rows. the blank line between rows.

View file

@ -48,7 +48,7 @@
.pdfinfo /Author "John MacFarlane; Anonymous" .pdfinfo /Author "John MacFarlane; Anonymous"
.hy .hy
.EQ .EQ
delim || delim @@
.EN .EN
.TL .TL
Pandoc Test Suite Pandoc Test Suite
@ -627,7 +627,7 @@ Superscripts: a\*{bc\*}d a\*{\f[I]hello\f[]\*} a\*{hello\ there\*}.
Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O. Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O.
.PP .PP
These should not be superscripts or subscripts, These should not be superscripts or subscripts,
because of the unescaped spaces: a^b c^d, a~b c~d. because of the unescaped spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
.HLINE .HLINE
.SH 1 .SH 1
Smart quotes, ellipses, dashes Smart quotes, ellipses, dashes
@ -660,26 +660,26 @@ LaTeX
.pdfhref M "latex" .pdfhref M "latex"
.IP \[bu] 2 .IP \[bu] 2
.IP \[bu] 2 .IP \[bu] 2
|2 + 2 = 4| @2 + 2 = 4@
.IP \[bu] 2 .IP \[bu] 2
|x \[u2208] y| @x \[u2208] y@
.IP \[bu] 2 .IP \[bu] 2
|alpha \[u2227] omega| @alpha \[u2227] omega@
.IP \[bu] 2 .IP \[bu] 2
|223| @223@
.IP \[bu] 2 .IP \[bu] 2
|p|\-Tree @p@\-Tree
.IP \[bu] 2 .IP \[bu] 2
Here's some display math: Here's some display math:
.EQ .EQ
d over {d x} f ( x ) = lim sub {h -> 0} {f ( x + h ) \[u2212] f ( x )} over h d over {d x} f ( x ) = lim sub {h -> 0} {f ( x + h ) \[u2212] f ( x )} over h
.EN .EN
.IP \[bu] 2 .IP \[bu] 2
Here's one that has a line break in it: |alpha + omega times x sup 2|. Here's one that has a line break in it: @alpha + omega times x sup 2@.
.LP .LP
These shouldn't be math: These shouldn't be math:
.IP \[bu] 2 .IP \[bu] 2
To get the famous equation, write \f[C]$e\ =\ mc^2$\f[]. To get the famous equation, write \f[C]$e\ =\ mc\[ha]2$\f[].
.IP \[bu] 2 .IP \[bu] 2
$22,000 is a \f[I]lot\f[] of money. $22,000 is a \f[I]lot\f[] of money.
So is $34,000. So is $34,000.
@ -719,7 +719,7 @@ This & that.
.PP .PP
Backslash: \\ Backslash: \\
.PP .PP
Backtick: ` Backtick: \[aq]
.PP .PP
Asterisk: * Asterisk: *
.PP .PP
@ -968,7 +968,7 @@ If you want, you can indent every line, but you can also be
lazy and just indent the first line of each block. lazy and just indent the first line of each block.
.FE .FE
This should \f[I]not\f[] be a footnote reference, because it This should \f[I]not\f[] be a footnote reference, because it
contains a space.[^my note] Here is an inline note.\** contains a space.[\[ha]my note] Here is an inline note.\**
.FS .FS
This This
is \f[I]easier\f[] to type. is \f[I]easier\f[] to type.