# equation out of margin?

I am using

    $$equation$$


in order to write formulas

but for example with

$$G(\boldsymbol{x_1}, \overline{z} -dz/2; \boldsymbol{x_2}, \overline{z} +dz/2) = {\displaystyle\int } \frac{d^2 \boldsymbol Q}{{2 \pi}} [\widetilde{C_0}(\boldsymbol{Q}) e^{-i Q^2 dz/2k}] e^{i \boldsymbol{Q} \cdot (\boldsymbol{x_2}-\boldsymbol{x_1})} \times \notag\\ {\displaystyle\int } \frac{d^2 \boldsymbol q}{{2 \pi}} [\widetilde{I_0}(\boldsymbol{q}) e^{-i q^2 dz/8k}] e^{i \boldsymbol{q} \cdot [\boldsymbol{x_2}+\boldsymbol{x_1}]/2} e^{-i \boldsymbol{Q}\cdot \boldsymbol{q}(\overline z /k)}$$


I obtain

How can I correct it?

• It is just too wide. Use e.g. multline and add some line breaks.
– user238301
Commented Mar 27, 2021 at 17:21

You can't break lines with \\ inside equation; you need a specific alignment environment, in this case split.

The terms at which it's possible to split are very long, so I suggest to set the left-hand side on a line by itself and indenting the right-hand side split into two lines.

The code:

\documentclass{article}
\usepackage{amsmath,bm}

\newcommand{\vect}[1]{\boldsymbol{#1}}

\begin{document}

$$\begin{split} & G(\vect{x}_1, \bar{z} -dz/2; \vect{x}_2, \bar{z} +dz/2) \\ &\qquad = \int \frac{d^2 \vect Q}{2 \pi} [\tilde{C}_0(\vect{Q}) e^{-i Q^2 dz/2k}] e^{i \vect{Q} \cdot (\vect{x}_2-\vect{x}_1)} \\ &\qquad \times \int \frac{d^2 \vect{q}}{2 \pi} [\tilde{I}_0(\vect{q}) e^{-i q^2 dz/8k}] e^{i \vect{q} \cdot [\vect{x}_2+\vect{x}_1]/2} e^{-i \vect{Q}\cdot \vect{q}(\bar{z}/k)} \end{split}$$

\end{document}


I have also other suggestions:

1. \boldsymbol{x_1} should be \boldsymbol{x}_1
2. It's better to have a more semantic command, so I defined \vect to use \boldsymbol
3. {\displaystyle\int} is wrong: just use \int.
4. Instead of \overline it's better to use \bar over single symbols.
5. Similarly for \widetilde, which need not cover the subscript, and can well be \tilde; don't worry: your readers will see it.

As I said, the equation is just too long. You can either use multline or align with \MoveEqLeft from mathtools. I am also a bit unsure of the notation, the d in dz is not meant to be a differential, is it? In any case, it is very helpful if the reader knows what is meant, and clearly mark differentials. Likewise, you want to have the imaginary i and the Euler e distinguishable from indices and variables. Given that I do not know the context one guess for the equation could be:

\documentclass{article}
\usepackage{mathtools}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\begin{document}
\begin{align}
\MoveEqLeft
G(\boldsymbol{x}_1, \overline{z} -dz/2; \boldsymbol{x_2}, \overline{z} +dz/2)
= \int\!  \frac{\diff^2 \boldsymbol Q}{{2 \pi}} \,
\bigl[\widetilde{C_0}(\boldsymbol{Q})\, \mathrm{e}^{-\mathrm{i} Q^2 dz/2k}\bigr]\,
\mathrm{e}^{\mathrm{i} \boldsymbol{Q} \cdot
(\boldsymbol{x}_2-\boldsymbol{x}_1)}   \notag\\
&{}\times\int   \!\frac{\diff^2 \boldsymbol q}{{2 \pi}} \,
\bigl[\widetilde{I_0}(\boldsymbol{q})\,
\mathrm{e}^{-\mathrm{i} q^2 dz/8k}\bigr]\,
\mathrm{e}^{\mathrm{i} \boldsymbol{q} \cdot
[\boldsymbol{x}_2+\boldsymbol{x}_1]/2}\,
\mathrm{e}^{-\mathrm{i} \boldsymbol{Q}\cdot \boldsymbol{q}(\overline z /k)}
\;.
\end{align}
\end{document}