2

I need some help.

My longtable was all right until I wanted to insert one horizontal dash line. That's why I put package arydshln (which caused troubles). Even before I used \hdashline code, my result got this appearance: vertical line got extended and covered the row of a page number

here

and in the end of longtable, last row is missing a vertical line

here

I just can't figure out where is the problem.

\documentclass[a4paper, 12pt]{article}
\usepackage{times}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs}
\doublespacing
\usepackage{arydshln}

\begin{document}
TABLE
\fontsize{9}{11}\selectfont
\begin{centering}
\begin{longtable}{@{}r |  r   r   r   r   r   r}
\caption{Table}\\
\cline{2-7}
\multicolumn{2}{r}{AA}&  BB &  CC &  DD\\ 
\specialrule{2.0pt}{0pt}{0pt}
\endfirsthead
\cline{2-7}
\multicolumn{2}{r}{AA} &  BB &  CC &  DD\\ 
\specialrule{2.0pt}{0pt}{0pt}
\endhead
11 & A & B & C & D\\ 
22 & A & B & C & D\\ 
33 & A & B & C & D\\ 
44 & A & B & C & D\\ 
55 & A & B & C & D\\ 
66 & A & B & C & D\\ 
77 & A & B & C & D\\ 
88 & A & B & C & D\\ 
99 & A & B & C & D\\ 
111 & A & B & C & D\\ 
222 & A & B & C & D\\ 
333 & A & B & C & D\\
00 & A & B & C & D\\
11 & A & B & C & D\\ 
22 & A & B & C & D\\ 
33 & A & B & C & D\\ 
44 & A & B & C & D\\ 
55 & A & B & C & D\\ 
66 & A & B & C & D\\ 
77 & A & B & C & D\\ 
88 & A & B & C & D\\ 
99 & A & B & C & D\\ 
000 & A & B & C & D\\
111 & A & B & C & D\\ 
222 & A & B & C & D\\ 
444 & A & B & C & D\\
555 & A & B & C & D\\
666 & A & B & C & D\\
777 & A & B & C & D\\
888 & A & B & C & D\\
999 & A & B & C & D\\
\end{longtable}
\end{centering}
\end{document}

(code edited)

3
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Please complete your code so that it will compile when copy-pasted. That way, we can reproduce the problem right away. – cfr Jan 3 '15 at 0:56
  • To further clarify: I'm not sure what the problem is meant to be. When I add the document environment, remove the vertical dots and compile, I get the output I'd expect. So either I don't understand the issue or it is not reproducible even with a completed version of your code. [Last row has as many vertical lines as the preceding two rows.] – cfr Jan 3 '15 at 1:00
  • I edited the code and still experiencing the problem. First part of longtable got too long vertical line, and other part of longtable (that is printed on other page) got a too short vertical line and it doesnt cover whole table (last row to be exactly) – AuroraNord Jan 4 '15 at 11:26
2

Some comments:

  • There is no environment called centering. There's one called center, though.

  • Inserting the instruction \centering is not needed since a longtable environment is centered by default.

  • You may want to replace \specialrule{2.0pt}{0pt}{0pt} with \midrule[2pt] and \cline{2-7} with \cmidrule{2-7}. By the way, a rule that's 2pt thick looks very very heavy. What are you trying to achieve by using such a thick rule (other than distract the reader)?

  • Since you're using the booktabs package to get well-spaced horizontal lines, why insert a vertical rule at all? They're not needed.

enter image description here

\documentclass[a4paper, 12pt]{article}
\usepackage{newtxtext,newtxmath}  %% "times" is deprecated
\usepackage{graphicx,longtable,amsmath,booktabs,setspace}
\doublespacing
%%\usepackage{arydshln} % not needed, right?

\begin{document}
\fontsize{9}{11}\selectfont

\begin{longtable}{@{} r *{4}{r} @{}}
\caption{Table}\\
\cmidrule(l){2-5}
& \kern1.5em AA & BB &  CC &  DD\\ 
\midrule[2pt]
\endfirsthead
\cmidrule(l){2-5}
& AA &  BB &  CC &  DD\\ 
\midrule[2pt]
\endhead
\bottomrule
\endfoot
11 & A & B & C & D\\ 
22 & A & B & C & D\\ 
33 & A & B & C & D\\ 
44 & A & B & C & D\\ 
55 & A & B & C & D\\ 
66 & A & B & C & D\\ 
77 & A & B & C & D\\ 
88 & A & B & C & D\\ 
99 & A & B & C & D\\ 
111 & A & B & C & D\\ 
222 & A & B & C & D\\ 
333 & A & B & C & D\\
00 & A & B & C & D\\
11 & A & B & C & D\\ 
22 & A & B & C & D\\ 
33 & A & B & C & D\\ 
44 & A & B & C & D\\ 
55 & A & B & C & D\\ 
66 & A & B & C & D\\ 
77 & A & B & C & D\\ 
88 & A & B & C & D\\ 
99 & A & B & C & D\\ 
000 & A & B & C & D\\
111 & A & B & C & D\\ 
222 & A & B & C & D\\ 
444 & A & B & C & D\\
555 & A & B & C & D\\
666 & A & B & C & D\\
777 & A & B & C & D\\
888 & A & B & C & D\\
999 & A & B & C & D\\
\end{longtable}
\end{document}
2
  • Uff, my bad. I am a fresh starter (writing thesis for the first time in LaTeX) and was experimenting with tabular, longtable,... so I mixed things apparently. Thanks for rule suggestion. Haven't realized it was so thick, I just wanted it to be slightly thicker than rest of lines. About vertical rule, I have a lots of data in tables, 10 columns or more and it would be a lot easier to read it if specific columns are separated with line. About that package arydshln in code, I need one dashed horizontal line in the table (that i haven't put in yet) but that package messed my vertical line. – AuroraNord Jan 4 '15 at 13:38
  • 1
    @AuroraNord - It's mostly an illusion that vertical lines make a table easier to read. Lines in tables are visual separators. If a vertical line is truly necessary, it's probably the case that the material being separated is so different as to call into question why it's even presented in one table, rather than two (or more) tables. – Mico Jan 4 '15 at 13:43

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.