I'm working with large LaTeX tables in AucTEX and it would be helpful to display them in truncated lines, like here:
The red marks are the "&" characters which separate the columns of the table. In case of tables with many columns the latex source code for one table row is longer than the emacs
frame width and therefore will be by default wrapped into more than one line.
Even with align-current
, this will make the table source code very hard to read and edit, so
- for tables I'd prefer the source code lines to be truncated (forcing me to scroll horizontally)
- while for all other
latex
source, I'd preferword wrap
to make it fit to the frame width
However for the real text in my LaTeX document I'd prefer to have the normal word-wrap
settings.
Question:
Is it possible to use word-wrap
as standard in Emacs
and still have some latex environments in the same buffer like table
, longtable
and sidewaystable
shown truncate
d at the same time?
Also for some other environments like equation
, pycode
or tikzpicture
truncation seems to be more appropriate. So it might be a good idea to be able to define a list of environments which don't get wraped but truncated.
The wrapping should be soft wrapping (That is, the text is wrapped to fill-column in the buffer, but that does not reflect in the file) and wrapping an indented line should follow the line’s indentation.
The solutions should also work for emacs but also for Aquamacs 2.5.
There is a blog post which suggests to have a (partial) solution, but I didn't find the implementation: http://endlessparentheses.com/longlines-mode-in-latex.html
(setq word-wrap t
) and(setq truncate-lines t)
in the same buffer. If you wantword-wrap
active, then the best you will probably be able to achieve is placing an invisible overlay over the text you want to truncate -- doable, but non-trivial -- the code for this would require usingvertical-motion
after every command with removal/movement/placement of overlays.truncate-lines
maybe only for certain portions of a text (certain environments in LaTeX) but I see that this might be difficult to achieve. Seems I'll have to learn how to toggleword wrap
/truncate
quickly. :)toggle-truncate-lines
.longlines-mode
. See this post for an example. I'll write a full answer later if I have time.