Text FormattingPackage for automatic interpretation of linebreak

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Package for automatic interpretation of linebreak

Post by ptrcao »

Manually typing \\ for every line is not an option.

Is there a package that will interpret every instance of ENTER as a line break, so that every time I ENTER down on my keyboard it will be interpreted as \\ ? (Not in math mode, just in normal text mode).
Last edited by ptrcao on Sat Mar 19, 2011 2:37 pm, edited 1 time in total.
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Package for automatic interpretation of linebreak

Post by Stefan Kottwitz »

Hi,

you can switch it on by

Code: Select all

\obeylines
Stefan
LaTeX.org admin
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Re: Package for automatic interpretation of linebreak

Post by ptrcao »

Thanks Stef. Does it work in a begin/end environment? What if I only need it in sections of my document, how do I turn it off and on as needed, so it selectively applies to sections?
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Package for automatic interpretation of linebreak

Post by Stefan Kottwitz »

\obeylines works within environments and is local to that. That means, if you use it within an environment, it has no effect after that environment has ended.

You can limit the scope of this command also by \begingroup ... \endgroup or by cury braces { ... }.

Also,

Code: Select all

\begin{obeylines}
...
\end{obeylines}
would be a way.

These are general ways for local declarations.

Stefan
LaTeX.org admin
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Package for automatic interpretation of linebreak

Post by ptrcao »

Stefan_K wrote:\obeylines works within environments and is local to that. That means, if you use it within an environment, it has no effect after that environment has ended.

You can limit the scope of this command also by \begingroup ... \endgroup or by cury braces { ... }.

Also,

Code: Select all

\begin{obeylines}
...
\end{obeylines}
would be a way.

These are general ways for local declarations.

Stefan
Thanks again Stef, very good explanation - your answer was comprehensive and concise. :)
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
cellocgw
Posts: 2
Joined: Mon Jan 16, 2012 4:51 pm

Package for automatic interpretation of linebreak

Post by cellocgw »

Just a warning: when \obeylines is active, some tools in \table or \tabular will fail. In particular, \hline won't work due to some conflict with defined line endings.
Post Reply