emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 892df429f4 3/3: ox-latex: Use \empty instead of \re


From: ELPA Syncer
Subject: [elpa] externals/org 892df429f4 3/3: ox-latex: Use \empty instead of \relax after \\
Date: Thu, 13 Oct 2022 22:57:50 -0400 (EDT)

branch: externals/org
commit 892df429f4ff861c8e2b7861702f97f97a4987ab
Author: Max Nikulin <manikulin@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    ox-latex: Use \empty instead of \relax after \\
    
    * lisp/ox-latex.el (org-latex-line-break-safe, org-latex-table-row):
    * testing/lisp/test-org-table.el (test-org-table/to-latex): Use \empty
    instead of \relax to prevent interpreting following "*" and "[" as
    optional parts of \\*[LENGTH] command.
    
    Fix regression introduced by 3f60acff77. \\\relax\hline caused
    misaligned \noalign error. Org markup:
    
        | a |
        |---|
    
    \hline is allowed only immediately after \cr while \relax has some side
    effects. Hope, \empty just expands to nothing.
    
    Those who used \\ optional argument to adjust amount of space between
    lines may add the following tricks:
    
        First,\\
        @@latex:{\vskip1em}@@second.
    
        | First                               |
        | @@latex:\noalign{\vskip1em}@@second |
    
    Reported in
    gerard.vermeulen, Wed, 12 Oct 2022 03:15:49 +0000.
    https://list.orgmode.org/784cf8be450b7d676ddd60214cc847db@posteo.net
---
 lisp/ox-latex.el               | 12 ++++++------
 testing/lisp/test-org-table.el |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index eed5dc898d..aff90f6111 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -278,17 +278,17 @@ list can be:
 
 - `:lang-name' the actual name of the language.")
 
-(defconst org-latex-line-break-safe "\\\\\\relax"
+(defconst org-latex-line-break-safe "\\\\\\empty"
   "Linebreak protecting the following [...].
 
-Without \"\\relax\" it would be interpreted as an optional argument to
+Without \"\\empty\" 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\\\\\\relax
-    [I] & A\\\\\\relax
+    [t] & s\\\\\\empty
+    [I] & A\\\\\\empty
     [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} \\\\\\relax
+\\multicolumn{%d}{l}{%s} \\\\\\empty
 %s
-%s \\\\\\relax\n
+%s \\\\\\empty\n
 %s
 \\endhead
 %s\\multicolumn{%d}{r}{%s} \\\\
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index 3e7f18a101..722c37ea44 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -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\\\\\\relax\n\\end{tabular}"
+   (equal "\\begin{tabular}{l}\na\\\\\\empty\n\\end{tabular}"
          (orgtbl-to-latex (org-table-to-lisp "| a |") nil)))
   ;; Test :environment parameter.
   (should
-   (equal "\\begin{tabularx}{l}\na\\\\\\relax\n\\end{tabularx}"
+   (equal "\\begin{tabularx}{l}\na\\\\\\empty\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\\)\\\\\\relax\n\\end{tabular}"
+   (equal "\\begin{tabular}{l}\n\\(x\\)\\\\\\empty\n\\end{tabular}"
          (orgtbl-to-latex (org-table-to-lisp "| $x$ |") nil)))
   ;; Test pseudo objects and :raw parameter.
   (should



reply via email to

[Prev in Thread] Current Thread [Next in Thread]