0

enter image description here

Following is the code that gives the wired result.

\documentclass[a4paper,12pt, oneside]{book}

%enable linespacing commands%
\usepackage{setspace}
%set onehalf line spacing
\onehalfspacing

%enable H option that prevent figure floats
\usepackage{float}

%used to import graphics%
\usepackage{graphicx}

%used for referencing%
\usepackage{harvard}

%customise chapter styles%
\usepackage{titlesec}
\titleformat{\chapter}{}{}{0em}{\bf\LARGE}

%set bibliography listing style to agsm%
\bibliographystyle{agsm}

%set margins%
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}

%keep only the page number%
\pagestyle{plain}

%allows to create tables with different column widths%
\usepackage{tabularx}

%allows to create tables that can span accross pages%
\usepackage{longtable}%dependency of longtabu
\usepackage{tabu}%contains longtabu

%enable support for source code
% this package needs the python package 'sudo pip install pygments'
%add pdfLaTeX option -shell-escape
\usepackage{minted}

\begin{document}




\begin{figure}%[H]
\centering
\caption{possible example composition of a Cgui GUI}
\label{fig:cgui_square}
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
\end{figure}




% begining of the table
\begin{longtabu} to \textwidth { X[1 , l ]  X[1 , l ] }
\label{table:xxxx_xxxxx}\\
\caption{xxxxxxxxx xxx xxxx xxxxxx }\\
% -----------------headings----------------------%
\hline
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
&
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
\\
\hline
\endfirsthead

%headings for next page columns
\hline
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
&
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
\\
\hline
\endhead

%this is printed before the table is broken into the next page
\multicolumn{2}{r}{Continued on next page} \\
\endfoot

\hline
\endlastfoot
% ---------------headings end--------------------%
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\
%-------------------body end---------------------%
\end{longtabu}
% end of the table



\paragraph{}
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxx




\end{document}
2

lt chooses a better pagebreak in this case if you allow the table to be [h] so it is out of the queue before the long table starts.

\documentclass[a4paper,12pt, oneside]{book}

%enable linespacing commands%
\usepackage{setspace}
%set onehalf line spacing
\onehalfspacing

%enable H option that prevent figure floats
\usepackage{float}

%used to import graphics%
\usepackage{graphicx}

%used for referencing%
\usepackage{harvard}

%customise chapter styles%
\usepackage{titlesec}
\titleformat{\chapter}{}{}{0em}{\bf\LARGE}

%set bibliography listing style to agsm%
\bibliographystyle{agsm}

%set margins%
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}

%keep only the page number%
\pagestyle{plain}

%allows to create tables with different column widths%
\usepackage{tabularx}

%allows to create tables that can span accross pages%
\usepackage{longtable}%dependency of longtabu
\usepackage{tabu}%contains longtabu

%enable support for source code
% this package needs the python package 'sudo pip install pygments'
%add pdfLaTeX option -shell-escape
%\usepackage{minted}

\begin{document}




\begin{figure}[htp]
\centering
\caption{possible example composition of a Cgui GUI}
\label{fig:cgui_square}
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
sdl kfj slkdfj klsdjfklsj dfkl jskldfj klsj kl
sdf kjsdhf kjsdh fkj
sd fjhgsd fkjhsdkf
\end{figure}



% begining of the table
\begin{longtabu} to \textwidth { X[1 , l ]  X[1 , l ] }
\label{table:xxxx_xxxxx}\\
\caption{xxxxxxxxx xxx xxxx xxxxxx }\\
% -----------------headings----------------------%
\hline
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
&
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
\\
\hline
\endfirsthead

%headings for next page columns
\hline
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
&
\textbf{xxxxxxxxx xxx xxxx xxxxxx}
\\
\hline
\endhead

%this is printed before the table is broken into the next page
\multicolumn{2}{r}{Continued on next page} \\
\endfoot

\hline
\endlastfoot
% ---------------headings end--------------------%
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\

\hline
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
&
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx
\\
%-------------------body end---------------------%
\end{longtabu}
% end of the table



\paragraph{}
xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxxxx xxxxxxxxx xxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxxx xxx




\end{document}
  • I am very new to latex. Will you please be able to direct me to a link where explains what is happening here (the logic). – Makmeksam Mar 27 '15 at 17:17
  • I applied your solution to my real document which is same as the example I posted ( as I learnt from you yesterday ) except for the characters and the picture inside the figure. There the solution failed. Still the text goes beyond the margin. – Makmeksam Mar 27 '15 at 17:23
  • @Makmeksam to your first comment, there is no logic, interfacing a multipage table when there are pending floats that may or may not be added is hard and there's a bug. using h just avoids it (sometimes) – David Carlisle Mar 27 '15 at 17:42
  • goes off the bottom margin? you could try applying a patch, I'll look up the link – David Carlisle Mar 27 '15 at 17:44
  • take a local copy of longtable.sty and modify according to latex-project.org/cgi-bin/ltxbugs2html?pr=tools/3512 I'd be interested to know if it worked – David Carlisle Mar 27 '15 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.