reddit / emacs
Org mode equivalent to Latex non-sentence-ending periods
copperbranch · 2022-08-25 15:06
In Latex, to avoid extra spacing after abbreviations ("Mr. and Mrs. Smith went to the theater.") as if they were ends of sentences, you can add a '\\ ' (slash-space) after the periods. ("Mr.\\ and Mrs. \\ Smith went to the theater.")
Also, because Latex assumes periods after Upper case letters \*not\* to be sentence-ending, you have to use '\\@' when it actually is. ("I like words that start with the letter Z." would become "I like words that start with the letter Z\\@."
Are there equivalents for those in Org mode for when exporting to pdf?
Also, I like to set sentence-end-double-space to nil. Is there a way to add the things above to the rules that define sentences in emacs?
publicvoit · 2022-08-25 16:39
Not an answer to the OP's question but maybe relevant in this case:
What is the goal of this?
In most typographic reasoning of the last decade, the horizontal space after a sentence is as long as the horizontal space between words. The optical impression of a ". " combination is wider as the optical impression of a " " alone anyway.
AFAIR, the original concept of double-spaces after sentences was something that got established with typewriters and their fixed width-fonts.
Therefore, it should not matter at all any more from my perspective.
The only thing I'd need to have in Orgdown (Org-mode syntax) would be a reduced horizontal space such as "42\,km" (LaTeX syntax ignoring the units-package) or "e.\,g.".
thetemp_ · 2022-08-25 17:41
>Also, I like to set sentence-end-double-space to nil.
I would have thought that would be the problem, since the default is for Emacs to recognize two spaces after a period as the end of a sentence, and other intra-paragraph periods as NOT ending a sentence. That convention is followed by the rest of Emacs, because it makes it very easy to programmatically determine which periods are sentence-ending and which are not.
But alas, org-mode's export mechanism doesn't seem to follow this established convention, or even provide an option to treat sentence-ending double-spaces the same way that the rest of Emacs treats them.
If it did do so, the solution would be very simple. You would either follow the two spaces convention while drafting. Or, before exporting, you would run `repunctuate-sentences` to clarify which periods were sentence-ending and which were not.
I hope I'm wrong about this and that there is some way to have org-mode's exporter respect `sentence-end-double-space`...
Because the actual solution is much less elegant:
For a non-breaking and non-expanding space (a single space which will not end a line), you can enter it either as an entity with `\nbsp{}` or you can insert a literal one with "C-x 8 SPC".
To insert a non-expanding space that *can* be wrapped in the exported text, you can use `\space{}`.
But this still doesn't solve the problem you mention of ending a sentence with a capital letter. For that particular corner-case, you might have to use some in-line LaTeX code.
thetemp_ · 2022-08-25 18:39
> In most typographic reasoning of the last decade, the horizontal space after a sentence is as long as the horizontal space between words.
How can one get LaTeX (preferably through org exporter) to do that?
publicvoit · 2022-08-25 21:01
As far as I remember (I'm not using LaTeX for a couple of years now), this is the default case. Do you have a minimum tex file that proves otherwise?
As far as I see on my LaTeX template of https://github.com/novoid/LaTeX-KOMA-template (which uses the KOMA package that provides better typography in any case), the horizontal space is not wider after dots.
publicvoit · 2022-08-25 21:03
Just to avoid misunderstanding: for LaTeX files, it doesn't matter how many spaces are written after a dot/sentence. TeX will always reduce multiple spaces to one in its parser and handle the horizontal space of the PDF result independent of it.
Same for empty lines: it doesn't matter if you put one single empty line between paragraphs or hundred: it will always result in a new paragraph with the same vertical space in the PDF end result.
thetemp_ · 2022-08-25 21:45
> on my LaTeX template of https://github.com/novoid/LaTeX-KOMA-template (which uses the KOMA package that provides better typography in any case), the horizontal space is not wider after dots.
Ah, okay. The default LaTeX template is "article", which attempts to guess the ends of sentences and inserts slightly more space in between them, to the point that it looks awkward when it gets it wrong... Thus OP's question.
The thing that holds me back from using LaTeX more is that its built-in templates just don't fit the bill for most things (legal documents, normal business style letters, anything that requires specific formatting...).
So it seems one needs to learn how to make custom templates for their own purposes. But from what I understand, that's a nontrivial undertaking.
publicvoit · 2022-08-26 13:11
My personal opinion after using LaTeX for many years: the most difficult thing you could try to accomplish is to create a good LaTeX document template for a specific purpose such as my KOMA template for (scientific) documents.
However, you don't have to do it yourself. You can find a decent template (I have to admit that most templates are bad) and adapt it for your Org-mode process. Usually, I create a new org-latex-class similar to the example below:
```
(add-to-list 'org-latex-classes
'("mynewclass"
"\\documentclass\[a4paper,parskip=half,11pt,headinclude=false,footinclude=false\]\{scrartcl\}
\\usepackage\[ngerman,american\]\{babel\}\\usepackage\{eurosym\}\\usepackage\{xspace\}\\usepackage\[usenames,dvipsnames\]\{xcolor\}
\\usepackage\[protrusion=true,factor=900\]\{microtype\}\\usepackage\{enumitem\}
\\definecolor\{DispositionColor\}\{RGB\}\{0,54,90\}
\\usepackage\{helvet\}
\\renewcommand\{\\familydefault\}\{\\sfdefault\}
\\DeclareRobustCommand\{\\myacro\}\[1\]\{\\textsc\{\\lowercase\{#1\}\}\} %% abbrevations using small caps
\\usepackage{scrlayer-scrpage} \\rehead{\\includegraphics\[height=1cm\]{{c:/Users/first.last/images/logo-209x41.png}}} \\pagestyle{scrheadings} %% Logo in header
\\newenvironment{NOTES}{}{} %% declares org-reveal environment in PDF output
\\usepackage[space]{grffile} %% enable spaces in filenames of includegraphics
%% colorful headings:
%\\setheadsepline\{.4pt\}\[\\color\{DispositionColor\}\]
\\renewcommand\{\\headfont\}\{\\normalfont\\sffamily\\color\{DispositionColor\}\}
\\renewcommand\{\\pnumfont\}\{\\normalfont\\sffamily\\color\{DispositionColor\}\}
\\addtokomafont\{disposition\}\{\\color\{DispositionColor\}\}
\\addtokomafont\{caption\}\{\\color\{DispositionColor\}\\footnotesize\}
\\addtokomafont\{captionlabel\}\{\\color\{DispositionColor\}\}
\\usepackage\{enumitem\}
\\setlist\{noitemsep\} %% kills the space between items
"
("\\section\{%s\}" . "\\section*\{%s\}")
("\\subsection\{%s\}" . "\\subsection*\{%s\}")
("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}")))
```