From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: inter-word space in org -> latex
Date: Mon, 14 Sep 2015 18:50:20 +0200 [thread overview]
Message-ID: <87y4g93pyr.fsf@gmx.us> (raw)
In-Reply-To: CAGO+QKvqz_m0AcQgqwCSM-TA=92Bv1QYGQ0aiOCkHy=OZofEjQ@mail.gmail.com
Hi Dan,
Dan Griswold <kc5gmr@gmail.com> writes:
> Dear org-mode community,
>
> In LaTeX, a space after a period is treated as an inter-sentence space,
> which is wider than an inter-word space. This can lead to overly wide
> spacing after a period that ends an abbreviation rather than a space. The
> way to cover this in LaTeX is to use a backslash prior to the space, as in:
>
> Mr.\ Henry Higgins.
>
> I have some documents in org that have the same issue: periods concluding
> abbreviations, with the result that LaTeX puts more space than I want after
> the abbreviation. Yet the use of "\ " does not work, as the backslash is
> exported to LaTeX as a literal backslash.
>
> How should I mark in org mode that I want a space following a period
> concluding an abbreviation to be seen by LaTeX as an interword space?
.@@latex:\ @@
Though I practice I type double space after full sentences and when
there's a single space and small letters.
(defun rasmus/org-latex-filter-nobreaks-double-space (text backend info)
"Tries to export \"S1. S2\" as \"S1.\\ S2\",
while letting \"S1. S2\" be exported without tilde"
;; TODO: error with this output:
;; [[file:nasty dir/Screenshot. from 2015-03-05 19:05:00.png]]
(when (and text (org-export-derived-backend-p backend 'latex))
(let ((preamble (or (string-match-p "\\\\begin{document}" text) 0))
(case-fold-search nil))
(concat (substring text 0 preamble)
(replace-regexp-in-string "\\. \\([^ A-Z\n]\\)"
".\\\\ \\1"
(substring text preamble))))))
(add-to-list 'org-export-filter-final-output-functions
'rasmus/org-latex-filter-nobreaks-double-space)
Or,
(defcustom rasmus/org-latex-unicode-to-tex '((" " "~")
(" " "\\,")
("" ""))
"list of re rep pairs which are replaced during latex export")
(defun rasmus/org-latex-unicode-to-tex (text backend info)
"Replace unicode strings with their TeX equivalents.
Currently: ' ' (no break space) to '~'
' ' (thin space) to '\,'
'' (zero width space) to ''."
(when (org-export-derived-backend-p backend 'latex)
(cl-loop for (re rep) in rasmus/org-latex-unicode-to-tex do
(setq text (replace-regexp-in-string re rep text t t)))
text))
(add-to-list 'org-export-filter-final-output-functions
'rasmus/org-latex-unicode-to-tex)
Rasmus
--
I hear there's rumors on the, uh, Internets. . .
next prev parent reply other threads:[~2015-09-14 16:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 14:42 inter-word space in org -> latex Dan Griswold
2015-09-14 16:50 ` Rasmus [this message]
2015-09-16 15:32 ` Dan Griswold
2015-09-14 16:54 ` Suvayu Ali
2015-09-16 15:33 ` Dan Griswold
2015-09-22 20:17 ` Marcin Borkowski
2015-09-22 20:51 ` Marcin Borkowski
2015-09-22 20:59 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y4g93pyr.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.