unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pranshu <pranshusharma366@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71364@debbugs.gnu.org
Subject: bug#71364: Fix Table.el export
Date: Fri, 07 Jun 2024 17:00:13 +1000	[thread overview]
Message-ID: <87frtpqltu.fsf@gmail.com> (raw)
In-Reply-To: <86r0dagv7v.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 06 Jun 2024 14:35:16 +0300")



[1. application/pdf; thing.pdf]...


All good, basiclly in latex a equation is formatted in something like:
$\Delta Q = r^2$
Will become something like: "ΔQ = r²"

The key takeway is the dollar symbol is needed to tell the latex
compiler that it is typesetting maths.

Now, the problem is if you have a table like the following:
+---------+-------+--------+
|$\delta$ |x      |y       |
+---------+-------+--------+
|x        | $x^2$ |$xy$    |
+---------+-------+--------+
|y        | $xy$  | $y^2$  |
+---------+-------+--------+

Now if you export to latex using "C-^" or M-x table-generate-source you
get:

% This LaTeX table template is generated by emacs 30.0.50
\begin{tabular}{|l|l|l|}
\hline
\$$\backslash$delta\$ & x & y \\
\hline
x & \$x\^2\$ & \$xy\$ \\
\hline
y & \$xy\$ & \$y\^2\$ \\
\hline
\end{tabular}

The problem with this is that since the all the dollar and caret signs
are all escaped, the maths will not render.  The rendered pdf from the
above latex is attached, you can see that the equations were not
rendered properly.  This is because the dollar signs and carets were
automaticly escaped

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:

A cons cell containing which charecters to escape in the latex source
of ‘table-generate-source’.  The head of the list, if non-nil contains a
regexp that matches all text that is to be adding a preceding backslash
to the matching text. If nil, no non-backslash charecters will be
escaped.  The tail, if non-nil, escapes all the backslashes in the latex
source.

Kind Regards
Pranshu

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 71364@debbugs.gnu.org
>> From: Pranshu <pranshusharma366@gmail.com>
>> Date: Tue, 04 Jun 2024 21:22:00 +1000
>> 
>> When table.el exports to latex, charecters like '$' are all escaped.
>> This makes table.el tables practically useless for any sorts of latex
>> export.
>> 
>> Attached is a diff that adds a variable that controls what should be
>> escaped.
>
> Could you please explain in some more details the problem and the
> solution?  I'm afraid I couldn't follow your logic, perhaps because
> I'm not a frequent user of LaTeX.
>
> Thanks.





  reply	other threads:[~2024-06-07  7:00 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87frtpqltu.fsf@gmail.com \
    --to=pranshusharma366@gmail.com \
    --cc=71364@debbugs.gnu.org \
    --cc=eliz@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).