emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Nested smart quotes
@ 2017-10-05 16:27 Martin Alsinet
  2017-10-05 17:22 ` Colin Baxter
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Martin Alsinet @ 2017-10-05 16:27 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello!

My name is Martin and I use org-mode every day. This is my first message to
the mailing list, and I wanted to ask if somebody could help me with a
problem I encountered when exporting a document with nested smart quotes.

I have submitted the same question
<https://emacs.stackexchange.com/questions/35942/nested-smart-quotes-in-org-mode>
to the emacs Stack Exchange, and someone suggested there to send a message
to this list. I assume many people here reads their email inside emacs, and
since this email has embedded images, you might see it better formatted in
SO.

I have found that the smart-quotes option of org-mode does not export
properly the quotes when they are nested (single quotes inside double
quotes), but only when they coincide at the start or the end of the quote.

Maybe the problem will be clearer with an example:

#+TITLE: Smart quotes example
#+OPTIONS: toc:nil ':t
#+LANGUAGE: en
#+LATEX_CLASS: book
She said to me: "Rick screamed, 'let's go together'"

This gets exported to TeX as:

She said to me: ``Rick screamed, `let's go together'''

Which gets rendered as PDF as:

[image: The order of the closing quotes is wrong]
<https://i.stack.imgur.com/7QHh7.png>

The order of the closing quotes gets reversed, it first closes the outside
double quotes and then the nested single quote.

I have tried leaving a space between them, but that is arguably worse

Org:

She said to me: "Rick screamed, 'let's go together' "

TeX:

She said to me: ``Rick screamed, `let's go together' "

PDF:

[image: Internal quotes are ok, closing double quote is wrong]
<https://i.stack.imgur.com/cqbzj.png>

In this case, the internal single quotes are rendered correctly, but the
closing quote is not converted into its "smart" version.

If the nested quotes are in such a way that there are other characters
between the quotes, that is they are not together at the start or the end
of the quote, they get rendered correctly.

Thanks in advance


Martin

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

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

* Re: Nested smart quotes
  2017-10-05 16:27 Nested smart quotes Martin Alsinet
@ 2017-10-05 17:22 ` Colin Baxter
  2017-10-05 17:39   ` Martin Alsinet
  2017-10-05 18:46 ` Nicolas Goaziou
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Colin Baxter @ 2017-10-05 17:22 UTC (permalink / raw)
  To: Martin Alsinet; +Cc: emacs-orgmode

>>>>> Martin Alsinet <martin@alsinet.com.ar> writes:


    > #+TITLE: Smart quotes example #+OPTIONS: toc:nil ':t #+LANGUAGE:
    > en #+LATEX_CLASS: book She said to me: "Rick screamed, 'let's go
    > together'"

    > This gets exported to TeX as:

    > She said to me: ``Rick screamed, `let's go together'''

    > Which gets rendered as PDF as:

    > The order of the closing quotes is wrong

    > The order of the closing quotes gets reversed, it first closes the
    > outside double quotes and then the nested single quote.

    > I have tried leaving a space between them, but that is arguably
    > worse

    > Org:

    > She said to me: "Rick screamed, 'let's go together' "

    > TeX:

    > She said to me: ``Rick screamed, `let's go together' "

    > PDF:

    > Internal quotes are ok, closing double quote is wrong

    > In this case, the internal single quotes are rendered correctly,
    > but the closing quote is not converted into its "smart" version.

    > If the nested quotes are in such a way that there are other
    > characters between the quotes, that is they are not together at
    > the start or the end of the quote, they get rendered correctly.

    > Thanks in advance

    > Martin

What about

She said to me: \lq\lq Rick screamed, \lq let's go together\rq\nbsp{}\rq\rq


-- 
Colin Baxter
m43cap@yandex.com

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

* Re: Nested smart quotes
  2017-10-05 17:22 ` Colin Baxter
@ 2017-10-05 17:39   ` Martin Alsinet
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Alsinet @ 2017-10-05 17:39 UTC (permalink / raw)
  To: Colin Baxter; +Cc: emacs-orgmode

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

Colin:

The beauty of smart quotes is that I don't have to see the ugly LaTeX
formatting in my org file, but the final document has the corresponding
opening and closing quote characters. While I do sprinkle some LaTeX here
and there in my org files, I think that would be going a little too far for
my taste.

Thanks anyway!

Martin


On Thu, Oct 5, 2017 at 12:22 PM Colin Baxter <m43cap@yandex.com> wrote:

> >>>>> Martin Alsinet <martin@alsinet.com.ar> writes:
>
>
>     > #+TITLE: Smart quotes example #+OPTIONS: toc:nil ':t #+LANGUAGE:
>     > en #+LATEX_CLASS: book She said to me: "Rick screamed, 'let's go
>     > together'"
>
>     > This gets exported to TeX as:
>
>     > She said to me: ``Rick screamed, `let's go together'''
>
>     > Which gets rendered as PDF as:
>
>     > The order of the closing quotes is wrong
>
>     > The order of the closing quotes gets reversed, it first closes the
>     > outside double quotes and then the nested single quote.
>
>     > I have tried leaving a space between them, but that is arguably
>     > worse
>
>     > Org:
>
>     > She said to me: "Rick screamed, 'let's go together' "
>
>     > TeX:
>
>     > She said to me: ``Rick screamed, `let's go together' "
>
>     > PDF:
>
>     > Internal quotes are ok, closing double quote is wrong
>
>     > In this case, the internal single quotes are rendered correctly,
>     > but the closing quote is not converted into its "smart" version.
>
>     > If the nested quotes are in such a way that there are other
>     > characters between the quotes, that is they are not together at
>     > the start or the end of the quote, they get rendered correctly.
>
>     > Thanks in advance
>
>     > Martin
>
> What about
>
> She said to me: \lq\lq Rick screamed, \lq let's go together\rq\nbsp{}\rq\rq
>
>
> --
> Colin Baxter
> m43cap@yandex.com
>

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

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

* Re: Nested smart quotes
  2017-10-05 16:27 Nested smart quotes Martin Alsinet
  2017-10-05 17:22 ` Colin Baxter
@ 2017-10-05 18:46 ` Nicolas Goaziou
  2017-10-05 19:13 ` Nick Dokos
  2017-10-05 21:56 ` Nested smart quotes Adonay Felipe Nogueira
  3 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2017-10-05 18:46 UTC (permalink / raw)
  To: Martin Alsinet; +Cc: emacs-orgmode

Hello,

Martin Alsinet <martin@alsinet.com.ar> writes:

> Maybe the problem will be clearer with an example:
>
> #+TITLE: Smart quotes example
> #+OPTIONS: toc:nil ':t
>
> #+LANGUAGE: en
> #+LATEX_CLASS: book
>
> She said to me: "Rick screamed, 'let's go together'"
>
> This gets exported to TeX as:
>
> She said to me: ``Rick screamed, `let's go together'''

This looks correct to me. For example, with french quotes, I get

  She said to me: \og Rick screamed, \og let's go together\fg{}\fg{}

which looks fine. Maybe LaTeX cannot handle this properly.


Regards,

-- 
Nicolas Goaziou

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

* Re: Nested smart quotes
  2017-10-05 16:27 Nested smart quotes Martin Alsinet
  2017-10-05 17:22 ` Colin Baxter
  2017-10-05 18:46 ` Nicolas Goaziou
@ 2017-10-05 19:13 ` Nick Dokos
  2017-10-05 19:41   ` Colin Baxter
  2017-10-05 19:41   ` Martin Alsinet
  2017-10-05 21:56 ` Nested smart quotes Adonay Felipe Nogueira
  3 siblings, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2017-10-05 19:13 UTC (permalink / raw)
  To: emacs-orgmode

Martin Alsinet <martin@alsinet.com.ar> writes:

> ...
> I have found that the smart-quotes option of org-mode does not export properly the quotes when they are nested (single quotes inside double quotes), but only when they coincide at the
> start or the end of the quote.
>
> Maybe the problem will be clearer with an example:
>
> #+TITLE: Smart quotes example
> #+OPTIONS: toc:nil ':t
> #+LANGUAGE: en
> #+LATEX_CLASS: book
> She said to me: "Rick screamed, 'let's go together'" 
>

This example has the additional problem of the apostrophe in "let's", which
basically causes more mayhem. Let's simplify the example a bit by considering

    She said to me: "Rick screamed, 'let us go together'"

which when export to TeX becomes:

    She said to me: ``Rick screamed, `let us go together'''

and TeX misinterprets the three closing single quotes as (closing
double quote, closing single quote) instead of (closing single quote,
closing double quote).

Modifying the TeX output to this:

    She said to me: ``Rick screamed, `let us go together'\,''

makes TeX interpret things correctly and it is also visually pleasant
(IMO of course).

> This gets exported to TeX as:
>
> She said to me: ``Rick screamed, `let's go together'''
>
> Which gets rendered as PDF as:
>
> The orde
>
> The order of the closing quotes gets reversed, it first closes the outside double quotes and then the nested single quote.
>
> I have tried leaving a space between them, but that is arguably worse
>
> Org:
>
> She said to me: "Rick screamed, 'let's go together' " 
>
> TeX:
>
> She said to me: ``Rick screamed, `let's go together' "

I do not get this with the space. I get this in the TeX output:

   She said to me: ``Rick screamed, `let us go together' ''

which has a larger space between the single and the double quote at the end
than with \, but is otherwise OK.


>
> Internal
>
> In this case, the internal single quotes are rendered correctly, but the closing quote is not converted into its "smart" version.
>
> If the nested quotes are in such a way that there are other characters between the quotes, that is they are not together at the start or the end of the quote, they get rendered correctly.

I'm not sure whether smart quotes can be made smarter, perhaps by
detecting the problem and inserting the small space \, to resolve the
ambiguity; but the manual space solution should have worked: what
version of org are you using?

FWIW, mine is latest master: Org mode version 9.1.2
(release_9.1.2-84-geeaf9a @ /home/nick/src/emacs/org/org-mode/lisp/)

Going back to the original string with the apostrophe, I don't see any
way that org or TeX can deal with it except by really understanding
what is being said: having the apostrophe be denoted by the same
symbol as the closing quote is bound to introduce ambiguities. In
these days of Unicode, I think the only solution is to use xelatex or
another Unicode-cognizant TeX system and to use a proper apostrophe.

-- 
Nick

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

* Re: Nested smart quotes
  2017-10-05 19:13 ` Nick Dokos
@ 2017-10-05 19:41   ` Colin Baxter
  2017-10-05 19:41   ` Martin Alsinet
  1 sibling, 0 replies; 10+ messages in thread
From: Colin Baxter @ 2017-10-05 19:41 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

>>>>> Nick Dokos <ndokos@gmail.com> writes:

    > Martin Alsinet <martin@alsinet.com.ar> writes:
    >> ...  I have found that the smart-quotes option of org-mode does
    >> not export properly the quotes when they are nested (single
    >> quotes inside double quotes), but only when they coincide at the
    >> start or the end of the quote.
    >> 
    >> Maybe the problem will be clearer with an example:
    >> 
    >> #+TITLE: Smart quotes example #+OPTIONS: toc:nil ':t #+LANGUAGE:
    >> en #+LATEX_CLASS: book She said to me: "Rick screamed, 'let's go
    >> together'"
    >> 

    > This example has the additional problem of the apostrophe in
    > "let's", which basically causes more mayhem. Let's simplify the
    > example a bit by considering


    > Going back to the original string with the apostrophe, I don't see
    > any way that org or TeX can deal with it except by really
    > understanding what is being said: having the apostrophe be denoted
    > by the same symbol as the closing quote is bound to introduce
    > ambiguities. In these days of Unicode, I think the only solution
    > is to use xelatex or another Unicode-cognizant TeX system and to
    > use a proper apostrophe.

    > -- Nick


TeX/LaTeX were after all designed primarily for mathematics. That said,
it might be worth looking at the upquote package:

https://ctan.org/pkg/upquote.

-- 
Colin Baxter
m43cap@yandex.com
---------------------------------------------------------------------
GnuPG fingerprint: 68A8 799C 0230 16E7 BF68  2A27 BBFA 2492 91F5 41C8
---------------------------------------------------------------------
"There is no more common error than to assume that, because prolonged and
accurate mathematical calculations have been made, the application of
the result to some fact of nature is absolutely certain." A. N. Whitehead

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

* Re: Nested smart quotes
  2017-10-05 19:13 ` Nick Dokos
  2017-10-05 19:41   ` Colin Baxter
@ 2017-10-05 19:41   ` Martin Alsinet
  2017-10-05 21:36     ` Nested smart quotes [fixed] Martin Alsinet
  1 sibling, 1 reply; 10+ messages in thread
From: Martin Alsinet @ 2017-10-05 19:41 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

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

Hello Nick. First, thank you so much for your detailed answer.

On Thu, Oct 5, 2017 at 2:16 PM Nick Dokos <ndokos@gmail.com> wrote:

>
> This example has the additional problem of the apostrophe in "let's", which
> basically causes more mayhem. Let's simplify the example a bit by
> considering
>
>     She said to me: "Rick screamed, 'let us go together'"
>
> which when export to TeX becomes:
>
>     She said to me: ``Rick screamed, `let us go together'''
>
> and TeX misinterprets the three closing single quotes as (closing
> double quote, closing single quote) instead of (closing single quote,
> closing double quote).
>
>
I was beginning to suspect that, I didn't see it at first, but after
writing and explaining the problem, it dawned on me that it could be LaTeX
that cannot correctly parse the three consecutive single quotes.


> >
> > Internal
> >
> > In this case, the internal single quotes are rendered correctly, but the
> closing quote is not converted into its "smart" version.
> >
> > If the nested quotes are in such a way that there are other characters
> between the quotes, that is they are not together at the start or the end
> of the quote, they get rendered correctly.
>
> I'm not sure whether smart quotes can be made smarter, perhaps by
> detecting the problem and inserting the small space \, to resolve the
> ambiguity; but the manual space solution should have worked: what
> version of org are you using?
>
> FWIW, mine is latest master: Org mode version 9.1.2
> (release_9.1.2-84-geeaf9a @ /home/nick/src/emacs/org/org-mode/lisp/)
>

I am using Org mode version 8.2.10, I will update my version and try again.


Martin

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

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

* Re: Nested smart quotes [fixed]
  2017-10-05 19:41   ` Martin Alsinet
@ 2017-10-05 21:36     ` Martin Alsinet
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Alsinet @ 2017-10-05 21:36 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

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

On Thu, Oct 5, 2017 at 2:41 PM Martin Alsinet <martin@alsinet.com.ar> wrote:

> Hello Nick. First, thank you so much for your detailed answer.
>
> I'm not sure whether smart quotes can be made smarter, perhaps by
>> detecting the problem and inserting the small space \, to resolve the
>> ambiguity; but the manual space solution should have worked: what
>> version of org are you using?
>>
>> FWIW, mine is latest master: Org mode version 9.1.2
>> (release_9.1.2-84-geeaf9a @ /home/nick/src/emacs/org/org-mode/lisp/)
>>
>
> I am using Org mode version 8.2.10, I will update my version and try again.
>
>
I updated Org-mode to the last version (9.1.2) from the orgmode.org ELPA
sources and the problem went away.

Separating the nested quotes with a space does the trick:

She said to me: "Rick screamed, 'let's go together' "

Now the closing quote gets "smarted" in the exported PDF file.

Thank you very much


Martin

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

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

* Re: Nested smart quotes
  2017-10-05 16:27 Nested smart quotes Martin Alsinet
                   ` (2 preceding siblings ...)
  2017-10-05 19:13 ` Nick Dokos
@ 2017-10-05 21:56 ` Adonay Felipe Nogueira
  2017-10-05 22:21   ` Martin Alsinet
  3 siblings, 1 reply; 10+ messages in thread
From: Adonay Felipe Nogueira @ 2017-10-05 21:56 UTC (permalink / raw)
  To: emacs-orgmode

What about using org-entities for these quotes?

\ldquo{}Hello \lsquo{}World\rsquo{}!\rdquo{}

This is Org mode syntax, not LaTeX.

Martin Alsinet <martin@alsinet.com.ar> writes:

> Hello!
>
> My name is Martin and I use org-mode every day. This is my first message to
> the mailing list, and I wanted to ask if somebody could help me with a
> problem I encountered when exporting a document with nested smart quotes.
>
> I have submitted the same question to the emacs Stack Exchange, and someone
> suggested there to send a message to this list. I assume many people here
> reads their email inside emacs, and since this email has embedded images, you
> might see it better formatted in SO.
>
> I have found that the smart-quotes option of org-mode does not export
> properly the quotes when they are nested (single quotes inside double
> quotes), but only when they coincide at the start or the end of the quote.
>
> Maybe the problem will be clearer with an example:
>
> #+TITLE: Smart quotes example
> #+OPTIONS: toc:nil ':t
> #+LANGUAGE: en
> #+LATEX_CLASS: book
> She said to me: "Rick screamed, 'let's go together'" 
>
> This gets exported to TeX as:
>
> She said to me: ``Rick screamed, `let's go together'''
>
> Which gets rendered as PDF as:
>
> The order of the closing quotes is wrong
>
> The order of the closing quotes gets reversed, it first closes the outside
> double quotes and then the nested single quote.
>
> I have tried leaving a space between them, but that is arguably worse
>
> Org:
>
> She said to me: "Rick screamed, 'let's go together' " 
>
> TeX:
>
> She said to me: ``Rick screamed, `let's go together' "
>
> PDF:
>
> Internal quotes are ok, closing double quote is wrong
>
> In this case, the internal single quotes are rendered correctly, but the
> closing quote is not converted into its "smart" version.
>
> If the nested quotes are in such a way that there are other characters
> between the quotes, that is they are not together at the start or the end of
> the quote, they get rendered correctly.
>
> Thanks in advance
>
> Martin
>
>

-- 
- https://libreplanet.org/wiki/User:Adfeno
- Palestrante e consultor sobre /software/ livre (não confundir com
  gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
  instantaneamente comigo no endereço abaixo.
- Contato: https://libreplanet.org/wiki/User:Adfeno#vCard
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
  Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
  GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
  (apenas sem DRM), PNG, TXT, WEBM.

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

* Re: Nested smart quotes
  2017-10-05 21:56 ` Nested smart quotes Adonay Felipe Nogueira
@ 2017-10-05 22:21   ` Martin Alsinet
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Alsinet @ 2017-10-05 22:21 UTC (permalink / raw)
  To: Adonay Felipe Nogueira, emacs-orgmode

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

On Thu, Oct 5, 2017 at 4:58 PM Adonay Felipe Nogueira <adfeno@hyperbola.info>
wrote:

> What about using org-entities for these quotes?
>
> \ldquo{}Hello \lsquo{}World\rsquo{}!\rdquo{}
>
> This is Org mode syntax, not LaTeX.
>
>
Adonay:

I wanted to solve this using smart quotes, that is when I write I don't
have to worry with anything other than writing, and the light formatting of
org-mode is great for that (* for emphasis, / for italics, etc.) While the
solution you are proposing is technically correct, it achieves the result,
I find it too verbose and distracting from the text.

Actually I solved the problem by upgrading to org-mode 9.1.2 and leaving a
space between the inner quote and the enclosing double quote.

Thanks and regards


Martín

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

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

end of thread, other threads:[~2017-10-05 22:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 16:27 Nested smart quotes Martin Alsinet
2017-10-05 17:22 ` Colin Baxter
2017-10-05 17:39   ` Martin Alsinet
2017-10-05 18:46 ` Nicolas Goaziou
2017-10-05 19:13 ` Nick Dokos
2017-10-05 19:41   ` Colin Baxter
2017-10-05 19:41   ` Martin Alsinet
2017-10-05 21:36     ` Nested smart quotes [fixed] Martin Alsinet
2017-10-05 21:56 ` Nested smart quotes Adonay Felipe Nogueira
2017-10-05 22:21   ` Martin Alsinet

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).