I want to be able to have line breaks in my .TeX file without producing extra white space in my final document. For example, from something I'm currently writing, I have
\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{parskip}
\newcommand{\set}[1]{\left\{#1\right\}}
\begin{document}
We wish to rewrite this using
\begin{align*}
\int d^N \psi \exp[-\frac{1}{2}\psi_i A_{ij} \psi_j + J_i \psi_i] &= (2\pi)^{N/2} (\det A)^{-1/2} \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]\\
&= (2\pi)^{N/2}\exp[-\frac{1}{2}\Tr(\ln A)] \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]
\end{align*}
or alternatively
$$\int d^N \psi \exp[-\frac{1}{2}\psi_i A_{ij} \psi_j + J_i \psi_i] = (2\pi)^{N/2}\exp[-\frac{1}{2}\Tr(\ln A)] \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]$$
where we identify $J_i \equiv \sigma_i$ and $A_{ij}^{-1}/2 \equiv K_{ij}^{-1}$ or $A_{ij} = K_{ij}/2$. This gives us
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \sum_{\set{\sigma_i=\pm 1}}\int d^N\psi \exp[-\frac{1}{4}\psi_i K_{ij} \psi_j + \sigma_i \psi_i] \exp\Big[h_i \sigma_i\Big]$$
or
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \int d^N\psi \exp[-\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j] \sum_{\set{\sigma_i=\pm 1}} \prod_{i} \exp\Big[(h_i +\psi_i)\sigma_i\Big]$$
performing the summation, we have
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \int d^N\psi \exp[-\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j] \prod_{i}2\, \cosh\Big[(h_i +\psi_i)\sigma_i\Big]$$
After factoring out $N$ factors of $2$ from the product, the leading factor is simply an overall normalization which doesn't affect the physics, call it $\mathcal{N}$, so we finally have the desired result
$$Z = \mathcal{N} \int d^N\psi \,\exp\left\{-\left[\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j - \sum_{i} \ln[\cosh(h_i +\psi_i)]\right]\right\}$$
where
$$\mathcal{N} = \left(\frac{2}{\pi}\right)^{N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))]$$
\end{document}
This is quite dense however, and for me difficult to read, and I would prefer if I could put white spaces in, e.g.
\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{parskip}
\newcommand{\set}[1]{\left\{#1\right\}}
\begin{document}
We wish to rewrite this using
\begin{align*}
\int d^N \psi \exp[-\frac{1}{2}\psi_i A_{ij} \psi_j + J_i \psi_i] &= (2\pi)^{N/2} (\det A)^{-1/2} \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]\\
&= (2\pi)^{N/2}\exp[-\frac{1}{2}\Tr(\ln A)] \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]
\end{align*}
or alternatively
$$\int d^N \psi \exp[-\frac{1}{2}\psi_i A_{ij} \psi_j + J_i \psi_i] = (2\pi)^{N/2}\exp[-\frac{1}{2}\Tr(\ln A)] \exp[\frac{1}{2} J_i A^{-1}_{ij} J_j]$$
where we identify $J_i \equiv \sigma_i$ and $A_{ij}^{-1}/2 \equiv K_{ij}^{-1}$ or $A_{ij} = K_{ij}/2$. This gives us
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \sum_{\set{\sigma_i=\pm 1}}\int d^N\psi \exp[-\frac{1}{4}\psi_i K_{ij} \psi_j + \sigma_i \psi_i] \exp\Big[h_i \sigma_i\Big]$$
or
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \int d^N\psi \exp[-\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j] \sum_{\set{\sigma_i=\pm 1}} \prod_{i} \exp\Big[(h_i +\psi_i)\sigma_i\Big]$$
performing the summation, we have
$$Z = (2\pi)^{-N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))] \int d^N\psi \exp[-\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j] \prod_{i}2\, \cosh\Big[(h_i +\psi_i)\sigma_i\Big]$$
After factoring out $N$ factors of $2$ from the product, the leading factor is simply an overall normalization which doesn't affect the physics, call it $\mathcal{N}$, so we finally have the desired result
$$Z = \mathcal{N} \int d^N\psi \,\exp\left\{-\left[\frac{1}{4}\sum_{ij} \psi_i K_{ij} \psi_j - \sum_{i} \ln[\cosh(h_i +\psi_i)]\right]\right\}$$
where
$$\mathcal{N} = \left(\frac{2}{\pi}\right)^{N/2} \exp[\frac{1}{2}\Tr(\ln(K/2))]$$
\end{document}
However, such extra line breaks create extra white space between lines in my compiled document (I am using the parskip package so there's no issue with indentation), about a half of a blank line each, I assume that this is because this is creating a new paragraph. Is there a way to require a double new line to create a new paragraph, so that a single blank line won't affect the output? Or is there a better way to do this for readability purposes?
This is the same as this question which did not have a solution other than putting a % on each blank line to space things out.
%on a blank line is not a good solution for you? – Marijn Mar 13 '18 at 19:50\parand changing that is bound to break lots of things. Note you should not use$$in latex documents – David Carlisle Mar 13 '18 at 20:00%commented lines is almost certainly the best answer. – David Carlisle Mar 13 '18 at 20:01.texfile to strip the blank lines before TeX sees them), how do you plan to indicate new paragraphs? By typing\par? – ShreevatsaR Mar 14 '18 at 00:01