From: Pranshu <pranshusharma366@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Vladimir Nikishkin <lockywolf@gmail.com>,
71364@debbugs.gnu.org, Reuben Thomas <rrt@sc3d.org>
Subject: bug#71364: Fix Table.el export
Date: Sat, 08 Jun 2024 18:15:25 +1000 [thread overview]
Message-ID: <87o78bg89u.fsf@gmail.com> (raw)
In-Reply-To: <86le3gdjm3.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jun 2024 09:38:44 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Pranshu <pranshusharma366@gmail.com>
>> Cc: 71364@debbugs.gnu.org
>> Date: Sat, 08 Jun 2024 12:10:32 +1000
>>
>> > So you are saying that exporting to latex is basically completely
>> > broken in the current code? Is that command use to export only to
>> > latex, or is the fact that the export is to latex is just one of the
>> > possibilities?
>>
>> Yes. The function that does the escaping is
>> `table--generate-source-scan-lines', which is a misleading name because
>> it is only called by table-generate-source when the language is exported
>> to latex.
>
> It is strange to hear that this is so basically broken. This code
> exists since more than 20 years ago, and several people contributed
> changes to the LaTeX export, so I'd expect it to be at least somewhat
> useful and working.
Yes, initially I was surprised as well. Initially I was surprised as
well. I found 2 questions on stack overflow in which they also came to
the same dead end, of not being able to put equations in table(.el)s.
>> >> What the diff does, is that it adds a variable that allows the user to
>> >> change what will be escaped. Also as you can see in the above latex
>> >> table, the backslash had to be escaped in a different way, so using one
>> >> regexp variable would not be enough. That is why the solution contains
>> >> a variable called 'table-source-latex-escape-characters', which is a
>> >> cons cell with the documentation:
>> >
>> > Why would a user need to customize this on the level of characters?
>> > Shouldn't there be a single boolean that causes latex-specific
>> > characters to be escape or not to be escaped, all of them or none?
>> >
>>
>> The problem with that is that there are latex charecters such as '%',
>> which is comment, that will cause the whole table to break of not
>> escaped.
>
> Is % the only character with such problems, or are there others?
>
These characters: "#$~_^%{}&", will all mess something up to different
extents. For some it's mostly harmless as with the '~', but characters
like '&' will fully mess up the table, as it is used to separate the
columns.
>> And since the variable is a regexp, it can possibly escape macros, such
>> as 'LaTeX' -> '\LaTeX'.
>
> Not sure I understand: is it a Good Thing that it could escape macros,
> or is it a Bad Thing (which should be avoided)?
Yes, it is a good thing. "Escaping macros" was bad wording, I meant
turning words into macros. Normally it will not do that, but it can be
customised to do that.
> More generally, given these tricky considerations, how would a user
> determine which characters to include in the regexp? If it's only by
> examining the texts in the table cells, then it could be not very
> practical, since a table could be very large.
>
>> >
>> > What is the purpose of the "tail", i.e. why would a user want to
>> > escape all the backslashes?
>>
>> Mainly because some people might only use the latex export to turn their
>> table into a pdf, and escaping backslashes is not as simple as typing
>> two backslashes. And also since it was the default behaviour, so those
>> who have already made tables will not need to escape all those
>> backslashes to make their documents exportable.
>>
>> If you feel that is unnecessary, I can modify the diff not include
>> backslash escaping.
>
> I think it should be controlled by a separate variable.
>
Yeah, you probably know better about that then I do. I will just say
that variables about table.el are extremely hard to find, since of you
"C-h v table ?", you will see 100s of variables thanks to org-mode
tables. Personally I would avoid creating more variables with 'table' in
their name, but as I said you know a lot more about emacs than I do.
> I also added to the discussion two people who in the past contributed
> changes to table.el in the LaTeX-related areas, so they probably have
> some experience with exporting to LaTeX, and could help us figure out
> how best to handle this issue.
>
all good, more perspectives could help.
next prev parent reply other threads:[~2024-06-08 8:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 11:22 bug#71364: Fix Table.el export Pranshu
2024-06-06 11:35 ` Eli Zaretskii
2024-06-07 7:00 ` Pranshu
2024-06-07 10:54 ` Eli Zaretskii
2024-06-08 2:10 ` Pranshu
2024-06-08 6:38 ` Eli Zaretskii
2024-06-08 8:15 ` Pranshu [this message]
2024-06-08 10:05 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 10:51 ` Eli Zaretskii
2024-06-08 10:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 11:18 ` Eli Zaretskii
2024-06-08 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 4:33 ` Pranshu
2024-06-09 8:15 ` Eli Zaretskii
2024-06-09 8:33 ` Pranshu
2024-06-21 8:25 ` Pranshu
2024-06-22 9:39 ` Eli Zaretskii
2024-07-06 7:39 ` Eli Zaretskii
2024-07-06 14:00 ` Lockywolf Laptop
2024-07-06 22:25 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09 7:05 ` Pranshu
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=87o78bg89u.fsf@gmail.com \
--to=pranshusharma366@gmail.com \
--cc=71364@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=lockywolf@gmail.com \
--cc=rrt@sc3d.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.