Visually speaking, ending one paragraph and beginning another is just a matter of inserting a linebreak and an (potential) indent. Two ways come to mind to achieve this: \par (or empty line) and \\\indent. In my testing below, they produce exact same result visually. Is there any case where the two will produce results that differ even slightly (like kern, hypehnation/linebreak, font expansion, etc)? Will tex.linebreak be called internally only once for all text if \\\indent were used? (AFAIK tex.linebreak is called on each chunk of text separated by \par (or empty lines)) Given tex's linebreaking algorithm tries to optimize some metrics across linebreaks, and using \\\indent means all linebreaks (even across visually different paragraphs) are considered together for optimization, will this result in slowdown when number of linebreaks increase a lot?
Here's console output, code, and screenshot of output that compares \par, and \\\indent side-by-side:
Console:
\\\indent adds:
......\penalty 10000
......\glue 0.0 plus 1.0fil
......\penalty -10000
\par adds:
......\penalty 10000
......\glue(\parfillskip) 0.0 plus 1.0fil
Why does \\ add some unnamed glue \glue 0.0 plus 1.0fil vs \glue(\parfillskip) 0.0 plus 1.0fil added by \par? Is there a separate named glue or way of controlling glue added by \\ or will it always equal glue added by \parfillskip (like it is in this case 0.0 plus 1.0fil)? If it is same by default, then why is there a hook to control one, and not another?
Code:
>>> lualatex par_or_linebreak.tex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[paper=a2paper,lmargin=2in,tmargin=2in,rmargin=0.5in,bmargin=0.5in]{geometry}
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{1in}
\setlength{\TPVertModule}{1in}
\textblockorigin{0in}{0in}
\begin{document}
\showoutput
\sloppy
\thispagestyle{empty}
\newcommand{\sampletext}{This an equation $x=a+b^2$ without any intrinsic meaning unless one sees some. \textbf{And this is some bold text to add some variety to this piece of text.} And am typing here, difference diffierence $b=c^3$. \blindtext[1]}
\newcommand{\sampletextmore}{\blindtext[2]}
\newsavebox{\vboxwithpar}
\setbox\vboxwithpar = \vbox{{\hsize=2in\relax\noindent\sampletext\par\sampletext\par\sampletext\par\sampletextmore\par}}
\newsavebox{\vboxwithlinebreak}
\setbox\vboxwithlinebreak = \vbox{{\hsize=2in\relax\noindent\sampletext\\indent\sampletext\\indent\sampletext\\indent\sampletextmore\par}}
\begin{textblock}{2in}(1in,0.25in)
\copy\vboxwithpar
\end{textblock}
\begin{textblock}{2in}(3.5in,0.25in)
\copy\vboxwithlinebreak
\end{textblock}
\end{document}
Output:


\parends the paragraph and\\\indentdoes not so the output is in general completely unrelated (and the second form should never be used). They may in some cases give similar visual output. – David Carlisle Nov 23 '20 at 07:35\setlength\parskip{\baselineskip}to the preamble, but as well as vertical space you can get different line breaking so different numbers of lines in the paragraph, different hyphenation points in words .... – David Carlisle Nov 23 '20 at 07:41\setlength\parskip{\baselineskip}'s effect on\parcan still be emulated by replacing\\with\\[1\baselineskip]. Given both are external user intervention, I still don't see them really different... would wait for a minimal example where the contents of the paragraph intrinsically cause the results to be visually different (something that cannot be offset from outside) – codepoet Nov 23 '20 at 07:50\\it is all one paragraph so you only have these penalties at the start and end of the text not for each logical paragraph. – David Carlisle Nov 23 '20 at 07:57\finalhyphendemeritsis different so line breaking can be different,\everypargets applied in different places. So yes (especially in luatex if you redefine the linebreaking algorithm in Lua), you can probably address each issue and make them more or less the same, but why?) – David Carlisle Nov 23 '20 at 08:07\\\indentis. – codepoet Nov 23 '20 at 08:35