reddit / emacs

Is it possible to justify text as in LibreOffice Writer ?

shortichon · 2022-04-09 14:53
I love Emacs, but it seems that there is some "simple" things that are hard to do (while some hard things are so simple !) I'm trying to create a good writing config for my org-mode, but I'm facing something that I haven't succeed to overcome : having a justify text mode that live wrap line, not inside word but instead use a variable letter/word spacing to do it, like in a LibreOffice writer document. I would like this : This is a long text that have been justify with adaptive word-spacing and without cut inside words ! Not this : This is a long text that have been justify wit hout adaptive word-spacing and with cuts insid e words ! Or this : This is a long text that haven't been justify there is just a limitation of the number of char by line with a line wrap. Is it even possible ? Many thanks for your time lovely Emacs community ;)
__nautilus__ · 2022-04-09 15:05
You may want to check out enriched mode: https://www.gnu.org/software/emacs/manual/html_node/emacs/Enriched-Text.html There’s also the fill commands, if you want something that applies to the file rather than the displayed text: https://www.gnu.org/software/emacs/manual/html_node/elisp/Filling.html
Bodertz · 2022-04-09 17:24
I think it's not what you want, but you can use `C-u M-q` to justify monospace text. It isn't live though.
00-11 · 2022-04-09 18:18
The latter link is the place to start. Fill commands also let you justify in different ways. And command `justify-current-line` (described there) probably already does just what's requested.
brwendel · 2022-04-09 20:38
This is how I do this: C-u 70 M-q (Ctrl-u 70 Alt-q)
wasamasa · 2022-04-10 02:12
It shouldn't be too hard to accomplish. I've made a demo using https://github.com/Fuco1/justify-kp for https://depp.brause.cc/nov.el/. The downside is that it's pretty slow, I imagine word processors to use a faster algorithm with far worse results than TeX.
shortichon · 2022-04-10 12:35
Indeed it's pretty slow and not live but it looks like what I'm searching for, thanks ! Maybe I will learn enough elisp to fix this in the future :)
Phil-Hudson · 2022-04-10 12:46
Although the other answers may be more or less helpful, I think the right answer is to point out that you may be making a [category error](https://en.wikipedia.org/wiki/Category_mistake). Writer is a *word processor*, Emacs is a *text editor*. Writer offers (more-or-less) [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG) layout and formatting capabilities. Emacs doesn't, or does so only in rudimentary fashion, because that's not what Emacs is for. Writer is for writing un- or partially-structured prose, with a concern for its visual presentation to the fore. Emacs is for writing highly-structured text such as computer programs, configuration files, etc. as well as un/partially-structured text that is not primarily intended for publication/presentation in its raw form. Note that none of this means that you cannot produce aesthetically beautiful output using Emacs; you can, but what you will work on in Emacs in order to do so will typically be something deeply un-aesthetic, like LaTeX -- the opposite of WYSIWYG.
WikiSummarizerBot · 2022-04-10 12:46
**[Category mistake](https://en.wikipedia.org/wiki/Category_mistake)** >A category mistake, or category error, or categorical mistake, or mistake of category, is a semantic or ontological error in which things belonging to a particular category are presented as if they belong to a different category, or, alternatively, a property is ascribed to a thing that could not possibly have that property. An example is a person learning that the game of cricket involves team spirit, and after being given a demonstration of each player's role, asking which player performs the "team spirit". Unlike bowling or batting, team spirit is not a task in the game but an aspect of how the team behaves as a group. **[WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG)** >In computing, WYSIWYG ( WIZ-ee-wig), an acronym for What You See Is What You Get, is a system in which editing software allows content to be edited in a form that resembles its appearance when printed or displayed as a finished product, such as a printed document, web page, or slide presentation. WYSIWYG implies a user interface that allows the user to view something very similar to the end result while the document is being created. In general, WYSIWYG implies the ability to directly manipulate the layout of a document without having to type or remember names of layout commands. ^([ )[^(F.A.Q)](https://www.reddit.com/r/WikiSummarizer/wiki/index#wiki_f.a.q)^( | )[^(Opt Out)](https://reddit.com/message/compose?to=WikiSummarizerBot&message=OptOut&subject=OptOut)^( | )[^(Opt Out Of Subreddit)](https://np.reddit.com/r/emacs/about/banned)^( | )[^(GitHub)](https://github.com/Sujal-7/WikiSummarizerBot)^( ] Downvote to remove | v1.5)