Skip to content

Commit ecd7a2d

Browse files
committed
latex_raw: fix tabulate doctest
1 parent 8c73d87 commit ecd7a2d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tabulate.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ def tabulate(tabular_data, headers=(), tablefmt="simple",
932932
933933
Various plain-text table formats (`tablefmt`) are supported:
934934
'plain', 'simple', 'grid', 'pipe', 'orgtbl', 'rst', 'mediawiki',
935-
'latex', 'latex_raw' and 'latex_booktabs'. Variable `tabulate_formats`
935+
'latex', 'latex_raw' and 'latex_booktabs'. Variable `tabulate_formats`
936936
contains the list of currently supported formats.
937937
938938
"plain" format doesn't use any pseudographics to draw tables,
@@ -1074,25 +1074,25 @@ def tabulate(tabular_data, headers=(), tablefmt="simple",
10741074
</tbody>
10751075
</table>
10761076
1077-
"latex" produces a tabular environment of LaTeX document markup and replaces
1078-
common characters like `\` and `_` with their LaTeX correspondents:
1077+
"latex" produces a tabular environment of LaTeX document markup:
10791078
1080-
>>> print(tabulate([["spam_0", 41.9999], ["eggs\\0", "451.0"]], tablefmt="latex"))
1079+
>>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]], tablefmt="latex"))
10811080
\\begin{tabular}{lr}
10821081
\\hline
1083-
spam\\_0 & 41.9999 \\\\
1084-
eggs\\textbackslash{}0 & 451 \\\\
1082+
spam & 41.9999 \\\\
1083+
eggs & 451 \\\\
10851084
\\hline
10861085
\\end{tabular}
10871086
1088-
"latex_raw" produces a tabular environment of LaTeX document markup without
1089-
replacement of common ciritical LaTeX characters:
1087+
"latex_raw" is similar to "latex", but doesn't escape special characters,
1088+
such as backslash and underscore, so LaTeX commands may embedded into
1089+
cells' values:
10901090
1091-
>>> print(tabulate([["spam_0", 41.9999], ["eggs\\0", "451.0"]], tablefmt="latex_raw"))
1091+
>>> print(tabulate([["spam$_9$", 41.9999], ["\\\\emph{eggs}", "451.0"]], tablefmt="latex_raw"))
10921092
\\begin{tabular}{lr}
10931093
\\hline
1094-
spam_0 & 41.9999 \\\\
1095-
eggs\\0 & 451 \\\\
1094+
spam$_9$ & 41.9999 \\\\
1095+
\\emph{eggs} & 451 \\\\
10961096
\\hline
10971097
\\end{tabular}
10981098

0 commit comments

Comments
 (0)