1

How to modify the Latex code for the following table and tikzpicture so that the output will display properly using this document class.

\documentclass[twoside]{article}


\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
\usepackage{hyperref} % For hyperlinks in the PDF

\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them


\usepackage{graphicx}
%[dvips]
%\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{caption}

\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{algorithm}
\usepackage{algorithmic}
\algsetup{linenosize=\small}
\usepackage[font=small]{caption}


\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\Roman{subsection}} % Roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Improved Cuckoo Search for TTP} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\title{\vspace{-15mm}\fontsize{17pt}{10pt}\selectfont\textbf{An Improved Cuckoo Search algorithm for the Traveling Tournament Problem}} % Article title


\author{
\large
\textsc{Sandile Saul, Adewumi Aderemi Oluyinka}\thanks{The financial assistance of the National Research Foundation (NRF) towards this research is hereby acknowledged. Opinions expressed and conclusions arrived at, are those of the author and are not necessarily to be attributed to the NRF.}\\[2mm] % Your name
\normalsize School of Mathematics, Statistics and Computer Science\\ \normalsize University of Kwazulu-Natal,
Westville Campus,\\ \normalsize Durban, 4000,
South Africa\\ % Your institution
\normalsize \href{mailto:adewumia@ukzn.ac.za}{adewumia@ukzn.ac.za} % Your email address
\vspace{-5mm}
}


\date{}

%----------------------------------------------------------------------------------------

\begin{document}


\begin{center}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[%
  back line/.style={densely dotted},
  cross line/.style={preaction={draw=white, -,line width=8pt}}]
\node (A) {$8$};
\node (B)[below of=A] {$1$};
\node (C) [node distance=1.5cm, right of=B, below of=B]{$2$};
\node (D) [node distance=1.5cm, left of=C, below of=B]{$7$};
\node (E) [node distance=1.5cm, below of=C]{$3$};
\node (F) [node distance=3.0cm, left of=E]{$6$};
\node (G) [node distance=0.8cm, left of=E, below of=E]{$4$};
\node (H) [node distance=0.8cm, right of=G, below of=F]{$5$};
\draw[cross line] (B) -- (C);
\draw[cross line] (C) -- (E);
\draw[cross line] (E) -- (G);
%\draw[cross line] (G) -- (H);
\draw[cross line] (H) -- (F);
\draw[cross line] (F) -- (D);
\draw[cross line] (D) -- (B);
\draw[<->, dashed] (C) to node {} (D);
\draw[<->, dashed] (F) to node {} (E);
\draw[<->, dashed] (G) to node {} (H);
\draw[<->, dashed] (A) to node {} (B);
\end{tikzpicture}
\caption{Polygon method for $n$ = 8.}
\end{figure}
\end{center}

\begin{table}{H!}
\caption{Results produced by the execution of the polygon method.}
\centering
\begin{tabular}{lllr}
\toprule(r){1-4}
$T_i \textbackslash k$ & 1 & 2 & 3 \\
 \midrule
1 & 8 & 6 & 4 \\    
2 & 7 & 5 & 3 \\
3 & 6 & 4 & 2 \\
4 & 5 & 3 & 1 \\
5 & 4 & 2 & 7 \\
6 & 3 & 1 & 8 \\
7 & 2 & 8 & 5 \\
8 & 1 & 7 & 6 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}{H}
\caption{Results produced by the execution of the polygon method.}
\centering
\begin{tabular}{rrrrrrrrr}
\toprule
$T_i \textbackslash k$ & 1 & 2 & 3 & 4 & 5 & 6 & 7\\
 \midrule
1 & 8 & 6 & 4 & 2 & 7 & 5 & 3\\ 
2 & 7 & 5 & 3 & 1 & 6 & 4 & 8\\
3 & 6 & 4 & 2 & 7 & 5 & 8 & 1\\
4 & 5 & 3 & 1 & 6 & 8 & 2 & 7\\
5 & 4 & 2 & 7 & 8 & 3 & 1 & 6\\
6 & 3 & 1 & 8 & 4 & 2 & 7 & 5\\
7 & 2 & 8 & 5 & 3 & 1 & 6 & 4\\
8 & 1 & 7 & 6 & 5 & 4 & 3 & 2\\
\bottomrule
\end{tabular}
\end{table}

\end{thebibliography}

\end{multicols}

\end{document}
cfr
  • 198,882
Alex
  • 191
  • 1
    Alex, please present your question in a way that makes looking into the matter interesting and efficient. A title that is a lump of text, code that is littered with stuff nobody will need, still not compilable ... Stuff like that makes helping time consuming. Hence, we prefer proper test cases. – Johannes_B Mar 25 '15 at 19:56
  • 2
    And what would be the proper output? – Johannes_B Mar 25 '15 at 19:57
  • In particular: doesn't compile (missing \end{document}), \textbackslash invalid in math mode. – Mike Renfro Mar 25 '15 at 19:59
  • Note this comment on your earlier question. – cfr Mar 25 '15 at 22:30
  • 1
    You have \end{thebibliography} and \end{multicols} but no \begin... to match. Don't include manual formatting in the arguments to commands specifying structural elements. \title{} should contain the text of your title. It should not contain vertical or horizontal spacing, font selection commands etc. Similarly for \author{}. – cfr Mar 25 '15 at 22:35
  • Yea I know, the problem I'm having is with the output of the tikz picture and the table. They are not displaying using this document style.. The style has been prepared already, I am only trying to use it but the tables and tikz pictures are not displaying – Alex Mar 25 '15 at 22:59
  • The first step should be to remove everything that isn't needed to cause the problem. Then at least you can ask "Why can't I have x and y at the same time?" – John Kormylo Mar 25 '15 at 23:25
  • @Alex Nothing will display with the code you've posted unless you simply ignore multiple compilation errors and crash on regardless. In that case, I get a blank one page document. – cfr Mar 26 '15 at 01:02

1 Answers1

1

Here is an MWE which reproduces the problem. Note that the problem has nothing to do with figures or tables.

\documentclass[twoside]{article}

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry}
\usepackage{multicol}
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption}
\usepackage{booktabs}
\usepackage{float}
\usepackage{hyperref}
\usepackage{lettrine}
\usepackage{paralist}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{titlesec}

\begin{document}

abc

\end{document}

Here's the error:

(/usr/local/texlive/2014/texmf-dist/tex/latex/titlesec/titlesec.sty
! No room for a new \dimen .
\ch@ck ...\else \errmessage {No room for a new #3}
                                                  \fi 
l.778 \newdimen\titlewidthfirst

? 

This is identical to the first error produced by the code in the question except that the line number will be different.

Note that the code above is minimal because removing any package enables the document to compile successfully.

The problem is the number of new dimensions these packages are collectively trying to create. The total number exceeds TeX's capacity.

The solution is to load etex as explained by egreg:

\documentclass[twoside]{article}
\usepackage{etex}
...
cfr
  • 198,882
  • I have loaded the etex package yet the figure and table is not showing. It only displays a blank space. What else can I do – Alex Mar 26 '15 at 08:31
  • @Alex Is the main error gone, are there new errors, are your packages up to date. Really, you need to give us more information. – Johannes_B Mar 26 '15 at 09:23
  • I have coiped the Log File and I will post it here for you to see the output of the Log file. – Alex Mar 26 '15 at 11:30
  • I cant even post it here because it is too long. I cant see any error in it just a warning and – Alex Mar 26 '15 at 11:33
  • @Alex Make a minimal document which we can compile to reproduce the problem and post that, along with the log. And/or compile interactively so that it stops on error. – cfr Mar 26 '15 at 13:37
  • @cfr I have reposted the question with a codes of a minimal document for u to run b urself. The figure and table that is not displaying is under method 1 and 2. Also I want to know how to add extra author seperately using that template too. – Alex Mar 26 '15 at 18:15