all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Export of this table fails LuaLaTeX compilation
Date: Thu, 13 Oct 2022 11:59:37 +0700	[thread overview]
Message-ID: <ti85vq$qhh$1@ciao.gmane.io> (raw)
In-Reply-To: <87tu48tpb0.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 3062 bytes --]

On 13/10/2022 09:44, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> I am considering \noalign{} instead of \relax. I was never aware of its
>> effect, but accordingly to The TeXbook it should keep TeX in vertical
>> mode without any action due to empty argument. (Actually I surprised
>> that \relax causes any change of internal state besides parser.)
> 
> If \noalign has less side effects compared to \relax, I'd prefer
> \noalign. Can you confirm this?

My understanding of TeX is not solid enough to confirm this. From The 
TeXbook I have an impression that \noalign is added specially for 
table-like blocks to be used immediately after \cr (low level command 
similar to \\). So I would not use it outside of tables however it may 
be safe. I am not aware of problems with \\\noalign{} in tables. The 
exact effect of \relax is not clear to me yet. I do not have an example 
of negative effect of \relax similar to \hline but outside of tables.

I can try to ask for a better suggestion at stackexchange, but I am 
unsure if the question will be noticed by some person from a TeX engine 
or core LaTeX developers or at least with better understanding of TeX 
internals.

>> Unfortunately \noalign{} just as \relax will not allow @@latex:[1cm]@@
>> on the next line, perhaps @@latex:\noalign{\vskip 1cm}@@ is a workaround
>> to introduce additional vertical space.
> 
> What you are talking about appears to be abusing our exporter. We give
> no guarantees about how \\ is going to be exported internally into
> LaTeX. We should have no obligation to keep use-cases like this.

On the other hand LaTeX backend was transparent to such hacks, so the 
change might be breaking to some users. That is why conditionally adding 
\noalign{} or \relax if \\ is not followed by an export snippet may be a 
better solution.

>> I never used \\* or \\*[10pt] variants of the command. Current stable
>> release should has problems when the line next to \\ starts from * that
>> is not bold marker, besides square brackets.
> 
> I feel like I am missing what you are talking about here.

The rabbit hole is deeper than I thought. The \\ command has its star 
counterpart \\* to prevent page break at this point, and both of them 
allow optional [<LENGTH>] argument. In vanilla LaTeX2e space is allowed 
between \\ and *. However \usepackage{amsmath} redefines \\ command. It 
still can recognize following *, but only on the same line. Unsure if it 
is a bug or feature. So before your commit the following is not a 
problem in *default* Org configuration:

Star\\
@@ignore:@@* on the next line.

Star and brackets\\
*[1em] on the next line.

| Star |
| * in the next row. |
|-|
| Star and brackets |
| *[1em] in the next row. |

However it might be if someone changes list of default packages. Adding 
\noalign{} and \relax should fix the issue just for square brackets.

So at least as a temporary fix \noalign{} should be used for tables 
instead of \relax to mitigate negative effect of the recent patch.

P.S. Packages like longtable might bring more surprises.

[-- Attachment #2: doublebackslash.tex --]
[-- Type: text/x-tex, Size: 937 bytes --]

\documentclass{article}
%\usepackage{amsmath}
\begin{document}
\section{Regular usage}

Just\\
line break.

Brackets\\[1em]
on the same line.

Star\\*
on the same line.

Star and brackets\\*[1em]
on the same line.

\begin{tabular}{l}
tabular\\
\hline
Two\\
rows\\
\hline
Brackets \\[1em]
in the same row\\[1pt]
\hline
Star \\*
in the same row\\*
\hline
Start and brackets\\*[1em]
in the same row\\*[1pt]
\hline
\end{tabular}

\section{Problems}
Brackets and starts disappear in the beginning of
lines and table rows.

Brackets\\
[1em] on the next line.

\begin{tabular}{l}
tabular\\
\hline
Brackets \\
[1em] in the next row\\
[1pt]
\hline
\end{tabular}

\section{Problems when usepackage\{amsmath\} absent}

Star\\
* on the next line.

Star and brackets\\
*[1em] on the next line.

\begin{tabular}{l}
tabular\\
\hline
Star\\
* in the next row. \\
\hline
Star and brackets\\
*[1em] in the next row. \\
\hline
\end{tabular}
\end{document}

  reply	other threads:[~2022-10-13  5:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  3:15 Export of this table fails LuaLaTeX compilation gerard.vermeulen
2022-10-12  4:15 ` Ihor Radchenko
2022-10-12  4:45   ` Max Nikulin
2022-10-12  5:15     ` gerard.vermeulen
2022-10-12  5:55       ` Max Nikulin
2022-10-12  7:26         ` Ihor Radchenko
2022-10-12  8:20           ` Max Nikulin
2022-10-13  2:44             ` Ihor Radchenko
2022-10-13  4:59               ` Max Nikulin [this message]
2022-10-13 14:27                 ` Leo Butler
2022-10-13 15:18                   ` [PATCH] ox-latex: Use \empty instead of \relax after \\ Max Nikulin
2022-10-14  2:32                     ` Ihor Radchenko
2022-10-12  9:17         ` Export of this table fails LuaLaTeX compilation gerard.vermeulen
2022-10-12 16:21           ` Max Nikulin
2022-10-13  5:03             ` gerard.vermeulen
2022-10-12  4:53   ` gerard.vermeulen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ti85vq$qhh$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.