0

I have the following code:

\documentclass{harvard-thesis}

\newenvironment{bottompar}{\par\vspace*{\fill}}{\clearpage}
\newcommand*\0[1]{{\large#1}}
\newenvironment{psmallmatrix}
{\left(\begin{smallmatrix}}
    {\end{smallmatrix}\right)}
\usepackage{ragged2e}
\usepackage{enumerate}
\usepackage{stackengine}


\usepackage{amsthm}
\usepackage{amssymb}
\makeatletter % undo the wrong changes made by mathspec
\let\RequirePackage\original@RequirePackage
\let\usepackage\RequirePackage
\makeatother

\usepackage[titletoc]{appendix}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{relsize}
\usepackage{hyperref}
\usepackage{makecell}
\usepackage{array}
\usepackage{longtable}


\usepackage{mathrsfs}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}

\usepackage{libertine}

\makeatletter
\g@addto@macro\th@plain{\thm@headpunct{:}}
\makeatother
\theoremstyle{plain}

\newtheorem{ορισμός}{Ορισμός}[chapter]
\newtheorem{λήμμα}{Λήμμα}[chapter]
\newtheorem{θεώρημα}{Θεώρημα}[chapter]
\newtheorem{κατασκευή}{Κατασκευή}[chapter]
\newtheorem{πόρισμα}{Πόρισμα}[chapter]
\newtheorem{αλγόριθμος}{Αλγόριθμος}[chapter]
\theoremstyle{definition}
\newtheorem*{απόδειξη*}{Απόδειξη}

\setromanfont[Numbers=Lining, Ligatures={Common, TeX}, Scale=1.1]{Times New Roman}

\renewcommand\listtablename{Κατάλογος Πινάκων}

\usepackage{minitoc}
\setlength{\mtcindent}{8pt} 
\def\mtctitle{Περιεχόμενα}%
\mtcsettitle{minitoc}{}
\mtcsetrules{*}{off}

\usepackage{geometry}
\usepackage{mathtools}
\usepackage{empheq,bigstrut}
\usepackage{afterpage}

\everydisplay\expandafter{\the\everydisplay\setstretch{1.8}}
\usepackage{graphicx}
\newcommand{\smallerrel}[1]{\mathrel{\mathpalette\smallerrelaux{#1}}}
\newcommand{\smallerrelaux}[2]{\raisebox{.1ex}{\scalebox{.75}{$#1#2$}}}

\newcommand{\smallin}{\smallerrel{\in}}
\newcommand{\smallnotin}{\smallerrel{\notin}}

\renewcommand{\captionlabelfont}{\rmfamily}
\usepackage[utf8]{inputenc}
\usepackage[main=english,greek]{babel}
\addto\captionsenglish{
    \renewcommand*{\tablename}{\textbf{\foreignlanguage{greek}{Πίνακας}}}%
}

\usepackage[font=bf]{caption}

\begin{document}
\chapter{Εισαγωγή}
\section{Εισαγωγικές έννοιες}
\begin{longtable}{c c c c c}
    \caption{$BA(12, 5, 3, 2), r_{1}  = 4, r_{2} = 1, n _{12}^{22}  = 2$} \\ 
    \toprule
    \multicolumn{4}{c}{$n_{1}^{2} = 4, n_{11}^{22} = 2$}&\multicolumn{1}{c}{$n _{2}^{2}= 6$}\\
    \midrule
    1& 1& 1& 2&1 \\
    2& 2& 2& 3&1 \\
    3& 3& 3& 1&1 \\
    1& 1& 2& 1&2 \\
    1& 3& 3& 3&2 \\
    2& 1& 1& 1&2 \\
    2& 2& 3& 2&2 \\
    3& 2& 2& 2&2 \\
    3& 3& 1& 3&2 \\
    1& 2& 1& 1&3 \\
    2& 3& 2& 2&3 \\
    3& 1& 3& 3&3 \\
    \bottomrule
\end{longtable}
\end{document}

and the result is:

enter image description here

So, I ask:

1) How to make the first 4 columns exactly down and centering of $n_{1}^{2} = 4, n_{11}^{22} = 2$ ?

2) How to reduce the space between the caption and the toprule?

3) How to make the toprule to underline the whole caption? The same length of the toprule, I also want for the midrule and the bottomrule.

The harvard-thesis.cls is avalaible here:harvard-thesis, but I have done lots of changes!

I write the whole code, because I have changed lots of things and maybe one of them creates my problems!

  • And I have many codes too... But no reason to upload all of them here :P (Please say some words about your problem and what you want to achieve). Also please try to reduce the code only to the needed part that reproduces the problem. – koleygr Oct 17 '17 at 16:32
  • Καλησπέρα! What is the problem? – Bernard Oct 17 '17 at 16:33
  • @koleygr lots of people want the whole code, to give an answer. That is why I upload all of it. – Vassilis Chasiotis Oct 17 '17 at 16:44
  • @VassilisChasiotis, in your case the whole code real needed because after your questions I see that you want so specific width for the table that depends from almost every line of your code. But we also need your template's code (a link or something) – koleygr Oct 17 '17 at 16:57
  • @koleygr This is the whole code. Do you want the harvard-thesis.cls as I have changed it? – Vassilis Chasiotis Oct 17 '17 at 17:01
1

From tests and after our discussion I realized that this template is not appropriate for most column types. I tried with p and m (I think from array package) columntypes and I failed. I removed almost every package and just left the template and could not use the above columntypes.

So, our fix was something like:

\documentclass{harvard-thesis}


\usepackage{array}
\usepackage{longtable}


\usepackage{mathrsfs}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\usepackage{libertine}

\usepackage[font=bf]{caption}

%\newcolumntype{P}[1]{>{\centering\arraybackslash}m{#1}}
%\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newcolumntype{Z}{@{\hskip 30pt}}
\begin{document}
\chapter{Εισαγωγή}
\section{Εισαγωγικές έννοιες}
\begin{longtable}{c Z c Z c Z  c ZZ c Z}
    \caption{$BA(12, 5, 3, 2), r_{1}  = 4, r_{2} = 1, n _{12}^{22}  = 2$}\vspace{-10pt} \\ 
    \toprule
    \multicolumn{4}{>{\centering\arraybackslash}cZZ}{$n_{1}^{2} = 4, n_{11}^{22} = 2$}&\multicolumn{1}{cZ}{$n _{2}^{2}= 6$}\\
    \midrule
    1& 1& 1& 2&1 \\
    2& 2& 2& 3&1 \\
    3& 3& 3& 1&1 \\
    1& 1& 2& 1&2 \\
    1& 3& 3& 3&2 \\
    \bottomrule
\end{longtable}
\end{document}

But I personally recommend not to use such templates that gives such errors.

0

like this?

enter image description here

i haven't harvard-thesis not greek fonts, however above image is independent from them:

\documentclass{book}
\usepackage{geometry}

\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{libertine}
\usepackage{textcomp}
\usepackage{mathrsfs}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}

\usepackage[titletoc]{appendix}
\usepackage{multicol}
\usepackage{array, booktabs, longtable, makecell, multirow}

\usepackage[font=bf]{caption}
\usepackage{hyperref}

\begin{document}
\begin{longtable}{*{4}{>{\centering\arraybackslash}p{5mm}}c}
    \caption{$BA(12, 5, 3, 2), r_{1}  = 4, r_{2} = 1, n _{12}^{22}  = 2$} \\
    \toprule
\multicolumn{4}{c}{$n_{1}^{2} = 4,\ n_{11}^{22} = 2$}
    &   $n _{2}^{2}= 6$\\
    \midrule
1   & 1 & 1 & 2 &   1 \\
2   & 2 & 2 & 3 &   1 \\
3   & 3 & 3 & 1 &   1 \\
1   & 1 & 2 & 1 &   2 \\
1   & 3 & 3 & 3 &   2 \\
2   & 1 & 1 & 1 &   2 \\
2   & 2 & 3 & 2 &   2 \\
3   & 2 & 2 & 2 &   2 \\
3   & 3 & 1 & 3 &   2 \\
1   & 2 & 1 & 1 &   3 \\
2   & 3 & 2 & 2 &   3 \\
3   & 1 & 3 & 3 &   3 \\
    \bottomrule
\end{longtable}
\end{document}

note: hyperref package with rare exception had to be loaded last in the preamble.

  • It look very nice, but in my output the columns have a big big distance between them – Vassilis Chasiotis Oct 17 '17 at 17:21
  • than you change something. width of the first four columns is 5mm! – Zarko Oct 17 '17 at 17:27
  • I know, but I have lots of space! I changed the 5mm, but I have the same! – Vassilis Chasiotis Oct 17 '17 at 17:33
  • sorry, my crystal ball is busy somewhere else, so i cant see, what you doing. i'm convinced, that if you in my example change only \documentclass{book} to \documentclass{harvard-thesis} you will obtain the very same result as i show in answer. – Zarko Oct 17 '17 at 17:36

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.