# Relationship of \\, \newline, \raggedright, \RaggedRight, and parindent

I'm trying to understand if there is anyway to get \\, when in \raggedright or \RaggedRight, to produce a new line that is not indented, while \parindent or \RaggedRightParindent are set in order to have indented paragraphs. This is necessary for certain types of text blocks (e.g., an address or a block of text with "header" info [e.g., for homework]), in which I want to set each line on its own with a hard break and no indentation. I know that people on this board strongly discourage using \\, but this seems like an appropriate use. Furthermore, as I'm exporting to Tex from markdown, via Pandoc, \\ are used for markdown line breaks (indicated by two or more spaces at the end of a line). I actually get the desired output when text is set according to memoir's default, that is, with neither \RaggedRight nor \raggedright.

So, is there any easy way to do this? I can't find anything about the relationship between \RaggedRight or \raggedright and \\ or \newline in either the ragged2e or memoir docs. My hope is to do this without other markup in the text, just adjustments in my preamble, as I write in more-or-less pure markdown and then automatically convert it to Latex. Of course, this might not be possible, but it seems so from the third example.

Here are my MWEs:

In \RaggedRight, which is my preferred way of setting text, both \\ and \newline indent the new lines (see both the header block on top and the address in the middle).

\documentclass[12pt,article,oneside]{memoir}
\usepackage{lipsum}
\usepackage{ragged2e}
\setlength{\RaggedRightParindent}{2em}
\RaggedRight
%\raggedright
%\setlength{\parindent}{2em}
\checkandfixthelayout

\begin{document}

\noindent
LastName\newline Line 2\\Line 3\\Line 4\\29 August 2014

\section{Lorem Ipsum}\label{lip}

\lipsum[1-2]

And here is my address, that I want to have set flush left with no indentation:\\
My Name\newline 7999 Any St Apt 3\\Los Angeles CA  99999\\
With more text, that also should be flowed in the paragraph, with no indentation, coming after the address. \lipsum[1]

\end{document}


In \raggedright, \\, but not \newline, indents the new lines (see both the header block on top and the address in the middle).

\documentclass[12pt,article,oneside]{memoir}
\usepackage{lipsum}
\usepackage{ragged2e}
%\setlength{\RaggedRightParindent}{2em}
%\RaggedRight
\raggedright
\setlength{\parindent}{2em}
\checkandfixthelayout

\begin{document}

\noindent
LastName\newline Line 2\\Line 3\\Line 4\\29 August 2014

\section{Lorem Ipsum}\label{lip}

\lipsum[1-2]

And here is my address, that I want to have set flush left with no indentation:\\
My Name\newline 7999 Any St Apt 3\\Los Angeles CA  99999\\
With more text, that also should be flowed in the paragraph, with no indentation, coming after the address. \lipsum[1]

\end{document}


Finally, with neither \RaggedRight nor \raggedright in place, I actually get my desired result.

\documentclass[12pt,article,oneside]{memoir}
\usepackage{lipsum}
\usepackage{ragged2e}
%\setlength{\RaggedRightParindent}{2em}
%\RaggedRight
%\raggedright
%\setlength{\parindent}{2em}
\checkandfixthelayout

\begin{document}

\noindent
LastName\newline Line 2\\Line 3\\Line 4\\29 August 2014

\section{Lorem Ipsum}\label{lip}

\lipsum[1-2]

And here is my address, that I want to have set flush left with no indentation:\\
My Name\newline 7999 Any St Apt 3\\Los Angeles CA  99999\\
With more text, that also should be flowed in the paragraph, with no indentation, coming after the address. \lipsum[1]

\end{document}


ragged2e updates both \newline and \\ to function differently. Before updating, it stores the original set of macros. The original functionality can be reinstated by placing

\makeatletter
\let\@gnewline\@raggedtwoe@saved@gnewline% Restore original functionality of \newline
\let\\\@raggedtwoe@savedcr% Restore original functionality of \\
\makeatother


Another idea is to set the contents you want flushed left as part of an unbreakable structure like a tabular. I would guess this seems sufficient as a break across the page within the address might be confusion.

\documentclass[12pt,article,oneside]{memoir}
\usepackage{lipsum}
\usepackage{ragged2e}
\setlength{\RaggedRightParindent}{2em}
\RaggedRight
\checkandfixthelayout

\begin{document}

\noindent
\begin{tabular}{@{}l@{}}
LastName \\Line 2\\ Line 3\\Line 4\\29 August 2014
\end{tabular}

\section{Lorem Ipsum}

\lipsum[1-2]

And here is my address, that I want to have set flush left with no indentation: \strut

\noindent
\begin{tabular}{@{}l@{}}
My Name\\ 7999 Any St Apt 3\\Los Angeles CA  99999
\end{tabular}

\noindent
With more text, that also should be flowed in the paragraph, with no indentation, coming after the address. \lipsum[1]

\end{document}

• Thanks—this would certainly work, but, as I just clarified in the question, I'm really hoping just to adjust the settings for either \RaggedRight or \raggedright in my preamble and not have to alter anything in the text itself, which is converted from pure markdown. But thanks for the idea! – hgv Aug 29 '14 at 20:28
• @hgv: In both instance (\newline and \\), LaTeX issues a \par, which inserts the regular paragraph indent. Without ragged2e there is no adjustment to the newline-style macros and they work as expected. You can restore the way \newline functioned by adding \makeatletter \let\@gnewline\@raggedtwoe@saved@gnewline \makeatother to your preamble, for example. Similarly, \makeatletter \let\\\@raggedtwoe@savedcr \makeatother will restore the way \\ functioned before loading ragged2e. – Werner Aug 30 '14 at 7:22
• Thanks, @Werner! Exactly what I was looking for—I should get more familiar with the actual code of ragged2e. – hgv Aug 31 '14 at 13:56