emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]
@ 2023-04-11 15:10 Garid Zorigoo
  2023-04-12  6:12 ` Garid Zorigoo
  2023-04-12  8:59 ` Ihor Radchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Garid Zorigoo @ 2023-04-11 15:10 UTC (permalink / raw)
  To: emacs-orgmode

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

I'm exporting the following org file (left-side) to a LaTeX pdf file.
The org file contains the multiple dashes in the ~code~ =verbatim=
format. The exported PDF file doesn't have the correct number of dashes.

|----------------+-----------------------------------|
| Original org   |   Exported  tex file  section     |
|----------------+-----------------------------------|
|                |    ....                           |
|* code          |    \section{code}                 |
| 1. ~-~         |    \label{sec:org532ffa5}         |
| 2. ~--~        |    \begin{enumerate}              |
| 3. ~---~       |    \item \texttt{-}               |
| 4. ~----~      |    \item \texttt{-{}-}            |
| 5. ~-----~     |    \item \texttt{-{}--}           |
| 6. ~a------b~  |    \item \texttt{-{}--{}-}        |
|                |    \item \texttt{-{}--{}--}       |
|* verbatim      |    \item \texttt{a-{}--{}--{}-b}  |
| 1. =-=         |    \end{enumerate}                |
| 2. =--=        |                                   |
| 3. =---=       |    \section{verbatim}             |
| 4. =----=      |    \label{sec:org4a05ec4}         |
| 5. =-----=     |    \begin{enumerate}              |
| 6. =a------b=  |    \item \texttt{-}               |
|                |    \item \texttt{-{}-}            |
|                |    \item \texttt{-{}--}           |
|                |    \item \texttt{-{}--{}-}        |
|                |    \item \texttt{-{}--{}--}       |
|                |    \item \texttt{a-{}--{}--{}-b}  |
|                |    \end{enumerate}                |
|                |    ...                            |
|----------------+-----------------------------------|

These multiple dashes need `{}` separator in between (i.e. `-{}-`).
However, I believe that ~----~ should become \texttt{-{}-{}-{}-{}-}
(actual 4 dashes) instead of \texttt{-{}--{}-} (dash + en.dash + dash)?

It may be needed {} in between every dash. (I read from here
<https://tex.stackexchange.com/a/9814/292504>)

Basically what I'm saying is that. I might need the following in
order to have the correct number of dashes.

|----------------+--------------------------------------|
| Original org   |   Maybe it should have exported      |
|----------------+--------------------------------------|
|                |   ...                                |
|* code          |   \section{code}                     |
| 1. ~-~         |   \label{sec:org532ffa5}             |
| 2. ~--~        |   \begin{enumerate}                  |
| 3. ~---~       |   \item \texttt{-}                   |
| 4. ~----~      |   \item \texttt{-{}-}                |
| 5. ~-----~     |   \item \texttt{-{}-{}-}             |
| 6. ~a------b~  |   \item \texttt{-{}-{}-{}-}          |
|                |   \item \texttt{-{}-{}-{}-{}-}       |
|* verbatim      |   \item \texttt{a-{}-{}-{}-{}-{}-b}  |
| 1. =-=         |   \end{enumerate}                    |
| 2. =--=        |                                      |
| 3. =---=       |   \section{verbatim}                 |
| 4. =----=      |   \label{sec:org4a05ec4}             |
| 5. =-----=     |   \begin{enumerate}                  |
| 6. =a------b=  |   \item \texttt{-}                   |
|                |   \item \texttt{-{}-}                |
|                |   \item \texttt{-{}-{}-}             |
|                |   \item \texttt{-{}-{}-{}-}          |
|                |   \item \texttt{-{}-{}-{}-{}-}       |
|                |   \item \texttt{a-{}-{}-{}-{}-{}-b}  |
|                |   \end{enumerate}                    |
|                |    ...                               |
|----------------+--------------------------------------|

The possible place this bug might reside:
It's possible that while exporting, it replaces -- with -{}-.
So 4 dashes (----) has 2 -- so each couple gets replaced
with -{}- finally forming -{}--{}-.


I was suggested to report this possible bug in the following forum question
<https://emacs.stackexchange.com/questions/76777/org-export-latex-multiple-dashes-in-code-verbatim-turn-into-wrong-number-of?noredirect=1#comment127290_76777>
.


If this was an intentional feature I'm sorry.


Garid Z.



Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.36, cairo version 1.17.6)
 of 2023-01-03
Package: Org mode version 9.5.5 (release_9.5.5 @
/usr/share/emacs/28.2/lisp/org/)

[-- Attachment #2: Type: text/html, Size: 5491 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]
  2023-04-11 15:10 [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)] Garid Zorigoo
@ 2023-04-12  6:12 ` Garid Zorigoo
  2023-04-12  8:59 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Garid Zorigoo @ 2023-04-12  6:12 UTC (permalink / raw)
  To: garidzorigoo; +Cc: emacs-orgmode


I think I even found a solution much easier solution.

Just replace each - dash with {-} when exporting latex.

In other words:

|---------------+-------------------------------------|
| Original org  | New suggestion                      |
|---------------+-------------------------------------|
|               | ...                                 |
| * code        | \section{code}                      |
| 1. ~-~        | \label{sec:org532ffa5}              |
| 2. ~--~       | \begin{enumerate}                   |
| 3. ~---~      | \item \texttt{{-}}                  |
| 4. ~----~     | \item \texttt{{-}{-}}               |
| 5. ~-----~    | \item \texttt{{-}{-}{-}}            |
| 6. ~a------b~ | \item \texttt{{-}{-}{-}{-}}         |
|               | \item \texttt{{-}{-}{-}{-}{-}}      |
| * verbatim    | \item \texttt{a{-}{-}{-}{-}{-}{-}b} |
| 1. =-=        | \end{enumerate}                     |
| 2. =--=       |                                     |
| 3. =---=      | \section{verbatim}                  |
| 4. =----=     | \label{sec:org4a05ec4}              |
| 5. =-----=    | \begin{enumerate}                   |
| 6. =a------b= | \item \texttt{{-}}                  |
|               | \item \texttt{{-}{-}}               |
|               | \item \texttt{{-}{-}{-}}            |
|               | \item \texttt{{-}{-}{-}{-}}         |
|               | \item \texttt{{-}{-}{-}{-}{-}}      |
|               | \item \texttt{a{-}{-}{-}{-}{-}{-}b} |
|               | \end{enumerate}                     |
|               | ...                                 |
|---------------+-------------------------------------|

This will ensure each - character as a separate character.
This seems much easier to implement and readable.

Garid Z.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]
  2023-04-11 15:10 [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)] Garid Zorigoo
  2023-04-12  6:12 ` Garid Zorigoo
@ 2023-04-12  8:59 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2023-04-12  8:59 UTC (permalink / raw)
  To: Garid Zorigoo; +Cc: emacs-orgmode

Garid Zorigoo <garidzorigoo@gmail.com> writes:

> These multiple dashes need `{}` separator in between (i.e. `-{}-`).
> However, I believe that ~----~ should become \texttt{-{}-{}-{}-{}-}
> (actual 4 dashes) instead of \texttt{-{}--{}-} (dash + en.dash + dash)?

Thanks for reporting!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5ac1ebaa1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-12  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 15:10 [BUG] Org export LaTeX: Multiple dashes in ~code~/=verbatim= turn into wrong number of dashes [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)] Garid Zorigoo
2023-04-12  6:12 ` Garid Zorigoo
2023-04-12  8:59 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).