Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fully-justify latex code on EMACS

Tags:

emacs

latex

I want to fully-justify latex code on EMACS so that my latex code will look better. For example, I remember my advisor sending me latex in fully justified way like this:

In ~\cite{Hummel2004},  authors described  an approach  for harvesting
software components from the Web. The basic  idea is to use the Web as
the  underlying repository,  and to  utilize standard  search engines,
such  as Google,  as  the means  of  discovering appropriate  software
assets.  Other  researchers  have crawled  through  Internet  publicly
available  CVS repositories  to  build their  own  source code  search
engines (e.g., SPARS-J)~\cite{Matsushita2005}.

I suppose that his column-width is set to 70 columns. Could someone give me a hint?

like image 466
asteriosk Avatar asked Dec 17 '22 05:12

asteriosk


1 Answers

The standard fill.el package includes the command justify-current-line which is part of what you need. From the function help:

Do some kind of justification on this line.
Normally does full justification: adds spaces to the line to make it end at
the column given by `current-fill-column'.
Optional first argument how specifies alternate type of justification:
it can be `left', `right', `full', `center', or `none'.
If how is t, will justify however the `current-justification' function says to

And other posters have already given you the magicall invokation:

M-x set-justification

As a philosophical side note, the point of fixed-wdith text justification is to fake real typography on a inflexible output device. So applying it to LaTeX source seems a little odd to me. Moreover, I have been using the "one sentence to a line" approach to LaTeX documents for some months now, and find that it really does improves both the editability and the source-control behavior of LaTeX, so I would recommend against doing this.

like image 89
dmckee --- ex-moderator kitten Avatar answered Dec 25 '22 07:12

dmckee --- ex-moderator kitten