emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Quotes not being converted correctly for LaTeX export
@ 2013-03-08 17:27 Suvayu Ali
  2013-03-08 17:33 ` Jambunathan K
  0 siblings, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2013-03-08 17:27 UTC (permalink / raw)
  To: Emacs Org mode

Hi,

It seems double and single quotes are not being exported properly for
LaTeX export.  In a minimal Org instance, the following

  * Test
  "Orange box"
  'Orange box'

is exported as

  \section[Testing]{Testing}
  \label{sec-1}
  "Orange box"
  'Orange box'

whereas I would expect the following

  \section[Testing]{Testing}
  \label{sec-1}
  ``Orange box''
  `Orange box'

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 17:27 Quotes not being converted correctly for LaTeX export Suvayu Ali
@ 2013-03-08 17:33 ` Jambunathan K
  2013-03-08 17:46   ` Suvayu Ali
  0 siblings, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-03-08 17:33 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs Org mode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi,
>
> It seems double and single quotes are not being exported properly for
> LaTeX export.  In a minimal Org instance, the following
>
>   * Test
>   "Orange box"
>   'Orange box'
>
> is exported as
>
>   \section[Testing]{Testing}
>   \label{sec-1}
>   "Orange box"
>   'Orange box'
>
> whereas I would expect the following
>
>   \section[Testing]{Testing}
>   \label{sec-1}
>   ``Orange box''
>   `Orange box'

#+OPTIONS: ':t

,----[ C-h v org-export-with-smart-quotes RET ]
| org-export-with-smart-quotes is a variable defined in `ox.el'.
| Its value is nil
| 
| Documentation:
| Non-nil means activate smart quotes during export.
| This option can also be set with the #+OPTIONS: line,
| e.g. "':t".
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 24.4 of Emacs.
`----


> Hope this helps,

-- 

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 17:33 ` Jambunathan K
@ 2013-03-08 17:46   ` Suvayu Ali
  2013-03-08 17:55     ` Jambunathan K
  0 siblings, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2013-03-08 17:46 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs Org mode

Hi Jambunathan and others,

On Fri, Mar 08, 2013 at 11:03:39PM +0530, Jambunathan K wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> >
> > It seems double and single quotes are not being exported properly for
> > LaTeX export.  In a minimal Org instance, the following
> >
> >   * Test
> >   "Orange box"
> >   'Orange box'
> >
> > is exported as
> >
> >   \section[Testing]{Testing}
> >   \label{sec-1}
> >   "Orange box"
> >   'Orange box'
> >
> > whereas I would expect the following
> >
> >   \section[Testing]{Testing}
> >   \label{sec-1}
> >   ``Orange box''
> >   `Orange box'
> 
> #+OPTIONS: ':t
> 
> ,----[ C-h v org-export-with-smart-quotes RET ]

[...]

Thanks for pointing this out, but I still think this is a bug for LaTeX
export.  Quoting as ".." produces incorrect output in LaTeX, the correct
forms are `..' or ``..''.  This is even more important if you are
writing in a language that uses umlauts, and the situation can get
confusing as the character " is used to specify umlauts.

This is worth a thought since the old exporter did it right without any
special settings.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 17:46   ` Suvayu Ali
@ 2013-03-08 17:55     ` Jambunathan K
  2013-03-08 18:02       ` Suvayu Ali
  0 siblings, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-03-08 17:55 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs Org mode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Jambunathan and others,
>
> On Fri, Mar 08, 2013 at 11:03:39PM +0530, Jambunathan K wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> >
>> > It seems double and single quotes are not being exported properly for
>> > LaTeX export.  In a minimal Org instance, the following
>> >
>> >   * Test
>> >   "Orange box"
>> >   'Orange box'
>> >
>> > is exported as
>> >
>> >   \section[Testing]{Testing}
>> >   \label{sec-1}
>> >   "Orange box"
>> >   'Orange box'
>> >
>> > whereas I would expect the following
>> >
>> >   \section[Testing]{Testing}
>> >   \label{sec-1}
>> >   ``Orange box''
>> >   `Orange box'
>> 
>> #+OPTIONS: ':t
>> 
>> ,----[ C-h v org-export-with-smart-quotes RET ]
>
> [...]
>
> Thanks for pointing this out, but I still think this is a bug for LaTeX
> export.  Quoting as ".." produces incorrect output in LaTeX, the correct
> forms are `..' or ``..''.  This is even more important if you are
> writing in a language that uses umlauts, and the situation can get
> confusing as the character " is used to specify umlauts.
>
> This is worth a thought since the old exporter did it right without any
> special settings.

I get GRAVE ACCENT and APOSTROPHE.  You are requesting the exact same
chars.  I am copy pasting from my latex buffer here.  

``Orange box''
`Orange box'

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 17:55     ` Jambunathan K
@ 2013-03-08 18:02       ` Suvayu Ali
  2013-03-08 18:14         ` Jambunathan K
  0 siblings, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2013-03-08 18:02 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs Org mode

Hi,

On Fri, Mar 08, 2013 at 11:25:25PM +0530, Jambunathan K wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> > On Fri, Mar 08, 2013 at 11:03:39PM +0530, Jambunathan K wrote:

[...]

> >> 
> >> #+OPTIONS: ':t
> >> 
> >> ,----[ C-h v org-export-with-smart-quotes RET ]
> >
> > [...]
> >
> > Thanks for pointing this out, but I still think this is a bug for LaTeX
> > export.  Quoting as ".." produces incorrect output in LaTeX, the correct
> > forms are `..' or ``..''.  This is even more important if you are
> > writing in a language that uses umlauts, and the situation can get
> > confusing as the character " is used to specify umlauts.
> >
> > This is worth a thought since the old exporter did it right without any
> > special settings.
> 
> I get GRAVE ACCENT and APOSTROPHE.  You are requesting the exact same
> chars.  I am copy pasting from my latex buffer here.  
> 
> ``Orange box''
> `Orange box'

Sorry I think you misunderstood me.  What I meant was following your
suggestion fixes the issue for me.  However I'm raising the question if
having to explicitly set the "':t" option to get ``..'' as output is a
reasonable expectation for LaTeX export since the default is actually
incorrect LaTeX.

I hope I was clear this time around.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:02       ` Suvayu Ali
@ 2013-03-08 18:14         ` Jambunathan K
  2013-03-08 18:27           ` Bastien
  0 siblings, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-03-08 18:14 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs Org mode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi,
>
> On Fri, Mar 08, 2013 at 11:25:25PM +0530, Jambunathan K wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> > On Fri, Mar 08, 2013 at 11:03:39PM +0530, Jambunathan K wrote:
>
> [...]
>
>> >> 
>> >> #+OPTIONS: ':t
>> >> 
>> >> ,----[ C-h v org-export-with-smart-quotes RET ]
>> >
>> > [...]
>> >
>> > Thanks for pointing this out, but I still think this is a bug for LaTeX
>> > export.  Quoting as ".." produces incorrect output in LaTeX, the correct
>> > forms are `..' or ``..''.  This is even more important if you are
>> > writing in a language that uses umlauts, and the situation can get
>> > confusing as the character " is used to specify umlauts.
>> >
>> > This is worth a thought since the old exporter did it right without any
>> > special settings.
>> 
>> I get GRAVE ACCENT and APOSTROPHE.  You are requesting the exact same
>> chars.  I am copy pasting from my latex buffer here.  
>> 
>> ``Orange box''
>> `Orange box'
>
> Sorry I think you misunderstood me.  What I meant was following your
> suggestion fixes the issue for me.  However I'm raising the question if
> having to explicitly set the "':t" option to get ``..'' as output is a
> reasonable expectation for LaTeX export since the default is actually
> incorrect LaTeX.

You should have simply stated.
        It works. Can we have the default setting changed?

instead of "Thanks ... but" which I parse as "Thanks ... but it doesn't
work".



Install a filter function for options  

(add-to-list 'org-export-filter-options-functions 'org-latex-options-function)


(defun org-latex-options-function (info backend)
 (when (eq backend 'latex)
  (plist-put info :with-smart-quotes t)))

If the above snippet doesn't work you can search the mailing list for
Nicolas recipe.

> I hope I was clear this time around.
>
> Cheers,

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:14         ` Jambunathan K
@ 2013-03-08 18:27           ` Bastien
  2013-03-08 18:33             ` Jambunathan K
  2013-03-08 21:28             ` Nicolas Goaziou
  0 siblings, 2 replies; 17+ messages in thread
From: Bastien @ 2013-03-08 18:27 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs Org mode

There is still something wrong here: if french users use
(setq org-export-smart-quotes-alist t) and do not use
\usepackage[french]{babel}, the quotes will not be very
smart, they will disappear.

I suggest having an option for the babel package: when
a string (equal org-latex-use-package-babel "french"), it
will trigger the insertion of \usepackage[french]{babel}
in the header.  When an alist, it will trigger the insertion
of \usepackage... depending on the current language.

I think {babel} is common enough to deserve its own option,
but maybe I'm overrating its use.

Nicolas, what do you think?

-- 
 Bastien

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:27           ` Bastien
@ 2013-03-08 18:33             ` Jambunathan K
  2013-03-08 18:51               ` Bastien
  2013-03-08 21:28             ` Nicolas Goaziou
  1 sibling, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-03-08 18:33 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode

Bastien <bzg@altern.org> writes:

> There is still something wrong here: if french users use
> (setq org-export-smart-quotes-alist t) and do not use
> \usepackage[french]{babel}, the quotes will not be very
> smart, they will disappear.
>
> I suggest having an option for the babel package: when
> a string (equal org-latex-use-package-babel "french"), it
> will trigger the insertion of \usepackage[french]{babel}
> in the header.  When an alist, it will trigger the insertion
> of \usepackage... depending on the current language.
>
> I think {babel} is common enough to deserve its own option,
> but maybe I'm overrating its use.
>
> Nicolas, what do you think?

Use #+LANGUAGE

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:33             ` Jambunathan K
@ 2013-03-08 18:51               ` Bastien
  2013-03-08 19:07                 ` Jambunathan K
  0 siblings, 1 reply; 17+ messages in thread
From: Bastien @ 2013-03-08 18:51 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs Org mode

Jambunathan K <kjambunathan@gmail.com> writes:

> Use #+LANGUAGE

How does it solve the problem I'm pointing?

-- 
 Bastien

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:51               ` Bastien
@ 2013-03-08 19:07                 ` Jambunathan K
  0 siblings, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2013-03-08 19:07 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode

Bastien <bzg@altern.org> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> Use #+LANGUAGE
>
> How does it solve the problem I'm pointing?

So you didn't want this?

    \og Orange box\fg{}
    \og Orange box\fg{}

                

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 18:27           ` Bastien
  2013-03-08 18:33             ` Jambunathan K
@ 2013-03-08 21:28             ` Nicolas Goaziou
  2013-03-08 22:21               ` Suvayu Ali
  2013-03-09  9:40               ` Bastien
  1 sibling, 2 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-03-08 21:28 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode, Jambunathan K

Hello,

Bastien <bzg@altern.org> writes:

> There is still something wrong here: if french users use
> (setq org-export-smart-quotes-alist t) and do not use
> \usepackage[french]{babel}, the quotes will not be very
> smart, they will disappear.
>
> I suggest having an option for the babel package: when
> a string (equal org-latex-use-package-babel "french"), it
> will trigger the insertion of \usepackage[french]{babel}
> in the header.  When an alist, it will trigger the insertion
> of \usepackage... depending on the current language.
>
> I think {babel} is common enough to deserve its own option,
> but maybe I'm overrating its use.
>
> Nicolas, what do you think?

Latex back-end already takes care of setting the correct Babel language
according to LANGUAGE keyword.

The only problem is when user doesn't load Babel at all, but still wants
to use smart quotes. Is it meaningful? Even if it is, I suspect it is
quite rare. So, dropping a note in `org-export-with-smart-quotes'
docstring would be enough.

As you probably know, I'm not a big fan of package autoloading.


Regards,

-- 
Nicolas Goaziou

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 21:28             ` Nicolas Goaziou
@ 2013-03-08 22:21               ` Suvayu Ali
  2013-03-08 22:45                 ` Nicolas Goaziou
  2013-03-09  9:40               ` Bastien
  1 sibling, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2013-03-08 22:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas,

On Fri, Mar 08, 2013 at 10:28:17PM +0100, Nicolas Goaziou wrote:
> 
> The only problem is when user doesn't load Babel at all, but still wants
> to use smart quotes. Is it meaningful? Even if it is, I suspect it is
> quite rare. So, dropping a note in `org-export-with-smart-quotes'
> docstring would be enough.

I'm not exactly sure what you mean here.  All my documents are in
English, so I rarely use babel.  But I do want my quotes to look
correct.  So I use ``..'' instead of "..".  The old LaTeX exporter used
to translate ".." to ``..'' by default, which the new one does not do.

Since "smart quote" for LaTeX is usually a necessity rather than a
preference, would it make sense to have it enabled by default for the
LaTeX backend and all other backends that derive from it?

Of course if that is not reasonable, I can always get use the filter
suggested by Jambunathan earlier in the thread.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 22:21               ` Suvayu Ali
@ 2013-03-08 22:45                 ` Nicolas Goaziou
  2013-03-09  9:39                   ` Bastien
  0 siblings, 1 reply; 17+ messages in thread
From: Nicolas Goaziou @ 2013-03-08 22:45 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hello,

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> I'm not exactly sure what you mean here.  All my documents are in
> English, so I rarely use babel.  But I do want my quotes to look
> correct.  So I use ``..'' instead of "..".  The old LaTeX exporter used
> to translate ".." to ``..'' by default, which the new one does not do.
>
> Since "smart quote" for LaTeX is usually a necessity rather than a
> preference, would it make sense to have it enabled by default for the
> LaTeX backend and all other backends that derive from it?

It makes sense indeed. latex back-end will use, by default, smart
quotes.


Regards,

-- 
Nicolas Goaziou

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 22:45                 ` Nicolas Goaziou
@ 2013-03-09  9:39                   ` Bastien
  2013-04-16  9:45                     ` Bastien
  0 siblings, 1 reply; 17+ messages in thread
From: Bastien @ 2013-03-09  9:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> It makes sense indeed. latex back-end will use, by default, smart
> quotes.

We should turn this on by default unless we have a mechanism to fix
the LaTeX headers, if needed.

The default behavior now is wrong: for example, if I use quotes in
a document with #+LANGUAGE: fr but no LaTeX Babel in the header,
then the \og ... \fg{} will not be processed correctly and the
quotes won't be displayed.

Let's go slowly here.  I'm not fan of auto-inserting packages too but
maybe this is just a matter of asking the user once, then letting him
save her choice somehow.

Thanks,

-- 
 Bastien

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-08 21:28             ` Nicolas Goaziou
  2013-03-08 22:21               ` Suvayu Ali
@ 2013-03-09  9:40               ` Bastien
  2013-03-09 15:03                 ` Nicolas Goaziou
  1 sibling, 1 reply; 17+ messages in thread
From: Bastien @ 2013-03-09  9:40 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Emacs Org mode, Jambunathan K

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> The only problem is when user doesn't load Babel at all, but still wants
> to use smart quotes. Is it meaningful?

It is not meaningful but it is now the default, this is what needs to
be fixed.  Either by not using smart-quotes by default, or by letting 
the user what to do.  I prefer the second solution :)

-- 
 Bastien

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-09  9:40               ` Bastien
@ 2013-03-09 15:03                 ` Nicolas Goaziou
  0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-03-09 15:03 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode, Jambunathan K

Hello,

Bastien <bzg@altern.org> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> The only problem is when user doesn't load Babel at all, but still wants
>> to use smart quotes. Is it meaningful?
>
> It is not meaningful but it is now the default, 

Actually, as Suvayu Ali suggested, it is meaningful only in the default
case, which is no Babel package and English language.

As soon as you tweak either LANGUAGE keyword or
`org-export-default-language', you must use Babel.

> this is what needs to be fixed. Either by not using smart-quotes by
> default, or by letting the user what to do. I prefer the second
> solution :)

Smart-quotes works by heuristics. It will fail in some cases. That's why
I think it shouldn't be on by default (even in latex back-end). Also,
smart quotes can be turned on/off at will, so the user can decide what
to do.

It just a problem of providing sensible defaults. The old exporter
provided smart quotes by default in LaTeX, as you know. I'm not sure it
is a good move, but at least, it is consistent with the previous
implementation.


Regards,

-- 
Nicolas Goaziou

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

* Re: Quotes not being converted correctly for LaTeX export
  2013-03-09  9:39                   ` Bastien
@ 2013-04-16  9:45                     ` Bastien
  0 siblings, 0 replies; 17+ messages in thread
From: Bastien @ 2013-04-16  9:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hi Nicolas,

Bastien <bzg@altern.org> writes:

>> It makes sense indeed. latex back-end will use, by default, smart
>> quotes.
>
> We should turn this on by default unless we have a mechanism to fix
> the LaTeX headers, if needed.
>
> The default behavior now is wrong: for example, if I use quotes in
> a document with #+LANGUAGE: fr but no LaTeX Babel in the header,
> then the \og ... \fg{} will not be processed correctly and the
> quotes won't be displayed.

I fixed this:
  http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=320b63

-- 
 Bastien

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

end of thread, other threads:[~2013-04-16  9:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-08 17:27 Quotes not being converted correctly for LaTeX export Suvayu Ali
2013-03-08 17:33 ` Jambunathan K
2013-03-08 17:46   ` Suvayu Ali
2013-03-08 17:55     ` Jambunathan K
2013-03-08 18:02       ` Suvayu Ali
2013-03-08 18:14         ` Jambunathan K
2013-03-08 18:27           ` Bastien
2013-03-08 18:33             ` Jambunathan K
2013-03-08 18:51               ` Bastien
2013-03-08 19:07                 ` Jambunathan K
2013-03-08 21:28             ` Nicolas Goaziou
2013-03-08 22:21               ` Suvayu Ali
2013-03-08 22:45                 ` Nicolas Goaziou
2013-03-09  9:39                   ` Bastien
2013-04-16  9:45                     ` Bastien
2013-03-09  9:40               ` Bastien
2013-03-09 15:03                 ` Nicolas Goaziou

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