emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
@ 2011-08-19  6:50 Andras Major
  2011-08-19  9:35 ` Daniel Bausch
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Andras Major @ 2011-08-19  6:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

in TeX and LaTeX, the width of the glue (blank space) after a "." can
be one of two different values, depending on the context.  There is
always a longer space between sentences than after a "." that doesn't
mark the end of a sentence (abbreviations, dates, etc.).  Since
TeX/LaTeX usually can't recognize the latter case by itself, one can
help out by writing ".\ " or ".~" explicitly to enforce a short space.
Without these hints, printed output will look typographically wrong.

Org-mode export doesn't allow me to easily include these hints without
affecting readability and export to other formats.  Therefore I ask
that LaTeX export places ". " or ".\ " in the output automatically
depending on the context:

- If, in the source, the "." precedes a double space " " or a newline,
  use ". ".

- In any other case, use ".\ ".

The reason this would work is the Emacs convention of writing ASCII
such that there is at least one more space (at least two) between
sentences.  I believe that the Emacs fill-* functions also make use of
this convention.

Thanks,

  András

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
@ 2011-08-19  9:35 ` Daniel Bausch
  2011-08-19 10:00 ` Stefan Nobis
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Daniel Bausch @ 2011-08-19  9:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I'd like to note, that ".~" would lead to a hard space, that disallows a line 
break, so I think only ".\ " is correct, although Emacs M-q does not break 
after ". " with a single space, too, to be able to detect sentence ends.

Daniel

Am Freitag, 19. August 2011, 08:50:52 schrieb Andras Major:
> in TeX and LaTeX, the width of the glue (blank space) after a "." can
> be one of two different values, depending on the context.  There is
> always a longer space between sentences than after a "." that doesn't
> mark the end of a sentence (abbreviations, dates, etc.).  Since
> TeX/LaTeX usually can't recognize the latter case by itself, one can
> help out by writing ".\ " or ".~" explicitly to enforce a short space.
> Without these hints, printed output will look typographically wrong.
> 
> Org-mode export doesn't allow me to easily include these hints without
> affecting readability and export to other formats.  Therefore I ask
> that LaTeX export places ". " or ".\ " in the output automatically
> depending on the context:
> 
> - If, in the source, the "." precedes a double space " " or a newline,
>   use ". ".
> 
> - In any other case, use ".\ ".
> 
> The reason this would work is the Emacs convention of writing ASCII
> such that there is at least one more space (at least two) between
> sentences.  I believe that the Emacs fill-* functions also make use of
> this convention.
> 
> Thanks,
> 
>   András

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
  2011-08-19  9:35 ` Daniel Bausch
@ 2011-08-19 10:00 ` Stefan Nobis
  2011-08-19 11:03   ` András Major
  2011-08-19 11:22 ` Carsten Dominik
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Nobis @ 2011-08-19 10:00 UTC (permalink / raw)
  To: Andras Major; +Cc: emacs-orgmode

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

Andras Major <andras.g.major@gmail.com> writes:

> Hi,

> in TeX and LaTeX, the width of the glue (blank space) after a "." can
> be one of two different values, depending on the context.

And depending on the use of \nonfrenchspacing and \frenchspacing.

> There is always a longer space between sentences than after a "."
> that doesn't mark the end of a sentence

This could easily be turned off with the use of a single \frenchspacing
in the preamble (or in the document; you may switch between the two in
the document as often as you like; e.g. \frenchspacing is active
starting from the point TeX reads the macro until it is set back to
\nonfrenchspacing).

-- 
Until the next mail...,
Stefan.

[-- Attachment #2: Type: application/pgp-signature, Size: 454 bytes --]

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19 10:00 ` Stefan Nobis
@ 2011-08-19 11:03   ` András Major
  2011-08-19 13:51     ` William Henney
  0 siblings, 1 reply; 12+ messages in thread
From: András Major @ 2011-08-19 11:03 UTC (permalink / raw)
  To: emacs-orgmode

> > There is always a longer space between sentences than after a "."
> > that doesn't mark the end of a sentence
> 
> This could easily be turned off with the use of a single \frenchspacing
> in the preamble (or in the document; you may switch between the two in
> the document as often as you like; e.g. \frenchspacing is active
> starting from the point TeX reads the macro until it is set back to
> \nonfrenchspacing).

I'm fully aware of that, but that also messes up the spacing between
sentences.  My proposed solution should be robust enough to be
more-or-less foolproof yet produce nice-looking output.

  András

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
  2011-08-19  9:35 ` Daniel Bausch
  2011-08-19 10:00 ` Stefan Nobis
@ 2011-08-19 11:22 ` Carsten Dominik
  2011-08-19 14:55 ` Rasmus
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2011-08-19 11:22 UTC (permalink / raw)
  To: Andras Major; +Cc: emacs-orgmode


On Aug 19, 2011, at 8:50 AM, Andras Major wrote:

> Hi,
> 
> in TeX and LaTeX, the width of the glue (blank space) after a "." can
> be one of two different values, depending on the context.  There is
> always a longer space between sentences than after a "." that doesn't
> mark the end of a sentence (abbreviations, dates, etc.).  Since
> TeX/LaTeX usually can't recognize the latter case by itself, one can
> help out by writing ".\ " or ".~" explicitly to enforce a short space.
> Without these hints, printed output will look typographically wrong.
> 
> Org-mode export doesn't allow me to easily include these hints without
> affecting readability and export to other formats.  Therefore I ask
> that LaTeX export places ". " or ".\ " in the output automatically
> depending on the context:
> 
> - If, in the source, the "." precedes a double space " " or a newline,
>  use ". ".
> 
> - In any other case, use ".\ ".
> 
> The reason this would work is the Emacs convention of writing ASCII
> such that there is at least one more space (at least two) between
> sentences.  I believe that the Emacs fill-* functions also make use of
> this convention.

+1

I do like this idea.  I am a big fan of the Emacs convention
to use two spaces after a sentence - such a big fan that I have trouble
reading ascii text where this convention is not used.

- Carsten

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19 11:03   ` András Major
@ 2011-08-19 13:51     ` William Henney
  2011-08-19 18:39       ` András Major
  0 siblings, 1 reply; 12+ messages in thread
From: William Henney @ 2011-08-19 13:51 UTC (permalink / raw)
  To: András Major; +Cc: emacs-orgmode

Hi András

2011/8/19 András Major <andras.g.major@gmail.com>:
>> > There is always a longer space between sentences than after a "."
>> > that doesn't mark the end of a sentence
>>
>> This could easily be turned off with the use of a single \frenchspacing
>> in the preamble (or in the document; you may switch between the two in
>> the document as often as you like; e.g. \frenchspacing is active
>> starting from the point TeX reads the macro until it is set back to
>> \nonfrenchspacing).
>
> I'm fully aware of that, but that also messes up the spacing between
> sentences.  My proposed solution should be robust enough to be
> more-or-less foolproof yet produce nice-looking output.
>

What is nice-looking is a matter of personal taste. Personally, I tend
to prefer everything close-set, as with \frenchspacing, although that
is mainly because it is very easy to screw up with LaTeX's default
spacing, and then things look terrible. There is an interesting
discussion at
http://en.wikipedia.org/wiki/History_of_sentence_spacing

If you _do_ want to keep the wider inter-sentence spacing, then you
also need to worry about sentences that end with upper-case letters.
For instance, in LaTeX you should write:

"The paper by A. Major et~al.\ was discussed by the General Assembly
of the UN\@."

Without the "\@" LaTeX would not recognize the period following "UN"
to be sentence-ending. Note that there is no need to do anything
special after the "A."

If you are going to go this way, I think it should be optional. Not
everyone uses double spaces between sentences in their ascii text.

Cheers

Will

-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
                   ` (2 preceding siblings ...)
  2011-08-19 11:22 ` Carsten Dominik
@ 2011-08-19 14:55 ` Rasmus
  2011-08-19 15:02   ` suvayu ali
  2011-08-19 19:07 ` Thomas S. Dye
  2011-08-19 21:16 ` Bastien
  5 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2011-08-19 14:55 UTC (permalink / raw)
  To: emacs-orgmode

Andras Major <andras.g.major@gmail.com> writes:

> Org-mode export doesn't allow me to easily include these hints without
> affecting readability and export to other formats.  Therefore I ask
> that LaTeX export places ". " or ".\ " in the output automatically
> depending on the context:

I would like something like this too. Actually, what I would prefer even
more would be to stop Org from interpreting '{', '}', '\' and other common
TeX symbols. More often than not I will want to use '\' as an escape
character.

—Rasmus

-- 
Sent from my Emacs

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19 14:55 ` Rasmus
@ 2011-08-19 15:02   ` suvayu ali
  0 siblings, 0 replies; 12+ messages in thread
From: suvayu ali @ 2011-08-19 15:02 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Fri, Aug 19, 2011 at 4:55 PM, Rasmus <rasmus@gmx.us> wrote:
> Andras Major <andras.g.major@gmail.com> writes:
>
>> Org-mode export doesn't allow me to easily include these hints without
>> affecting readability and export to other formats.  Therefore I ask
>> that LaTeX export places ". " or ".\ " in the output automatically
>> depending on the context:
>
> I would like something like this too. Actually, what I would prefer even
> more would be to stop Org from interpreting '{', '}', '\' and other common
> TeX symbols. More often than not I will want to use '\' as an escape
> character.
>

My latex/org knowledge is not great but if your use for braces is for
superscripts and subscripts, I believe you can have fair bit of
control with the option ^:{}.

I think what is required here is a stable escaping convention within org.

> —Rasmus
>

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19 13:51     ` William Henney
@ 2011-08-19 18:39       ` András Major
  2011-08-19 19:50         ` Sebastien Vauban
  0 siblings, 1 reply; 12+ messages in thread
From: András Major @ 2011-08-19 18:39 UTC (permalink / raw)
  To: emacs-orgmode

Hi Will,

> > I'm fully aware of that, but that also messes up the spacing between
> > sentences.  My proposed solution should be robust enough to be
> > more-or-less foolproof yet produce nice-looking output.
> 
> What is nice-looking is a matter of personal taste. Personally, I tend
> to prefer everything close-set, as with \frenchspacing, although that

For that, you can use \frenchspacing in the latex header.

> If you _do_ want to keep the wider inter-sentence spacing, then you
> also need to worry about sentences that end with upper-case letters.

True, but that is, in my experience, a very rare thing to happen.  In
all the years of writing documents in (La)TeX, I don't think I've had
a single occurrence of this case.  You can, of course, make the export
code even more sophisticated and check for this case and adapt the
output accordingly.  Then the only rule for the user to remember would
be as simple as this: single space in org maps to inter-word space in
the output, double space maps to inter-sentence space.

> If you are going to go this way, I think it should be optional. Not
> everyone uses double spaces between sentences in their ascii text.

I think that the same people wouldn't mind slightly wrong spacing in
the printed output either.

  András

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
                   ` (3 preceding siblings ...)
  2011-08-19 14:55 ` Rasmus
@ 2011-08-19 19:07 ` Thomas S. Dye
  2011-08-19 21:16 ` Bastien
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas S. Dye @ 2011-08-19 19:07 UTC (permalink / raw)
  To: Andras Major; +Cc: emacs-orgmode

Andras Major <andras.g.major@gmail.com> writes:

> Hi,
>
> in TeX and LaTeX, the width of the glue (blank space) after a "." can
> be one of two different values, depending on the context.  There is
> always a longer space between sentences than after a "." that doesn't
> mark the end of a sentence (abbreviations, dates, etc.).  Since
> TeX/LaTeX usually can't recognize the latter case by itself, one can
> help out by writing ".\ " or ".~" explicitly to enforce a short space.
> Without these hints, printed output will look typographically wrong.
>
> Org-mode export doesn't allow me to easily include these hints without
> affecting readability and export to other formats.  Therefore I ask
> that LaTeX export places ". " or ".\ " in the output automatically
> depending on the context:

Org-mode has a straightforward way to include these hints that makes it
possible to take care of export to other formats:

org-entities-user is a variable defined in `org-entities.el'.
Its value is nil

Documentation:
User-defined entities used in Org-mode to produce special characters.
Each entry in this list is a list of strings.  It associates the name
of the entity that can be inserted into an Org file as \name with the
appropriate replacements for the different export backends.  The order
of the fields is the following

name                 As a string, without the leading backslash
LaTeX replacement    In ready LaTeX, no further processing will take place
LaTeX mathp          A Boolean, either t or nil.  t if this entity needs
                     to be in math mode.
HTML replacement     In ready HTML, no further processing will take place.
                     Usually this will be an &...; entity.
ASCII replacement    Plain ASCII, no extensions.  Symbols that cannot be
                     represented will be left as they are, but see the.
                     variable `org-entities-ascii-explanatory'.
Latin1 replacement   Use the special characters available in latin1.
utf-8 replacement    Use the special characters available in utf-8.

If you define new entities here that require specific LaTeX packages to be
loaded, add these packages to `org-export-latex-packages-alist'.

An example due to Lawrence Mitchell is here:

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-1

With some care, it is possible to keep readability fairly close to what
it is in LaTeX markup.

hth,
Tom

>
> - If, in the source, the "." precedes a double space " " or a newline,
>   use ". ".
>
> - In any other case, use ".\ ".
>
> The reason this would work is the Emacs convention of writing ASCII
> such that there is at least one more space (at least two) between
> sentences.  I believe that the Emacs fill-* functions also make use of
> this convention.
>
> Thanks,
>
>   András
>
>

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19 18:39       ` András Major
@ 2011-08-19 19:50         ` Sebastien Vauban
  0 siblings, 0 replies; 12+ messages in thread
From: Sebastien Vauban @ 2011-08-19 19:50 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi all,

András Major wrote:
>> > I'm fully aware of that, but that also messes up the spacing between
>> > sentences.  My proposed solution should be robust enough to be
>> > more-or-less foolproof yet produce nice-looking output.
>> 
>> What is nice-looking is a matter of personal taste. Personally, I tend
>> to prefer everything close-set, as with \frenchspacing, although that
>
> For that, you can use \frenchspacing in the latex header.
>
>> If you _do_ want to keep the wider inter-sentence spacing, then you
>> also need to worry about sentences that end with upper-case letters.
>
> True, but that is, in my experience, a very rare thing to happen.  In
> all the years of writing documents in (La)TeX, I don't think I've had
> a single occurrence of this case.  You can, of course, make the export
> code even more sophisticated and check for this case and adapt the
> output accordingly.  Then the only rule for the user to remember would
> be as simple as this: single space in org maps to inter-word space in
> the output, double space maps to inter-sentence space.

The problem is that this rule can be true, and certainly is, in English. But
French typing conventions require those space before/after punctuation
symbols:

    | symobl | before | after |
    |--------+--------+-------|
    | ,      |      0 |     1 |
    | .      |      0 |     1 |
    | :      |      1 |     1 |
    | !      |      1 |     2 |
    | ?      |      1 |     2 |

for the most commons.

Hence, in French, there is never a double space inserted after a sentence
period -- well for exclamation or interrogation marks.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence
  2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
                   ` (4 preceding siblings ...)
  2011-08-19 19:07 ` Thomas S. Dye
@ 2011-08-19 21:16 ` Bastien
  5 siblings, 0 replies; 12+ messages in thread
From: Bastien @ 2011-08-19 21:16 UTC (permalink / raw)
  To: Andras Major; +Cc: emacs-orgmode

Hi Andras,

Andras Major <andras.g.major@gmail.com> writes:

> - If, in the source, the "." precedes a double space " " or a newline,
>   use ". ".
>
> - In any other case, use ".\ ".

I wonder how such a function would look like.

Does anyone wants to try to write it?  Even pseudo-code would be fine at
this stage.  

> The reason this would work is the Emacs convention of writing ASCII
> such that there is at least one more space (at least two) between
> sentences.  I believe that the Emacs fill-* functions also make use of
> this convention.

C-h v sentence-end TAB gives several variable that let the user change
the number of spaces after a sentence.  So I guess this is not really
"Emacs convention of writing ASCII", but a more general American
convention.

Would the values of sentence-end* be taken into account by the feature
you describe above?

-- 
 Bastien

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

end of thread, other threads:[~2011-08-19 21:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19  6:50 Wishlist: LaTeX export: automatically append backslash to "." unless at end of sentence Andras Major
2011-08-19  9:35 ` Daniel Bausch
2011-08-19 10:00 ` Stefan Nobis
2011-08-19 11:03   ` András Major
2011-08-19 13:51     ` William Henney
2011-08-19 18:39       ` András Major
2011-08-19 19:50         ` Sebastien Vauban
2011-08-19 11:22 ` Carsten Dominik
2011-08-19 14:55 ` Rasmus
2011-08-19 15:02   ` suvayu ali
2011-08-19 19:07 ` Thomas S. Dye
2011-08-19 21:16 ` Bastien

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