2

I use this command to type less: \begin{parse lines}[\noindent]{#1\\}. Its effect is to preserve linebreaks. Default LaTeX behavior is that single linebreaks are collapsed to nothing, and two-or-more linebreaks become a single linebreak. parse lines overrides that, so that each linebreak in the source creates an extra linebreak in the output.

But that means I can't use things like \raggedright, \theorem, and \begin{align}; LaTeX errors when they are combined with parse lines. Why is that? Is there an alternative to parse lines that respects multi-linebreaks and keeps word wrap, but allows me to use those commands?

  • 2
    Welcome to TeX.SX! What's parse lines? – egreg May 25 '17 at 22:19
  • @egreg, its behavior can be seen at https://tex.stackexchange.com/a/153595/134587. It comes from the package parselines. – math student May 25 '17 at 22:22
  • 1
    Well, I'd never use such a package. What's your aim? – egreg May 25 '17 at 22:29
  • I want to use it with the usual mathematics commands. But my overall goal is that I like having newlines and double newlines without needing to type \ or double linebreaks; this makes my source file easier to handle for me, including easier transfers to other text applications which are mostly WYSIWYG. – math student May 25 '17 at 22:38
  • 1
    It's very unclear, sorry; usage of \\ should be very limited outside alignments such as tabular, matrix and the like. – egreg May 25 '17 at 22:42
  • @egreg When I type a sentence, then a linebreak, and then another sentence, I would prefer a newline to appear in the output, instead of needing to type two linebreaks to produce a newline. obeylines has this behavior, but sometimes I wish to type two linebreaks and then form a larger newline, which is a behavior that parse lines supports, and obeylines doesn't. Essentially, I would like my newlines in my .tex file to persist in the output. – math student May 25 '17 at 22:46
  • I always thought that \ was introduced because \cr was too hard to type ;-) Come to think of it, wasn't \ originally an alternative to \backslash? – John Kormylo May 25 '17 at 23:28
  • How about \obeylines, as needed. – Steven B. Segletes May 26 '17 at 08:34

1 Answers1

1

Reading the comments between the OP and others, it seems that what the OP desires might be provided with \obeylines. Perhaps this, therefore...

It allows \raggedright and by scoping the extent of the \obeylines, math environments like align can be employed.

I have encapsulated it in an environment obey, which takes as an optional argument the number of lines to back-skip upon exit, which may be needed when transitioning to displaystyle math environments.

Here is the MWE

\documentclass{article}
\usepackage{amsmath}
\newenvironment{obey}[1][0]{\obeylines\xdef\bsmult{#1}}{\par\vspace{-\bsmult\baselineskip}}
\edef\svparindent{\the\parindent}
\begin{document}
\begin{obey}[1]
JUSTIFIED: And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. 
this 
is a
test.
 And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. 
\end{obey}
\begin{align}
 y &= mx + b\\
 e &= mc^2
\end{align}
\begin{obey}
RAGGED:this continues the test.
\raggedright\parindent\svparindent\relax
And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. And here, is more. 
\end{obey}
This is the next text outside of \texttt{obey} mode.
\end{document}

enter image description here