Try to move the table to the left, but failed - latex

I was trying to reposition my table a bit left to the page, so I try \hskip -2cm or \hspace{-2cm} But non of these can move the table and here is my code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{array}
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{indentfirst}
\setlength\extrarowheight{2pt}
\title{}
\author{}
\begin{document}
\maketitle
\section{Introduction}
\section{Data Summary}
\begin{table}[H]
\begin{threeparttable}
\small
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\hskip -2cm
\caption{Summary of numeric variables}
\begin{tabular}{l*{1}{ccccc}}
\hline\hline
&\multicolumn{5}{c}{(1)} \\
&\multicolumn{5}{c}{} \\
& count& mean& sd& min& max\\
\hline
Unemployment Rate & 170& 8.3323& 4.1395& 3.1000& 26.0919\\
log of spending per person for secondary education& 168& 9.0229& 0.4344& 7.6109& 9.9616\\
log of spending per person for teriary education& 165& 9.5241& 0.3967& 8.7797& 10.7478\\
log of exchange rate& 170& 1.0983& 2.0997& -0.4986& 7.0522\\
log of GDP per person& 168& 10.5306& 0.3592& 9.7330& 11.5213\\
log of GDP fixed purchasing power& 165& 27.0045& 1.4905& 23.3668& 30.5051\\
log of GDP growth & 159& 1.2268& 0.7896& -1.7458& 3.0063\\
Long-term interest rate on government bonds& 165& 3.8447& 2.1387& 0.5511& 10.5465\\
Short-term interest rate& 170& 1.7675& 1.9971& 0.0078& 10.3317\\
\hline\hline
\end{tabular}
\begin{tablenotes}
\small
\item Source: OECD (2019), Education at a Glance Database, http://stats.oecd.org
\end{tablenotes}
\end{threeparttable}
\end{table}
\section{Methodology}
\end{document}
and my table looks like this:
and I want to make my table left about a least 1.5cm.
Is there other way to do this?

Having your table project into the margin is not a good style for a layout that is not specifically designed to have additional space in the margins for this. The margin should belong to the reader to easily hold your document, adding notes etc. If there is not enough space things like Fermat's Last Theorem are your fault :)
Instead I suggest to use a tabularx to fit the table into the available space:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{array}
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{indentfirst}
\setlength\extrarowheight{2pt}
\usepackage{tabularx}
\usepackage{siunitx}
\title{}
\author{}
\begin{document}
\maketitle
\section{Introduction}
\section{Data Summary}
\begin{table}[H]
\begin{threeparttable}
\small
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\hskip -2cm
\caption{Summary of numeric variables}
\begin{tabularx}{\linewidth}{#{}XS[table-format=3.0]S[table-format=2.4]S[table-format=1.4]S[table-format=-1.4]S[table-format=2.4]#{}}
\toprule
&\multicolumn{5}{c}{(1)} \\\addlinespace
& {count}& {mean}& {sd}& {min}& {max}\\
\midrule
Unemployment Rate & 170& 8.3323& 4.1395& 3.1000& 26.0919\\
log of spending per person for secondary education& 168& 9.0229& 0.4344& 7.6109& 9.9616\\
log of spending per person for teriary education& 165& 9.5241& 0.3967& 8.7797& 10.7478\\
log of exchange rate& 170& 1.0983& 2.0997& -0.4986& 7.0522\\
log of GDP per person& 168& 10.5306& 0.3592& 9.7330& 11.5213\\
log of GDP fixed purchasing power& 165& 27.0045& 1.4905& 23.3668& 30.5051\\
log of GDP growth & 159& 1.2268& 0.7896& -1.7458& 3.0063\\
Long-term interest rate on government bonds& 165& 3.8447& 2.1387& 0.5511& 10.5465\\
Short-term interest rate& 170& 1.7675& 1.9971& 0.0078& 10.3317\\
\bottomrule
\end{tabularx}
\begin{tablenotes}
\small
\item Source: OECD (2019), Education at a Glance Database, http://stats.oecd.org
\end{tablenotes}
\end{threeparttable}
\end{table}
\section{Methodology}
\end{document}
Some other comments:
Try to avoid [H], this is usually a guaranty for bad suboptimal placement of floats. I suggest [htbp] instead
*{1}{ccccc} can be shorted to either ccccc or *{5}{c}
You already load the booktabs package, so I suggest to use \toprule, \midrule and \bottomrule instead of \hline because they have much better spacing around them
instead of manually adding empty lines in the table, I suggest the \addlinespace macro from the booktabs package
With the S column from the siunitx package you can align the numbers by their decimal marker and use actual minus signs instead of cheating with hyphens
you should check the significant figures of your values. If your standard deviation is between 0.3 and 4.1, it makes no sense to give the values with 4 decimal places.

Related

How to split long list of equations into 2 columns in a document

Good day.
I have this list of equations on a latex document. I intend to split it into two columns to economize space. Here is the code I used:
\begin{multicol}{2}
\textit{Chemical Initiation Reaction:}
\begin{equation*}
I\xrightarrow{K_{d}}2fR^{^{\bullet}}
\end{equation*}
\begin{equation*}
R^{^{\bullet}}+M\xrightarrow{K_{i}}R_{1}^{^{\bullet}}
\end{equation*}
\textit{Thermal Initiation Reaction:}
\begin{equation*}
3M\xrightarrow{K_{iterm}}M_{1}^{^{\bullet}}+M_{2}^{^{\bullet}}
\end{equation*}
\begin{equation*}
M_{1}^{^{\bullet}}+M\xrightarrow{4K_{P}}P_{2}^{^{\bullet}}
\end{equation*}
\begin{equation*}
M_{2}^{^{\bullet}}+M\xrightarrow{4K_{P}}P_{3}^{^{\bullet}}
\end{equation*}
\textit{Chain Propagation Reaction:}
\begin{equation*}
P_{n}^{^{\bullet}}+M\xrightarrow{K_{P}}P_{n+1}^{^{\bullet}}
\end{equation*}
\textit{Chain Transfer to Monomer Reaction:}
\begin{equation*}
P_{n}^{^{\bullet}}+M\xrightarrow{K_{trM}}P_{1}^{^{\bullet}}+ D_{n}
\end{equation*}
\textit{Chain Transfer to Solvent Reaction:}
\begin{equation*}
P_{n}^{^{\bullet}}+S\xrightarrow{K_{trS}}P_{1}^{^{\bullet}}+D_{n}
\end{equation*}
\textit{Chain Termination by Combination Reaction :}
\begin{equation*}
P_{n}^{^{\bullet}}+P_{m}^{^{\bullet}}\xrightarrow{K_{tc}}D_{n+m}
\end{equation*}
\textit{Chain Termination by Disproportionation Reaction :}
\begin{equation*}
P_{n}^{^{\bullet}}+P_{m}^{^{\bullet}}\xrightarrow{K_{td}}D_{n}+D_{m}
\end{equation*}
\end{multicol}
This is what I am expecting to get below after using the \multicol command.
I don't know what your use case is but, in the current shape, the equations plus comments are too messy.
It would be better to split equations. Then move comments/annotations to the bottom and then arrange equations in two groups. For annotations, I would make a simple reformatted list with references to equations.
EDIT (On adding a caption)
By default, standard \caption{...} would be enough. However, in this particular case, you have to load another package caption and use its \captionof{table}{...} instead. The former needs to be inside a table environment, which is not the case here. So in summy add the following to the code
# Somewhere after \documentclass...
\usepackage{caption}
\captionsetup[table]{position=top,skip=12pt}
and then right before the \begin{tabular}...
# Before tabular
\captionof{table}{<Caption of your table>}
.
\documentclass{article}
\usepackage{mathtools} % Adds improvements to amsmath
\usepackage{tabularx} % Groups equations
\usepackage{enumitem} % To add formatting to standard lists
\usepackage{caption}
\captionsetup[table]{position=top,skip=12pt}
\usepackage{kantlipsum} % Only for dummy texts
\begin{document}
Start of dummy text. \kant[1][1]
\bigskip
\begingroup
\bgroup
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{-\baselineskip}
\centering
\renewcommand*\tabularxcolumn[1]{>{\centering\arraybackslash}p{#1}}
\renewcommand*{\arraystretch}{1}
\captionof{table}{Caption of the table below}
\begin{tabularx}{0.85\linewidth}{#{}X|X}
\textbf{Column 1} & \textbf{Column 2} \\
\hline
\begin{gather}
\begin{gathered}
I\xrightarrow{K_{d}}2fR^{^{\bullet}} \\
R^{^{\bullet}}+M\xrightarrow{K_{i}}R_{1}^{^{\bullet}} \\
\end{gathered} \label{eq:chem-init-react} \\[12pt]
\begin{gathered}
3M\xrightarrow{K_{iterm}}M_{1}^{^{\bullet}}+M_{2}^{^{\bullet}} \\
M_{1}^{^{\bullet}}+M\xrightarrow{4K_{P}}P_{2}^{^{\bullet}} \\
M_{2}^{^{\bullet}}+M\xrightarrow{4K_{P}}P_{3}^{^{\bullet}}
\end{gathered} \label{eq:chain-transfer-react}
\end{gather} &
\setlength\jot{6pt}
\begin{gather}
P_{n}^{^{\bullet}}+M\xrightarrow{K_{P}}P_{n+1}^{^{\bullet}} \label{eq:chain-combine-react} \\
P_{n}^{^{\bullet}}+M\xrightarrow{K_{trM}}P_{1}^{^{\bullet}}+ D_{n} \label{eq:thermal-init-react} \\
P_{n}^{^{\bullet}}+S\xrightarrow{K_{trS}}P_{1}^{^{\bullet}}+D_{n} \label{eq:chain-propag-react} \\
P_{n}^{^{\bullet}}+P_{m}^{^{\bullet}}\xrightarrow{K_{tc}}D_{n+m} \label{eq:chain-transfer-monomer-react} \\
P_{n}^{^{\bullet}}+P_{m}^{^{\bullet}}\xrightarrow{K_{td}}D_{n}+D_{m} \label{eq:chain-disprop-react}
\end{gather}
\end{tabularx}\par
\egroup
\bigskip
\noindent Annotations:
\begin{itemize}[nosep,before=\vspace{3pt}\itshape]
\item[\eqref{eq:chem-init-react}:] Chemical Initiation Reaction
\item[\eqref{eq:chain-transfer-react}:] Chain Transfer to Solvent Reaction
\item[\eqref{eq:chain-combine-react}:] Chain Termination by Combination Reaction
\item[\eqref{eq:thermal-init-react}:] Thermal Initiation Reaction
\item[\eqref{eq:chain-propag-react}:] Chain Propagation Reaction
\item[\eqref{eq:chain-transfer-monomer-react}:] Chain Transfer to Monomer Reaction
\item[\eqref{eq:chain-disprop-react}:] Chain Termination by Disproportionation Reaction.
\end{itemize}\par
\endgroup
\bigskip
End dummy text. \kant[1][2]
\end{document}

Automatically instert multiple images in table from folder

I need to input images into a table that i have created in latex, the problem is that i have hundreds of these and various tables to make, therefore i was looking for a way that allows me not to write every single name of image in the command. I have all the images in a overleaf folder and they all have similar names like: fake_image_MPI_rank_0_Epoch_92_Batch_400_N_image_16.png
my table looks like this:
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|c|c|c|}}
\hline
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} \\
\hline
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
\includegraphics[width=20mm]{} &
...
...
\end{tabular}
\end{table}
By looking online i realized that this could be done with a for loop or something similar. However didn't really find many examples or documentation that allows me to write that bunch of latex code. Does someone know how to do it?
logic behind files names
epoch: from 0 to above 1000 but i am interested in just a few of these (say from 998 to 1000)
batch: from 0 to 400 and is incremented of 100 ( so 0, 100, 200, ...)
image: from 1 to 10 with increments of 1
MPI_rank: Does NOT change (always 0)
Iterating over a few epochs (say from 998 to 1100) and inserting ALL images of ALL batches would produce enough content to create one of these tables.
link to overleaf example
https://www.overleaf.com/3116518543qnnrwdhsbdbg
All these picture probably won't fit on a single page, so I suggest to forgo the table and just place them side by side. This will be the easiest way to allow page breaks. You can add the caption with the \captionof macro from the caption package.
And without the table, the loops can easily be done with \foreach from the pgffor package. If you need lines, you could instead place the images into \fboxes, but using so many lines in a table is anyway bad style, so better remove them.
Some other comments:
don't load the same package multiple times
load hyperref last
\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{xcolor}
%\usepackage{url}
\usepackage[margin=1.0in]{geometry}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{comment}
\usepackage{ifthen}
\usepackage{placeins}
\usepackage{authblk}
\usepackage{afterpage}
\usepackage{amsthm}
\usepackage{soul}
\usepackage[english]{babel}
%\usepackage{xcolor}
\graphicspath{ {./images/} }
\newtheorem*{remark}{\textbf{Remark}}
\usepackage{subcaption}
\usepackage{textgreek}
\usepackage[font={it}]{caption}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{pgffor}
\usepackage{hyperref}
\date{November 2020}
\begin{document}
\section{Introduction}
In the IMAGES folder i loaded images from epoch 1218 batch 200 to epoch 1220 batch 0
\begingroup
\raggedright%
\foreach \epoche in {998,...,1000}{%
\foreach \batch in {0,100,...,400}{%
\foreach \x in {1,...,10}{%
\includegraphics[width=20mm]{IMAGES/fake_image_MPI_rank_0_Epoch_\epoche _Batch_\batch_N_image_\x }\hspace{0pt}%
}}}
\captionof{table}{Bla Bla bla}
\label{somekey}
\endgroup
\clearpage
\begingroup
\raggedright%
\foreach \epoche in {1219,...,1219}{%
\foreach \batch in {0,100,...,400}{%
\foreach \x in {1,...,10}{%
\fbox{\includegraphics[width=20mm]{IMAGES/fake_image_MPI_rank_0_Epoch_\epoche _Batch_\batch_N_image_\x }}\hspace{0pt}%
}}}
\captionof{table}{Bla Bla bla}
\label{somekeyy}
\endgroup
\end{document}

Undefined control sequence \chapter

Hello I'm new in Latex.
I was trying to write my thesis, using the MasterDoctoralClass.cls.
This is my main.tex:
\documentclass[
11pt,
english,
singlespacing,
headsepline
]{MastersDoctoralThesis}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} )
\addbibresource{example.bib}
\usepackage[autostyle=true]{csquotes}
%----------------------------------------------------------------------------------------
% MARGIN SETTINGS
%----------------------------------------------------------------------------------------
\geometry{
paper=a4paper,
inner=2.5cm,
outer=3.8cm,
bindingoffset=.5cm,
top=1.5cm,
bottom=1.5cm
}
%----------------------------------------------------------------------------------------
% THESIS INFORMATION
%----------------------------------------------------------------------------------------
\thesistitle{Title Thesis}
\supervisor{Prof. X \textsc{Y} \\ Dr. Z \textsc{W}}
\degree{Master of Science in Electronic Engineering}
\author{Name \textsc{Surname}}
\subject{Electronic Engineering}
\keywords{}
\university{{Università}}
\department{{Department of Information Engineering, Electronics and Telecommunications}}
\group{{Master of Science in Electronic Engineering}}
\faculty{{Faculty of Information Engineering, Informatics and Statistics}}
\AtBeginDocument{
\hypersetup{pdftitle=\ttitle}
\hypersetup{pdfauthor=\authorname}
\hypersetup{pdfkeywords=\keywordnames}
}
\begin{document}
\frontmatter
\pagestyle{plain}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\begin{titlepage}
\begin{center}
\includegraphics[scale=1]{logo.jpg}
\end{center}
\begin{center}
\vspace*{.01\textheight}
\textsc{\Large Master Thesis}\\[1cm]
\HRule \\[0.4cm]
{\huge \bfseries \ttitle\par}\vspace{0.4cm}
\HRule \\[1.5cm]
\begin{minipage}[t]{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
\href{}{\authorname}
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
{\supname}
\end{flushright}
\end{minipage}\\[2cm]
\begin{center}
\includegraphics[scale=0.4]{logo2.jpg}\hfill\includegraphics[scale=0.5]{logo3.jpg}
\end{center}
\vspace*{1.5cm}
\groupname\\\deptname\\[1.5cm]
\vfill
\rule{3cm}{1pt}\\
{\large \today}\\[4cm]
%\includegraphics{Logo}
\vfill
\end{center}
\end{titlepage}
%----------------------------------------------------------------------------------------
% QUOTATION PAGE
%----------------------------------------------------------------------------------------
\vspace*{0.2\textheight}
\begin{flushright}
\thispagestyle{empty}
\vspace*{5cm}
\itshape\enquote{Something}\\[0.3cm]
\end{flushright}
\hfill Name
%----------------------------------------------------------------------------------------
% ABSTRACT PAGE
%----------------------------------------------------------------------------------------
\begin{abstract}
\addchaptertocentry{\abstractname}
The Thesis Abstract is written here (and usually kept to just this page). The page is kept centered vertically so can expand into the blank space above the title too\ldots
\end{abstract}
%----------------------------------------------------------------------------------------
% ACKNOWLEDGEMENTS
%----------------------------------------------------------------------------------------
\begin{acknowledgements}
\addchaptertocentry{\acknowledgementname}
The acknowledgments and the people to thank go here, don't forget to include your project advisor\ldots
\end{acknowledgements}
%----------------------------------------------------------------------------------------
% LIST OF CONTENTS/FIGURES/TABLES PAGES
%----------------------------------------------------------------------------------------
\tableofcontents
\listoffigures
\listoftables
%----------------------------------------------------------------------------------------
% ABBREVIATIONS
%----------------------------------------------------------------------------------------
\begin{abbreviations}{ll} %
\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere\\
\textbf{WSF} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or\\
\end{abbreviations}
%----------------------------------------------------------------------------------------
% PHYSICAL CONSTANTS/OTHER DEFINITIONS
%----------------------------------------------------------------------------------------
\begin{constants}{lr#{${}={}$}l}
Speed of Light & $c_{0}$ & \SI{2.99792458e8}{\meter\per\second} (exact)\\
\end{constants}
%----------------------------------------------------------------------------------------
% SYMBOLS
%----------------------------------------------------------------------------------------
\begin{symbols}{lll}
$a$ & distance & \si{\meter} \\
$P$ & power & \si{\watt} (\si{\joule\per\second}) \\
%Symbol & Name & Unit \\
\addlinespace
$\omega$ & angular frequency & \si{\radian} \\
\end{symbols}
%----------------------------------------------------------------------------------------
% DEDICATION
%----------------------------------------------------------------------------------------
\dedicatory{For my family}
\end{document}
%----------------------------------------------------------------------------------------
% THESIS CONTENT - CHAPTERS
%----------------------------------------------------------------------------------------
\mainmatter
\pagestyle{thesis}
\include{Chapters/Introduction}
%\include{Chapters/Chapter1}
If I compile main.tex (with PDFLatex, I also did it with Latex and PDFTex) it doesn't return me any error, but when I look at the PDF it doesn't print the Introduction.
So I was watching to the Introduction.tex:
% Chapter 1
\chapter{Chapter Title Here} % Main chapter title
\label{Chapter1} % For referencing the chapter elsewhere, use \ref{Chapter1}
%----------------------------------------------------------------------------------------
% Define some commands to keep the formatting separated from the content \newcommand{\keyword}[1]{\textbf{#1}} \newcommand{\tabhead}[1]{\textbf{#1}} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\file}[1]{\texttt{\bfseries#1}} \newcommand{\option}[1]{\texttt{\itshape#1}}
%----------------------------------------------------------------------------------------
\section{Welcome and Thank You} Welcome to this \LaTeX{} Thesis Template, a beautiful and easy to use template for writing a thesis using the \LaTeX{} typesetting system.
If you are writing a thesis (or will be in the future) and its subject is technical or mathematical (though it doesn't have to be), then creating it in \LaTeX{} is highly recommended as a way to make sure you can just get down to the essential writing without having to worry over formatting or wasting time arguing with your word processor.
\LaTeX{} is easily able to professionally typeset documents that run to hundreds or thousands of pages long. With simple mark-up commands, it automatically sets out the table of contents, margins, page headers and footers and keeps the formatting consistent and beautiful. One of its main strengths is the way it can easily typeset mathematics, even \emph{heavy} mathematics. Even if those equations are the most horribly twisted and most difficult mathematical problems that can only be solved on a super-computer, you can at least count on \LaTeX{} to make them look stunning.
And if I complie it I have some errors:
Undefined control sequence \chapter
Missing \begin{document}. \chapter{C
Undefined control sequence \section
I tryed to put the \begin{document} but I still have the same errors on the undefined control sequence and other errors like
The font size command \normalisize si not defined:there is probably something wrong with the class file.
Can someone help me, please? Thanks!
If on line 13 you remove the ) and move the \end{document} statement on line 183 to the end of the main, it will compile properly.

! LaTeX Error: Something's wrong--perhaps a missing \item

\documentclass[11pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphics}
\usepackage {epsfig}
\usepackage{fancyhdr}
\linespread{1.4}
\setlength{\topmargin}{-0.4in}
\setlength{\topskip}{0.3in} % between header and text
\setlength{\textheight}{9.5in} % height of main text
\setlength{\textwidth}{6in} % width of text
%\setlength{\leftmargin}{-0.6in}
%\setlength{\oddsidemargin}{0.75in} % odd page left margin
%\setlength{\evensidemargin}{0.75in} % even page left margin
\addtolength{\evensidemargin}{-0.4in}
\addtolength{\oddsidemargin}{-0.4in}
\addtolength{\textwidth}{0.4in}
\begin{document}
\renewcommand\bibname{References}
\begin{titlepage}
\input{TitlePage}
\end{titlepage}
\pagenumbering{gobble}
\newpage
\pagenumbering{roman}
%\tableofcontents
\chapter*{
\begin{center}
{Abstract}
\end{center}
}
\begin{quotation}
\paragraph{}
Bank are providing mobile application to their customer. We are developing
banking application using Location Based Encryption. As compare to current
banking application which are location independent,
\\
\textbf{Keywords:}
Enter Keyword here.......
\end{quotation}
\newpage
\pagenumbering{arabic}
\pagestyle{fancy}
\fancyhead{} % clear all fields
\fancyhead[RO,LE]{}
\renewcommand\headrule{}
\rhead{PROJECT NAME}
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[RE,LO]{P.E.O COLLEGE}
\input{intro}
%\input{Literature_Survey}
\input{table}
%\input{problmstmt}
\input{scope}
%\input{future}
\input{conclusion}
\input{ref}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I have this latex code. But when I try to compile it it gives me an error saying :
! LaTeX Error: Something's wrong--perhaps a missing \item.See the
LaTeX manual or LaTeX Companion for explanation.Type H for
immediate help....
This error is on line:
\end{quotation}
Why am I getting this error? I haven't added any \item on the line where I'm getting the error.
The \paragraph and \\ instructions in the quotation do not make much sense. I guess that you meant something like this:
\begin{quotation}
\noindent
Banks are providing mobile applications to their customer. We are developing a
banking application using \emph{Location Based Encryption}. Compared to current
banking applications, which are location independent, \ldots
\paragraph{Keywords:} bank, application, encryption, location, mobile.
\end{quotation}

Easiest way to center tables and other elements?

What is the best way to make things center properly? Once I start messing around with tables, things either start shifting left or right, destroying the balance. How can make it so everything is always centered?
Right now this will lead to the table being messed up, and have the right edge go off the screen. What can I do?
Here's most of the code, I cut out a lot of the useless functions, since they are all almost the same. Its for making Use Cases for school, since we got to do about 40 of these for a project.
\documentclass[10pt, a4paper]{article}
\usepackage{booktabs}
\begin{document}
\newcommand{\UCStart}[2]{
\newpage
\subsection[UC.#1]{UC.#1}
\begin{tabular}{|l|m{4in}|c|}
\hline
\textbf{UC.#1}
& \textbf{#2}
& \textbf{Traceability} \\ \hline
}
\newcommand{\UCDesc}[2]{
\textbf{Description}
& #1
& #2 \\ \hline
}
\newcommand{\UCActors}[2]{
\textbf{External Actors}
& #1
& #2 \\ \hline
}
% Snip... 40 odd more functions %
\newcommand{\UCEnd}{
\end{tabular}
}
\begin{table}[!ht]
\setlength{\extrarowheight}{2pt}
% UC 1
\UCStart{01}{Administrator Starts Server}
\UCDesc{This describes the process of the administrator starting the server}{\space}
\UCActors{Administrator}{\space}
\UCRelated{UC.02}{\space}
\UCPre{Server is not running}{\space}
\UCTrigger{Administrator wants to start the server}{\space}
\UCSeq{
\begin{enumerate}
\item Administrator boots up hardware
\item Administrator starts Administrator console
\item Administrator logins into Administrator account with the corresponding password
\item Administrator clicks start
\end{enumerate}
}{\space}
\UCPost{Conditions that must be true, in order for the use case to finish}{\space}
\UCAltSeq{
\textbf{Alternative Use Case 01} \newline
\begin{itemize}
\item UC.01.ALT.01
\item If administrator fails authentication in step 3
\begin{enumerate}
\item Notify administrator of failed authentication
\end{enumerate}
\end{itemize}
}{\space}
\UCNonFunc{ ??? }{\space}
\UCComments{ Comments Go Here }{\space}
\UCEnd
\end{table}
\end{document}
I can't compile your example due to several errors, and I'm not sure what you mean by "the best way to make things center properly". As a kind of crystal ball-type answer, is this what you're looking for?
\documentclass[10pt,a4paper]{article}
\usepackage{array}
\begin{document}
\begin{table}
\centering
\begin{tabular}{
| >{\centering\arraybackslash }p{4cm} |
>{\centering\arraybackslash }p{6cm} |
}
\hline
some centred text in cells & some more centred text in cells \\
\hline
centred text in cells & more centred text in cells \\
\hline
\end{tabular}
\end{table}
\end{document}
It is difficult to see what the problem is when we can't compile your example.
Looking through the code you provided, a table may not actually be appropriate in this situation. Instead, you might try something like the following:
\documentclass[10pt,a4paper]{article}
\begin{document}
\subsection{Administrator Starts Server}
\paragraph{Description:} This describes the process of the adminsitrator starting the server.
\paragraph{Actors:} Administrator
\paragraph{Preconditions:} Server is not running.
\paragraph{Sequence:}
\begin{enumerate}
\item Administrator boots up hardware
\item Administrator starts Administrator console
\item Administrator logins into Administrator account with the corresponding password
\item Administrator clicks start
\end{enumerate}
\end{document}
In the example you provided, I don't see that you ever put any text in the "Traceability" column. To mimic this column, you could either use \marginpar{my text} to put text in the margin, or you could use blahblah\hfill{}my text to right-align text on the same line as "blahblah". If you want the traceability text to be right-aligned and on its own line, use \begin{flushright} my text \end{flushright}.
If this doesn't help solve your problem, please provide us with a minimal example that compiles and demonstrates the problem.

Resources