forked from mirrors/org-mode
org-latex-line-break-safe: Use safer value of "\\[0pt]"
* lisp/ox-latex.el (org-latex-line-break-safe): (org-latex-table-row): Change \empty ending to explicit optional argument. \empty still has undesired side effects in some cases. * testing/lisp/test-org-table.el (test-org-table/to-latex): * testing/lisp/test-ox-latex.el (test-ox-latex/verse): Update tests. Reported-by: Juan Manuel Macías <maciaschain@posteo.net> Link: https://orgmode.org/list/87o7u9rz1a.fsf@posteo.net
This commit is contained in:
parent
0e175f11fd
commit
b93a61af9c
|
@ -278,17 +278,17 @@ list can be:
|
|||
|
||||
- `:lang-name' the actual name of the language.")
|
||||
|
||||
(defconst org-latex-line-break-safe "\\\\\\empty"
|
||||
(defconst org-latex-line-break-safe "\\\\[0pt]"
|
||||
"Linebreak protecting the following [...].
|
||||
|
||||
Without \"\\empty\" it would be interpreted as an optional argument to
|
||||
Without \"[0pt]\" it would be interpreted as an optional argument to
|
||||
the \\\\.
|
||||
|
||||
This constant, for example, makes the below code not err:
|
||||
|
||||
\\begin{tabular}{c|c}
|
||||
[t] & s\\\\\\empty
|
||||
[I] & A\\\\\\empty
|
||||
[t] & s\\\\[0pt]
|
||||
[I] & A\\\\[0pt]
|
||||
[m] & kg
|
||||
\\end{tabular}")
|
||||
|
||||
|
@ -4005,9 +4005,9 @@ a communication channel."
|
|||
(org-export-get-parent-table table-row) info))))
|
||||
(format "%s
|
||||
\\endfirsthead
|
||||
\\multicolumn{%d}{l}{%s} \\\\\\empty
|
||||
\\multicolumn{%d}{l}{%s} \\\\[0pt]
|
||||
%s
|
||||
%s \\\\\\empty\n
|
||||
%s \\\\[0pt]\n
|
||||
%s
|
||||
\\endhead
|
||||
%s\\multicolumn{%d}{r}{%s} \\\\
|
||||
|
|
|
@ -1635,11 +1635,11 @@ See also `test-org-table/copy-field'."
|
|||
(ert-deftest test-org-table/to-latex ()
|
||||
"Test `orgtbl-to-latex' specifications."
|
||||
(should
|
||||
(equal "\\begin{tabular}{l}\na\\\\\\empty\n\\end{tabular}"
|
||||
(equal "\\begin{tabular}{l}\na\\\\[0pt]\n\\end{tabular}"
|
||||
(orgtbl-to-latex (org-table-to-lisp "| a |") nil)))
|
||||
;; Test :environment parameter.
|
||||
(should
|
||||
(equal "\\begin{tabularx}{l}\na\\\\\\empty\n\\end{tabularx}"
|
||||
(equal "\\begin{tabularx}{l}\na\\\\[0pt]\n\\end{tabularx}"
|
||||
(orgtbl-to-latex (org-table-to-lisp "| a |")
|
||||
'(:environment "tabularx"))))
|
||||
;; Test :booktabs parameter.
|
||||
|
@ -1648,7 +1648,7 @@ See also `test-org-table/copy-field'."
|
|||
"\\toprule" (orgtbl-to-latex (org-table-to-lisp "| a |") '(:booktabs t))))
|
||||
;; Handle LaTeX snippets.
|
||||
(should
|
||||
(equal "\\begin{tabular}{l}\n\\(x\\)\\\\\\empty\n\\end{tabular}"
|
||||
(equal "\\begin{tabular}{l}\n\\(x\\)\\\\[0pt]\n\\end{tabular}"
|
||||
(orgtbl-to-latex (org-table-to-lisp "| $x$ |") nil)))
|
||||
;; Test pseudo objects and :raw parameter.
|
||||
(should
|
||||
|
|
|
@ -60,14 +60,14 @@ lorem ipsum dolor
|
|||
(should
|
||||
(search-forward
|
||||
"\\begin{verse}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
\\vspace*{1em}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
\\vspace*{1em}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
lorem ipsum dolor\\\\[0pt]
|
||||
\\end{verse}"))))
|
||||
|
||||
(provide 'test-ox-latex)
|
||||
|
|
Loading…
Reference in New Issue