Re: [O] Quotes for LaTeX export

2014-02-06 Thread Michael Strey
Hi Laurens,

_...@lvh.io writes:

[...]

 The preferred way to do that these days is, in the preamble:

 \usepackage{csquotes}

 ... and then later:

 \enquote{something}

 I think it would make sense to support this for org, and perhaps eventually
 make it default behavior. FWIW: I had no idea about this until it bit me
 when my LaTeX document suddenly had bogus quotes in it.

IMHO, it would be nice to have a customizable
org-export-user-smart-quote-alist as already mentioned by Rasmus.  This
would give the maximal flexibility to comply with this wish and similar wishes.

BUT in this concrete case, the problem can be tackled from the LaTeX
side as well.  Section 10.8 of the documentation of the csquote package
shows a way for documents with only one language:

\documentclass{...}
\usepackage[german]{babel}
\usepackage[babel=once]{csquotes}
\defineshorthand{`}{\openautoquote}
\defineshorthand{'}{\closeautoquote}

Best regards
-- 
Michael Strey
http://www.strey.biz




Re: [O] Quotes for LaTeX export

2014-02-05 Thread Laurens Van Houtven
Hi Rasmus,

On Tue, Feb 4, 2014 at 10:42 PM, Rasmus ras...@gmx.us wrote:

 Hi Laurens,

 Laurens Van Houtven _...@lvh.io writes:

  I'm writing a book using org-mode. On export, org-mode turns double
 quotes
  like hello into ``hello''. Some modern LaTeXes no longer support that
  form, instead preferring semantic markup. (The reasoning being that the
  markup implies a particular quote style, whereas quotation style is
  language-dependent.)

 This is not true.  Quotes depend on your LANGUAGE-cookie.  See
 org-export-smart-quotes-alist.


To more accurately: *my* org-mode is turning double quotes into
``something'' when I export to LaTeX. I do not have an explicit language
cookie set. That is the part you objected to, not the LaTeX part, right?


  As a result, I get
 
  The preferred way to do that these days is, in the preamble:
 
  \usepackage{csquotes}
 
  ... and then later:
 
  \enquote{something}

 But this would require us to load an extra package.  Org is quite
 capable of handling this on the lisp side (and Org ≠ LaTeX).  Clearly,
 we could have a org-export-user-smart-quote-alist taking priority over
 the predefined one.


A package that, IIUC, is quite commonly available. Plus, the consequence is
that on a bunch of new setups, you get busted quotes, whereas the csquote +
enquote approach AFAIK works on pretty much any reasonable LaTeX
installation.

That said, if org does it, that's fine by me too.

  I think it would make sense to support this for org, and perhaps
 eventually
  make it default behavior. FWIW: I had no idea about this until it bit me
  when my LaTeX document suddenly had bogus quotes in it.

 This has never happened to me, despite extensive usage of LaTeX for
 almost ten years.


This is a fairly new occurrence, and it is not true for all LaTeXes
currently available. The motivation is the one that I have given above:
quotations are language-specific and semantic markup is preferable. I don't
have an exact list of which, but e.g. in ConTeXt MkIV it is now the
default, and it is also the default for me on the current TeX Live when
using lualatex or xelatex. This leads me to believe that perhaps it is not
a *common* issue, but it

Here is an example:
https://f.cloud.github.com/assets/97816/2078835/cac687b6-8dc2-11e3-8b6a-00c1a8175c94.png

 If there is no interest to add this to org, how do I hack org so that this
  is what it does?

 The cleanest way would be a filter, probably
 org-export-filter-quote-block-functions and filter-plain-text.

 The easiest way would be a macro or simply redefining
 org-export-smart-quotes-alist to suit your needs.


thanks!
lvh


Re: [O] Quotes for LaTeX export

2014-02-05 Thread Laurens Van Houtven
On Wed, Feb 5, 2014 at 8:46 AM, Bastien b...@gnu.org wrote:

 Nick Dokos ndo...@gmail.com writes:

  IIRC, there was support for csquotes in the old exporter[fn:1] but I
 guess
  it went away when the new exporter came along.

 Yes, it'd be good to make it possible again to use
 \usepackage{csquotes} and \enquote{something}.


I guess it's obvious, but yes; I agree :)

hth
lvh


Re: [O] Quotes for LaTeX export

2014-02-05 Thread Rasmus
Hi Laurens,

Laurens Van Houtven _...@lvh.io writes:

 Hi Rasmus,

 On Tue, Feb 4, 2014 at 10:42 PM, Rasmus ras...@gmx.us wrote:

 Hi Laurens,

 Laurens Van Houtven _...@lvh.io writes:

  I'm writing a book using org-mode. On export, org-mode turns double
 quotes
  like hello into ``hello''. Some modern LaTeXes no longer support that
  form, instead preferring semantic markup. (The reasoning being that the
  markup implies a particular quote style, whereas quotation style is
  language-dependent.)

 This is not true.  Quotes depend on your LANGUAGE-cookie.  See
 org-export-smart-quotes-alist.


 To more accurately: *my* org-mode is turning double quotes into
 ``something'' when I export to LaTeX. I do not have an explicit language
 cookie set. That is the part you objected to, not the LaTeX part, right?

The language is org-export-default-language if no LANGUAGE is set.

  As a result, I get
 
  The preferred way to do that these days is, in the preamble:
 
  \usepackage{csquotes}
 
  ... and then later:
 
  \enquote{something}

 But this would require us to load an extra package.  Org is quite
 capable of handling this on the lisp side (and Org ≠ LaTeX).  Clearly,
 we could have a org-export-user-smart-quote-alist taking priority over
d the predefined one.


 A package that, IIUC, is quite commonly available. Plus, the consequence is
 that on a bunch of new setups, you get busted quotes, whereas the csquote +
 enquote approach AFAIK works on pretty much any reasonable LaTeX
 installation.

This is exactly the reasons why I don't want to use csquotes:

 \enquote{something}.

But check for instance org-latex-tables-booktabs, which makes optional
support for booktabs.  That kind of support for csquote is of course
OK.  One reason I'd not use this is that the quotes exported to HTML
and LaTeX are no longer in sync.  Which is why I'd rather see
customization through a user smart quote alist.


   I think it would make sense to support this for org, and perhaps
 eventually
  make it default behavior. FWIW: I had no idea about this until it bit me
  when my LaTeX document suddenly had bogus quotes in it.

 This has never happened to me, despite extensive usage of LaTeX for
 almost ten years.


 This is a fairly new occurrence, and it is not true for all LaTeXes
 currently available. The motivation is the one that I have given above:

See below.

 quotations are language-specific and semantic markup is preferable. 

Org already has semantic quote characters, namely '' and '.
Compare the output of

#+LANGUAGE: fr
#+OPTIONS: ':t
test

and

#+LANGUAGE: en
#+OPTIONS: ':t
test


 I don't have an exact list of which, but e.g. in ConTeXt MkIV it is
 now the default, and it is also the default for me on the current
 TeX Live when using lualatex or xelatex. This leads me to believe
 that perhaps it is not a *common* issue, but it

 Here is an example:
 https://f.cloud.github.com/assets/97816/2078835/cac687b6-8dc2-11e3-8b6a-00c1a8175c94.png

I'm unable to reproduce with TeXLive up-to-date 2013 with both XeLaTeX
and LuaLaTeX.  I don't have context installed.  Here's my code where I
tried to disable fancy features of fontspec:

   \documentclass{article}
   \usepackage{fontspec}
   \addfontfeatures{Mapping=}
   \addfontfeatures{Ligatures=}
   \begin{document}
   ``test''
   \end{document}

Could you share a snip that reproduces your problem?

–Rasmus

-- 
I hear there's rumors on the, uh, Internets. . .




Re: [O] Quotes for LaTeX export

2014-02-05 Thread Laurens Van Houtven
On Wed, Feb 5, 2014 at 1:12 PM, Rasmus ras...@gmx.us wrote:

 This is exactly the reasons why I don't want to use csquotes:

  \enquote{something}.


I'm not sure I understand. Are you suggesting the syntax is bad?

But check for instance org-latex-tables-booktabs, which makes optional
 support for booktabs.  That kind of support for csquote is of course
 OK.  One reason I'd not use this is that the quotes exported to HTML
 and LaTeX are no longer in sync.  Which is why I'd rather see
 customization through a user smart quote alist.


Okay, that's a fair argument. It would require consistent configuration in
more than one place, unless (I think?) Org's LaTeX export automagically
use/configure Babel.


I think it would make sense to support this for org, and perhaps
  eventually
   make it default behavior. FWIW: I had no idea about this until it bit
 me
   when my LaTeX document suddenly had bogus quotes in it.
 
  This has never happened to me, despite extensive usage of LaTeX for
  almost ten years.
 
 
  This is a fairly new occurrence, and it is not true for all LaTeXes
  currently available. The motivation is the one that I have given above:

 See below.

  quotations are language-specific and semantic markup is preferable.

 Org already has semantic quote characters, namely '' and '.


Right: I'm talking about TeX and not org-mode there. The semantic way to
say this is quoted is csquotes and \enquote.

Are those code points U+0022 QUOTATION MARK and U+0027 APOSTROPHE? (I am
not an org-mode expert. I'm assuming org-mode does operate on code points,
not bytes?)

   \documentclass{article}
\usepackage{fontspec}
\addfontfeatures{Mapping=}
\addfontfeatures{Ligatures=}
\begin{document}
``test''
\end{document}

 Could you share a snip that reproduces your problem?


That appears to compile correctly on my machine as well. Perhaps there is a
discrepancy between how I'm building the tex file and how org is building
the intermediary tex file. I will investigate :)

thanks again
lvh


Re: [O] Quotes for LaTeX export

2014-02-05 Thread Nicolas Goaziou
Hello,

Laurens Van Houtven _...@lvh.io writes:

 On Wed, Feb 5, 2014 at 8:46 AM, Bastien b...@gnu.org wrote:

 Nick Dokos ndo...@gmail.com writes:

  IIRC, there was support for csquotes in the old exporter[fn:1] but I
 guess
  it went away when the new exporter came along.

 Yes, it'd be good to make it possible again to use
 \usepackage{csquotes} and \enquote{something}.


 I guess it's obvious, but yes; I agree :)

I'm still not convinced about the need to support this package out of
the box.

We already have a working solution for many languages, and more general
that this LaTeX-centered command. It has limitations, but csquotes
support would inherit them anyway since it would be built on top of
smart quotes mechanism.

If you want to csquotes, I suggest to:

  1. Disable smart quotes.

  2. Define a macro like:

 #+MACRO: q \enquote{$1}

  3. Call the macro when you need it:

 {{{q(something)}}}


Regards,

-- 
Nicolas Goaziou



Re: [O] Quotes for LaTeX export

2014-02-05 Thread Rasmus
Hi Laurens,

Laurens Van Houtven _...@lvh.io writes:

 On Wed, Feb 5, 2014 at 1:12 PM, Rasmus ras...@gmx.us wrote:

 This is exactly the reasons why I don't want to use csquotes:

  \enquote{something}.


 I'm not sure I understand. Are you suggesting the syntax is bad?

I'm suggesting it makes adds noise that makes the source even harder
to read than it is.  With Emacs you could of course make it look
pretty again. . .

 But check for instance org-latex-tables-booktabs, which makes optional
 support for booktabs.  That kind of support for csquote is of course
 OK.  One reason I'd not use this is that the quotes exported to HTML
 and LaTeX are no longer in sync.  Which is why I'd rather see
 customization through a user smart quote alist.

 Okay, that's a fair argument. It would require consistent configuration in
 more than one place, unless (I think?) Org's LaTeX export automagically
 use/configure Babel.

To use Babel add (AUTO babel nil) to org-latex-packages-alist or
-default-package-alist.  AUTO is replaced with the correct language.


 Org already has semantic quote characters, namely '' and '.

 Right: I'm talking about TeX and not org-mode there. The semantic way to
 say this is quoted is csquotes and \enquote.

But this is the Org-ML.  I assume you're interested in using Org for
producing your tex files?

 Are those code points U+0022 QUOTATION MARK and U+0027 APOSTROPHE? (I am
 not an org-mode expert. I'm assuming org-mode does operate on code points,
 not bytes?).  

On my computer I produce the quotation with S-2.  On most layouts
these are the most straightforward quoting characters.  If you use
smartquotes they are exported according to your language.


\documentclass{article}
\usepackage{fontspec}
\addfontfeatures{Mapping=}
\addfontfeatures{Ligatures=}
\begin{document}
``test''
\end{document}

 Could you share a snip that reproduces your problem?


 That appears to compile correctly on my machine as well. Perhaps there is a
 discrepancy between how I'm building the tex file and how org is building
 the intermediary tex file. I will investigate :)

I was not able to produce non-working files via Org either. . .  But I
didn't test from emacs -q.

–Rasmus

-- 
C is for Cookie



Re: [O] Quotes for LaTeX export

2014-02-05 Thread Laurens Van Houtven
On Wed, Feb 5, 2014 at 2:37 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:

 We already have a working solution for many languages, and more general
 that this LaTeX-centered command. It has limitations, but csquotes
 support would inherit them anyway since it would be built on top of
 smart quotes mechanism.


This is only for LaTeX-export, so I don't see how LaTeX-centered is
relevant. I really don't see how it affects other export langs; plus, it
was in the old LaTeX exporter anyway!

The reason is that the exporter occasionally produces TeX code that renders
poorly on some setups (we're still figuring out which those are exactly).
csquotes never does this.

lvh


Re: [O] Quotes for LaTeX export

2014-02-05 Thread Laurens Van Houtven
Hi Rasmus,

On Wed, Feb 5, 2014 at 2:44 PM, Rasmus ras...@gmx.us wrote:

  Org already has semantic quote characters, namely '' and '.
 
  Right: I'm talking about TeX and not org-mode there. The semantic way to
  say this is quoted is csquotes and \enquote.

 But this is the Org-ML.  I assume you're interested in using Org for
 producing your tex files?


Yes, that is the only thing I am doing. I am trying to get org's idea of
semantic quoting to map to LaTeX's idea of semantic quoting. As a result I
also don't understand why anyone cares what the \enquote{whatever} looks
like in the TeX file. Personally I only care what it looks like in Org.

This is also why I think the macro solution is bad. Org has semantic
quotes. It's just not doing a good job of convincing my LaTeX stack that it
has semantic quotes.


 I was not able to produce non-working files via Org either. . .  But I
 didn't test from emacs -q.


The exported TeX source appears to be functionally equivalent to the
snippet you pasted, so the issue is probably in the TeX step.

thanks again,
lvh


Re: [O] Quotes for LaTeX export

2014-02-05 Thread Nicolas Goaziou
Laurens Van Houtven _...@lvh.io writes:

 On Wed, Feb 5, 2014 at 2:37 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:

 We already have a working solution for many languages, and more general
 that this LaTeX-centered command. It has limitations, but csquotes
 support would inherit them anyway since it would be built on top of
 smart quotes mechanism.


 This is only for LaTeX-export, so I don't see how LaTeX-centered is
 relevant. I really don't see how it affects other export langs;

The current quote mechanism is built at the export framework level so
that each export back-end doesn't need to bring up its own recipe. I'd
rather not add back-end specific code unless it is an improvement.

So far, I don't see the improvement. Do you have an example of an Org
document that produces a wrong tex file, which would be correct if it
used csquotes?

 plus, it was in the old LaTeX exporter anyway!

True. And?

I gave you a solution to use csquotes feature in your documents.

 The reason is that the exporter occasionally produces TeX code that renders
 poorly on some setups (we're still figuring out which those are exactly).
 csquotes never does this.

I assume it will render poorly in setups that do not use that package.

I'm surprised that csquotes is compulsory in some setups. Of course,
it would be good to know about them so we can find a workaround.


Regards,

-- 
Nicolas Goaziou



Re: [O] Quotes for LaTeX export

2014-02-04 Thread Rasmus
Hi Laurens,

Laurens Van Houtven _...@lvh.io writes:

 I'm writing a book using org-mode. On export, org-mode turns double quotes
 like hello into ``hello''. Some modern LaTeXes no longer support that
 form, instead preferring semantic markup. (The reasoning being that the
 markup implies a particular quote style, whereas quotation style is
 language-dependent.)

This is not true.  Quotes depend on your LANGUAGE-cookie.  See
org-export-smart-quotes-alist.


 As a result, I get

 The preferred way to do that these days is, in the preamble:

 \usepackage{csquotes}

 ... and then later:

 \enquote{something}

But this would require us to load an extra package.  Org is quite
capable of handling this on the lisp side (and Org ≠ LaTeX).  Clearly,
we could have a org-export-user-smart-quote-alist taking priority over
the predefined one.

 I think it would make sense to support this for org, and perhaps eventually
 make it default behavior. FWIW: I had no idea about this until it bit me
 when my LaTeX document suddenly had bogus quotes in it.

This has never happened to me, despite extensive usage of LaTeX for
almost ten years.

 If there is no interest to add this to org, how do I hack org so that this
 is what it does?

The cleanest way would be a filter, probably
org-export-filter-quote-block-functions and filter-plain-text.  

The easiest way would be a macro or simply redefining
org-export-smart-quotes-alist to suit your needs.

Hope it helps.

—Rasmus

-- 
Er du tosset for noge' lårt!




Re: [O] Quotes for LaTeX export

2014-02-04 Thread Nick Dokos
Rasmus ras...@gmx.us writes:

 Hi Laurens,

 Laurens Van Houtven _...@lvh.io writes:

 I'm writing a book using org-mode. On export, org-mode turns double quotes
 like hello into ``hello''. Some modern LaTeXes no longer support that
 form, instead preferring semantic markup. (The reasoning being that the
 markup implies a particular quote style, whereas quotation style is
 language-dependent.)

 This is not true.  Quotes depend on your LANGUAGE-cookie.  See
 org-export-smart-quotes-alist.


 As a result, I get

 The preferred way to do that these days is, in the preamble:

 \usepackage{csquotes}

 ... and then later:

 \enquote{something}

 But this would require us to load an extra package.  Org is quite
 capable of handling this on the lisp side (and Org ≠ LaTeX).  Clearly,
 we could have a org-export-user-smart-quote-alist taking priority over
 the predefined one.

 I think it would make sense to support this for org, and perhaps eventually
 make it default behavior. FWIW: I had no idea about this until it bit me
 when my LaTeX document suddenly had bogus quotes in it.

 This has never happened to me, despite extensive usage of LaTeX for
 almost ten years.

 If there is no interest to add this to org, how do I hack org so that this
 is what it does?

 The cleanest way would be a filter, probably
 org-export-filter-quote-block-functions and filter-plain-text.  

 The easiest way would be a macro or simply redefining
 org-export-smart-quotes-alist to suit your needs.

 Hope it helps.


IIRC, there was support for csquotes in the old exporter[fn:1] but I guess
it went away when the new exporter came along.

Nick

Footnotes:

[fn:1] e.g. see

 http://thread.gmane.org/gmane.emacs.orgmode/21588

and the following commit which applies to the *OLD* latex exporter:

,
| commit 2b9afb9e63d2fd60a3bb09e33c9d4abb01586339
| Author: Bastien Guerry b...@altern.org
| Date:   Mon Jul 11 15:10:00 2011 +0200
| 
| org-latex.el: New defcustom `org-export-latex-quotes' to control quotes.
| 
| * org-latex.el (org-export-latex-quotes): New defcustom.
| (org-export-latex-quotation-marks): Use it.
| 
| This allows users to define what quotes they want to use as a
| replacement of english double-quotes while exporting to LaTeX.
| 
| In particular, if you use the csquote package, you can configure
| Org to output something like \endquote{some quoted text} instead
| of some quoted text.
| 
| Thanks to Frederik for bringing this issue up, and to Thomas S.
| Dye, Nick Dokos and Stefan Nobis for elaborating this solution.
`

although I cannot find the thread of that discussion on gmane.




Re: [O] Quotes for LaTeX export

2014-02-04 Thread Bastien
Nick Dokos ndo...@gmail.com writes:

 IIRC, there was support for csquotes in the old exporter[fn:1] but I guess
 it went away when the new exporter came along.

Yes, it'd be good to make it possible again to use
\usepackage{csquotes} and \enquote{something}.

-- 
 Bastien