Graphics, Figures & Tables ⇒ problems with the legend of a long table
problems with the legend of a long table
Dear all,
I was wondering if you could help me solving the next problem I encountered. This time it has to do with a very long legend. If I include it in my long table, the format automatically exceeds the format of the layout. Attached you will find a picture and a minimal example so that you can see what I mean.
As usual, many thanks in advance.
Best regards,
Marie2011
I was wondering if you could help me solving the next problem I encountered. This time it has to do with a very long legend. If I include it in my long table, the format automatically exceeds the format of the layout. Attached you will find a picture and a minimal example so that you can see what I mean.
As usual, many thanks in advance.
Best regards,
Marie2011
- Attachments
-
- longtable.tex
- (2.41 KiB) Downloaded 576 times
-
- longtable.png (6.32 KiB) Viewed 8170 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

problems with the legend of a long table
The picture looks right to me. If you want a different caption style you should change it globally (so it's consistent for all captions). KOMA-Script brings it's own option for this (see
scrguien.pdf) or you could use the caption package.
Regards

Regards
site moderator & package author
problems with the legend of a long table
Hallo Clemens and all members,
Many thanks for your prompt answer. The problem I have is that the table has a very long legend and it really exceeds the allowed space. Attached you will find an example so that you can see what I mean. What bothers me is that I do not have such problems when I do not use the order \longtable and I can write long legends without problems.
As usual, many thanks in advance.
Best regards,
Marie
Many thanks for your prompt answer. The problem I have is that the table has a very long legend and it really exceeds the allowed space. Attached you will find an example so that you can see what I mean. What bothers me is that I do not have such problems when I do not use the order \longtable and I can write long legends without problems.
As usual, many thanks in advance.
Best regards,
Marie
Last edited by cgnieder on Thu Nov 08, 2012 11:50 am, edited 1 time in total.
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
Re: problems with the legend of a long table
Could you perhaps show us what you would like to accomplish (showing an image using longtable for example)? I saw this topic yesterday as well and don't see anything wrong here, so I'm not sure what you would like to see.
Also, the tex-file you attached to the original post does not compile at all on my computer since it contains references to custom packages of your own (mystyle.sty). It uses so many packages that it cannot be considered a minimal working example, so could you please submit a file that does compile? Or else submit the missing files as well if it is really necessary for the mwe?
Also, the tex-file you attached to the original post does not compile at all on my computer since it contains references to custom packages of your own (mystyle.sty). It uses so many packages that it cannot be considered a minimal working example, so could you please submit a file that does compile? Or else submit the missing files as well if it is really necessary for the mwe?
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
problems with the legend of a long table
Dear forum members,
Many thanks for the hint. Attached you will find a picture and a minimum example. I have not deleted the packages since I do not know which are the ones I need. I hope everything is OK now. I have just realized that my problem does not have to do with the legend but with the line of the table. In other words, the table exceeds the established format. On the other hand, the legend does not appear any more when I compile the document.
Many thanks in advance.
Best regards,
Marie
Many thanks for the hint. Attached you will find a picture and a minimum example. I have not deleted the packages since I do not know which are the ones I need. I hope everything is OK now. I have just realized that my problem does not have to do with the legend but with the line of the table. In other words, the table exceeds the established format. On the other hand, the legend does not appear any more when I compile the document.
Many thanks in advance.
Best regards,
Marie
- Attachments
-
- longtable.tex
- (1.16 KiB) Downloaded 470 times
-
- main-document.tex
- (3.68 KiB) Downloaded 532 times
Last edited by cgnieder on Thu Nov 08, 2012 12:45 pm, edited 1 time in total.
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
problems with the legend of a long table
Well, the idea behind the mwe is that you remove (or comment out) packages until you have only the code left active that produces the problem, and maybe even can tell which package is the problem (even though you don't know how to solve it).
But anyway, the problem here is probably that you use the column specifier l, which produces a left aligned column, however, it does not allow linebreaks. Perhaps you could use {lp{4in}} instead of {ll}.
A true minimal example of how to use it:
This gives the attached output.
But anyway, the problem here is probably that you use the column specifier l, which produces a left aligned column, however, it does not allow linebreaks. Perhaps you could use {lp{4in}} instead of {ll}.
A true minimal example of how to use it:
Code: Select all
\documentclass{scrartcl}
\usepackage{longtable}
\begin{document}
\begin{center}
\begin{longtable}{|l|p{4in}|}
1 & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mattis ante quis risus eleifend ut pellentesque sapien congue. Aenean pretium fringilla imperdiet. Proin blandit est tristique elit dapibus id molestie metus rhoncus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam consequat est sed lacus feugiat facilisis vitae quis tellus. Etiam condimentum molestie nibh, quis cursus libero eleifend quis. Praesent consequat tellus nec nisl aliquam sed ullamcorper massa porta. Vivamus diam orci, vehicula in scelerisque a, tempor et mi. Aenean ipsum quam, dapibus eget rutrum vel, pulvinar eu turpis.\\
\end{longtable}
\end{center}
\end{document}
- Attachments
-
- longtable_test.pdf
- (15.92 KiB) Downloaded 437 times
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
Re: problems with the legend of a long table
On the disappearing legend, maybe this is centered above the table (not on the page), which now has become so wide that it shifted to the right so much that it floated of the page entirely?
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
problems with the legend of a long table
You specified two
This will still not produce a nice table due to the way you set the table head. A better way to set the table header on continuation pages would be something like this:
that is, mimicking the way longtable builts its caption (see the manual).
As an aside I would recommend using booktabs' commands
Putting this all together you get an example without bad boxes:
Regards
l
columns for the table. In a l
column there are no line breaks whatsoever. A better choice might be a p{<width>}
column:Code: Select all
\begin{longtable}{lp{.7\linewidth}}
...
\end{longtable}
Code: Select all
\multicolumn{2}{c}{\parbox{\LTcapwidth}{\tablename\ \thetable{}: ...}}
As an aside I would recommend using booktabs' commands
\toprule
, \mirdule
, and \bottomrule
for the lines.Putting this all together you get an example without bad boxes:
Code: Select all
\documentclass{scrbook}
\usepackage{booktabs,longtable}
\begin{document}
\begin{longtable}{lp{.7\linewidth}}
\caption{Respuestas a la pregunta 10 del cuestionario final de
evaluación: incluir pregunta / incluir pregunta / incluir pregunta} \label{tab:longtable} \\
\toprule
\textbf{Participante} & \textbf{Respuesta} \\
\midrule
\endfirsthead
\toprule
\multicolumn{2}{c}
{\parbox{\LTcapwidth}{\tablename\ \thetable{}: Respuestas a la pregunta 10 del
cuestionario final de evaluación: incluir pregunta/ incluir pregunta / incluir
pregunta}} \\
\toprule
\textbf{Participante} & \textbf{Respuesta} \\
\midrule
\endhead
\midrule
&\hfil\emph{continuación} \\
\bottomrule
\endfoot
\bottomrule
\endlastfoot
1 & Einst war Großbritannien die vorherrschende Weltmacht. Im Kampf mit
Portugal, Spanien, Frankreich und den Niederlanden eroberte das
British Empire Gebiete, die zu Hochzeiten fast ein Viertel der Erde
bedeckten. Heute erinnern nur noch 14 kleine Außenposten an die
koloniale Vergangenheit. Der Fotograf Jon Tonks hat sie besucht: Oft
Tausende Meilen vom Festland entfernt, sind die Insulaner britisch --
immer noch und mit Leidenschaft.
\end{longtable}
\end{document}
site moderator & package author
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
problems with the legend of a long table
@cgnieder, haha you went the extra way of rebuilding his entire table. I was thinking to do the same (including mentioning
booktabs) and then realized I had some work of my own I should finish before tomorrow 


Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Re: problems with the legend of a long table
@hugovdberg this only took me about five minutes which is not too much for an answer, I think. 

site moderator & package author