如何修改下表和 tikzpicture 的 Latex 代码,以便使用此文档类正确显示输出。
\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:[email protected]}{[email protected]} % 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}
答案1
以下是重现该问题的 MWE。请注意,该问题与图表无关。
\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}
错误如下:
(/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
?
这与问题中的代码产生的第一个错误相同,只是行号不同。
请注意,上面的代码是最少的,因为删除任何包都可以使文档成功编译。
问题在于这些软件包试图共同创建的新维度数量。总数超出了 TeX 的容量。
解决方案是加载etex
按照以下说明进行加载埃格尔:
\documentclass[twoside]{article}
\usepackage{etex}
...