New answers tagged

3

tcolorbox normally issues \pagebreak (among other things) when starting; this is ignored in tabular, but not in longtable. \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{color} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{many,listings} \usepackage{longtable} \definecolor{bg}{RGB}{240,240,240} \begin{document} ...


4

Using \internallinenumbers seems to work. Update: Comment asked to change the spacing inside the new env. To use \internallinenumbers it needs a new env. One can use minipage or parbox and may be others, and it will work. To adjust the margins, here is the updated example using \vspace{5pt} but there are other ways to adjust margins and spacings one can ...


3

I think I'd be inclined to use Christian's answer (+1), but, just to provide other ideas, you could use the needspace package. E.g., \documentclass[11pt]{article}%ext \usepackage{blindtext} \usepackage{longtable,needspace,etoolbox} \AtBeginEnvironment{longtable}{\needspace{5\baselineskip}} \begin{document} \blindtext \blindtext %\needspace{5\baselineskip} ...


5

This is only a 'brute force' solution: Use \endhead after the first \hline. This 'guarantees' that there's always a \hline on table pages other than the first one. The first one is 'empty' because longtable can't break the \blindtext paragraph so it is shifted to the next page`. \documentclass[11pt]{article}%ext \usepackage{blindtext} ...


1

It is easier for people to help if you post a complete document, as below, that shows the problem rather than disconnected fragments, but anyway, it fits on the page if you reduce the font size, and steal a bit of the bottom margin. \documentclass[12pt]{book} \usepackage{lscape,longtable} \begin{document} \begin{landscape} \scriptsize ...


2

Some suggestions: Never use \resizebox for tables -- unless you want to risk creating major font size changes between the text and table portions of your document and from one table to the next. Instead, provide a bit more structure to the table headers, e.g., through well-chosen line breaks. That way, the overall width of the table won't exceed ...


0

Instead of using c as the main column type for all three columns, you may want to think about using l for the first column and p for the second and third columns. That way, you can save yourself a lot of \multicolumn{1}{..}{...} statements in the body of the table. Combining this idea with the \seqsplit macro for the long character sequences, along with ...


1

Changing the value of \arraystretch is often not a good solution, as the contents of a cell is no more vertically centred in the cell. That said, you can add these lines in your preamble: \usepackage{etoolbox} \AtBeginEnvironment{longtable}{\renewcommand\arraystretch{2}} Another solution: Add: \usepackage{etoolbox, makecell} \setcellgapes{5pt} % ...


2

Your example fitted within the line so there was no need to change the size at all, so to make a real example I added an inch to the margin settings in the geometry options so the original table didn't fit, I then changed font size and the tabcol sep so it fitted in the narrow page. \documentclass[fleqn,preprint,10pt]{elsarticle} \usepackage{hyperref} ...


0

EDIT: This will produce the result that you want. The only caveat being that the second row in the file sometable.dat has to be manually entered, which forces the string type style of all the columns. \documentclass{article} \usepackage{pgfplotstable} \usepackage{longtable} \usepackage{booktabs} \usepackage{array} \usepackage{siunitx} ...


2

The line \multicolumn{4}{p{\linewidth}}{note}\tabularnewline requests the full line width for the table. Since the columns would be small otherwise, the space has to go somewhere and LaTeX puts it in the last column. There are several ways to solve the problem, e.g.: An additional fifth column, which takes the remaining space A smaller width for the ...


1

Just remove the \begin{center}...\end{center} -- a longtable is already centered by default, the \begin{center}...\end{center} introduces too much vertical spacing which leads to an additional empty page then! \documentclass[11pt,oneside]{book} \usepackage{longtable} \usepackage{lipsum} \begin{document} \chapter*{First chapter} \scriptsize ...


0

\multicolumn{3}{c}% {{ \raggedleft \tablename\ \thetable{} -- continued from previous page}} \\ a c column is a horizontal box like \mbox so paragraph settings like \raggedleft have no effect, you presumably want \multicolumn{3}{r}% {\tablename\ \thetable{} -- continued from previous page} \\ to get a flush right entry.


1

SAS software has a suite which it calls Output Delivery System (ODS) In versions up to 8, the output file (myprogram.lst) was always a text file. ODS supports named output to several popular vendor formats, notably *.pdf and *.rtf, etc., and LaTeX. This page describes the basics of creation of an output file that is *.tex. ...


1

Here's an example with the rotated labels via graphicx, some formatting cleanup from booktabs, and ensuring the longtable never breaks up a category: \documentclass{article} \usepackage{longtable} \usepackage{multirow} \usepackage{graphicx} \usepackage{booktabs} \begin{document} \begin{longtable}[c]{cccc} \toprule \textbf{Category} & \textbf{Name} ...


1

It is best to make examples complete documents that can be tested but just delete \begin{table}[ht] and change tabular to longtable then move the \caption inside longtable as a row: \caption{scene\label{table:econ:programmers}}\\


1

You can do global change by keeping the following three lines in the preamble: \usepackage[font=normalsize]{caption} %% make caption in normal size \usepackage{etoolbox} \AtBeginEnvironment{longtabu}{\footnotesize}{}{} %% change all longtabu content to foot note size as answered by Harish Kumar here in this question


3

\newcommand{\powerTable}[3]{ \pgfplotstabletypeset[ string type, col sep = comma, skip rows between index={0}{#2}, skip rows between index={#3}{1000000000}, begin table=\begin{longtable}, end table=\end{longtable}, % packo id,N,Packomania Radius,,id,circlecount,Radius,time (ns),overlap (square ...


2

This solution uses geometry to get more sensible page margins, booktabs for nicer rules, makecell to rotate some headers and ensure consistent formatting. As it is, I think the information could be presented much more usefully and concisely. Perhaps not all figures are 1 in your real data, but that is likely to affect the layout of the table, too, unless ...


2

Here is a solution with \tablex, which brings the functionalities of longtable to tabularx, and makecell to give some vertical padding to rows where necessary. As a result, the table has a simpler code. Also I took the liberty to slightly simplify the preamble. \documentclass[a4paper, 12pt]{article} \usepackage{fouriernc} \usepackage[utf8]{inputenc} ...


2

Just to say that I really do not recommend this kind of table. I'd encourage you to at least read and consider the advice in the booktabs manual. It maybe a little extreme, but tables like this make me understand only too well the package's case for radicalism ;). If you must: \documentclass[a4paper, 12pt]{article} ...


0

After a whole lot of messing around (including David's solution which I did not seem to get to work as expected) I found it easiest to leave the margins alone when you just need a bit more space to fit one bigger table on a single page. First I experimented with areaset since this is what classicthesis uses to control margin sizes. Enlarging this before ...



Top 50 recent answers are included