I'm using MikTeX 9.6.0.5 on windows 8.1. The following displays all the four lines in a new line, as expected:
\documentclass{article}
\begin{document}
\begin{obeylines}
This is first line.
And the second line.
Third line.
Fourth line.
\end{obeylines}
\end{document}
But if I insert a table between second and third line as:
\documentclass{article}
\begin{document}
\begin{obeylines}
This is first line.
And the second line.
\begin{tabular}{|l|l|l|}
\hline
A11&A12\\ \hline
A21&A22\\
\hline
\end{tabular}
Third line.
Fourth line.
\end{obeylines}
\end{document}
I get the error:
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.7 \hline
According to a response and comments by Ian Thompson here we should be able to obeylines for the entire document.
\obeylinesrather than an environment? I still believe that\obeylinesis designed as a local effect and would not expect it to work across an entire document. – Christian Lindig Jun 05 '15 at 06:33\hlineare not on new lines. (You should also put the\end{tabular}on the same line if you want to avoid spurious vertical lines). But the active end-of-line chars will certainly bite you in various places.\obeylinesis not something I would use for a large portion of a document. – Ulrike Fischer Jun 05 '15 at 07:59obeylineswith the entire document is almost certain to fail somehwere. – nam Jun 06 '15 at 01:57\obeylinesworked only in combination with the Ulrike's suggestion. – nam Jun 06 '15 at 02:00