# Equation line exceeds width of text block

I have a problem with an equation which almost exceeds limits of the page. This is the code :

\documentclass[a4paper,12pt,blue,rgb,]{tubsbook}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{listings}
\usepackage{color}
\usepackage{hyperref}
\usepackage{url}
\usepackage{array,multirow}
\newcommand\mcbf[1]{\multicolumn{2}{|c|}{\textbf{#1}}}
\newcommand\mlbf[1]{\multicolumn{2}{|l|}{\textbf{#1}}}
\usepackage{graphicx}
\usepackage[activate]{pdfcprot}

\begin{document}
\begin{center}
$$X[k1+4.k2]=\sum_{n2=0}^{N/4-1}[(x[n2]+(-i)^{k1}x[N/4+n2]+(-1)^{k1}x[N /2+n2]+(i)^{k1}x[3N/4+n2])W_{N}^{k1.n2}]W_{N/4}^{k2.n2}$$
\label{eqfft4}
\end{center}
\end{document}


and i get this result :

how can i fix that???

• broken it into more lines? is this possible option? – Zarko Sep 4 '16 at 16:31
• What is the tubsbook class? – Bernard Sep 4 '16 at 16:34
• Well for me it's possible and this is what i want to do if possible – A.nechi Sep 4 '16 at 16:34
• Template of TU Braunschweig - Germany university – A.nechi Sep 4 '16 at 16:35

This is not really an issue of LaTeX formatting. If a formula is longer than the text width, it is hard to read and understand even if optimally typeset. I suggest to break down the formular by introducing abbreviations, e.g. in the following way. After that you can still decide to use some appropriate amsmath environment to align the equations.

\documentclass[a4paper,12pt]{scrbook}
\begin{document}
$$X[k1+4.k2]=\sum_{n2=0}^{N/4-1} \alpha(n2)\cdot W_{N}^{k1.n2}\cdot W_{N/4}^{k2.n2} \label{eqfft4}$$
where
$$\alpha(n2)= x[n2]+(-i)^{k1}x[N/4+n2]+(-1)^{k1}x[N /2+n2]+(i)^{k1}x[3N/4+n2]$$
\end{document}


I suggest you use either a multline environment or a nested equation/split environment. At least one line break is required. Select the method that better fits your aesthetic sensibilities.

I further suggest you increase the sizes of the "outer" square brackets and round parentheses slightly to help the eye with determining where the main grouping is taking place.

Incidentally, what are the various . ("dot") characters supposed to signify? Are they multiplication "dots"? If so, they should be replace with \cdot.

\documentclass[a4paper,12pt]{book}
\usepackage{mathtools} % for '\mathclap' macro; automatically loads 'amsmath'
\begin{document}

$$\begin{split} X[k1+4.k2]=\sum_{n2=0}^{\mathclap{N/4-1}}\bigl[\bigl( &x[n2]+(-i)^{k1}x[N/4+n2]+(-1)^{k1}x[N/2+n2]\\ &+(i)^{k1}x[3N/4+n2]\bigr) W_{N}^{k1.n2}\,\bigr] W_{N/4}^{k2.n2} \end{split}$$

\begin{multline}
X[k1+4.k2]=\sum_{n2=0}^{\mathclap{N/4-1}}
\bigl[\bigl (x[n2]+(-i)^{k1}x[N/4+n2]+(-1)^{k1}x[N/2+n2]\\
+(i)^{k1}x[3N/4+n2]\bigr) W_{N}^{k1.n2}\,\bigr] W_{N/4}^{k2.n2}
\end{multline}\label{eqfft4}

\end{document}


Used article as document class, however this will work with any of them (hopefully):

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}
%\usepackage{lipsum}
%\usepackage{listings}
%\usepackage{color}
%\usepackage{url}
%\usepackage{array,multirow}
%\newcommand\mcbf[1]{\multicolumn{2}{|c|}{\textbf{#1}}}
%\newcommand\mlbf[1]{\multicolumn{2}{|l|}{\textbf{#1}}}
%\usepackage{graphicx}
%\usepackage[activate]{pdfcprot}
\usepackage{mathtools}
\usepackage{hyperref}% had to be last in preamble

\begin{document}
%\begin{center} <-- surplus
$$\label{eqfft4} \begin{multlined}[][0.8\linewidth] X[k1+4.k2] = \sum_{n2=0}^{N/4-1}[(x[n2]+(-i)^{k1}x[N/4+n2] \\ + (-1)^{k1}x[N/2+n2] + (i)^{k1}x[3N/4+n2])W_{N}^{k1.n2}]W_{N/4}^{k2.n2} \end{multlined}$$
%\end{center}

\label{eqfft4}
\begin{split}
X[k1+4.k2]
& = \sum_{n2=0}^{N/4-1}[(x[n2]+(-i)^{k1}x[N/4+n2]   \\

Edit: In your MWE I comment all packages which are not relevant to show your equation. Also I move hyperref package on the end of the preamble where it belong. For used math environment aligned I added package mathtools, which provide improved set of amsmath environments for writing multi lines equations.