emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] inter-word space in org -> latex


From: Rasmus
Subject: Re: [O] inter-word space in org -> latex
Date: Mon, 14 Sep 2015 18:50:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hi Dan,

Dan Griswold <address@hidden> 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. . .




reply via email to

[Prev in Thread] Current Thread [Next in Thread]