Hot answers tagged

25

With the correct code, it works fine. No table environment – a long table cannot possibly be a float, and the caption just after begin{tabularx}. \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage{booktabs} \usepackage{ltablex} \begin{document} \label{tab:daypack} \begin{tabularx}{\linewidth}{@{}cX@{}} \...


19

If you must combine tabularx and longtable, I prefer ltxtable to ltablex: \documentclass[11pt]{article} \usepackage{booktabs} \usepackage{ltxtable} \begin{document} \LTXtable{\textwidth}{t1.tex} \end{document} where t1.tex is \begin{longtable}{@{}cX@{}} \toprule \textbf{Column 1} & \textbf{Column 2} \\[6pt] \midrule \endhead $R$ & 1This is ...


7

Normally tabularx is like tabular and is an inline table set as part of the current line of the paragraph, so has no external spacing. This package changes them all to be longtable essentially that is display environments set in vertical mode. So they are never part of the current line, and the space before is the controlled by, for example \setlength\...


6

You can use \\* to prevent a page break \multicolumn{2}{c}{\cellcolor[gray]{0.75}2013}\\* If lines are involved you need to change the commands for the lines too: Prevent page break after \midrule in \longtable How to disable pagebreak on \hline in longtable?


6

The X functionality in ltablex is implemented by tabularx and the multipage functionality in ltablex is implemented by longtable. ltablex just includes both packages and supplies a bit of glue so they work better together.


6

No idea why the test does not work (probably need @DavidCarlisle to explain it). Here is a working alternative using environ \documentclass{article} \usepackage{ltablex} \usepackage{blindtext,environ} \keepXColumns % \newenvironment{test} % {% % \begin{tabularx}{\textwidth}{lX} % } % {% % \end{tabularx} % } \NewEnviron{test}{ \begin{tabularx}...


5

You can hide some columns on one page and other on the other page: \documentclass{book} \usepackage{array} \newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}} \begin{document} \begin{table}\centering \caption{Table part 1} \newcolumntype{\somecolumns}{llllllHHHHH} \begin{tabular}{\somecolumns} & 1 & 2 & 3 & 4 & 5 & 6 &...


4

Use longtable of the package longtable \documentclass[11pt]{article} \usepackage{booktabs} \usepackage{tabularx} \usepackage{ltablex} \usepackage{longtable} \begin{document} \begin{longtable}{cc} \caption{Example of an table} \\ \textbf{Column 1} & \textbf{Column 2} \\[6pt] $R$ & 1This is an example sentence \\[6pt] $R$ & 2As well as the ...


4

The no line here to end message is an indication of misuse of \\ which should almost never be used outside of an alignment. Remove this one: \end{tabularx}% \\


4

ltablex changes too much really, if you must merge longtable and tabularx I'd probably use ltxtable, but 99% of the time that i see tables set with {lX} they would be better set as a list, which naturally expands to full width and naturally breaks over a page, without any of the contortions that tabularx and longtable do. However ltablex has a \keepXColumns ...


4

The ltablex package messes about with the table column specifications. You can switch this off by using the command \keepXColumns. Put this after \usepackage{ltablex} in the preamble.


4

ltablex redefines tabularx in lots of ways one is that, by default it turns X columns into l columns for small tables. It probably shouldn't do that but it does, it has a command to turn that off. texdoc ltablex page 1: \keepXColumns That said, while automatically changing X is probably unfortunate I would not use tabularx for a table that does not have ...


3

I get no error if I replace \end{tabularx} (which is probably wrong in the first place) with \endtabularx\endgroup. No guarantee this won't break anything else. \documentclass[a4paper]{scrartcl} \usepackage[margin=1in]{geometry} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{ltablex} % includes tabularx, but combined with longtables (...


3

Since you speak of tabularx: in tabular environments, there's space before and after a column. You can remove it by inserting @{} in the corresponding place of the column definitions, such as: \documentclass{article} \usepackage{tabularx} \begin{document} \begin{tabularx}{4cm}{@{}Xr@{}} \hline Number & 42\\ \hline \end{tabularx} \end{document} Similar, ...


3

In your example, there seems to be little point -- typographically speaking -- of having both "heavy" rules (generated by \toprule and \bottomrule) and "light" rules (generated by \midrule). I therefore suggest you use only one rule width, say, \heavyrulewidth, for all rules. Here's how you might implement such a setup: \documentclass{scrartcl} \usepackage{...


3

Solution A) I am not sure if I am following the question, but you don't need \bottomrule at all, it is a simple rule where you can only set a width of it. In my example I am removing it and I am adding one extra rule at the very end of the table. %! *latex mal-ltablex-a.tex \documentclass{scrartcl} \usepackage{booktabs} \usepackage{ltablex} \usepackage{...


3

The linebreak you can fix with \newcolumntype{Y}{>{\centering\let\newline\\\arraybackslash\nobreak\hspace{0pt}}X} \newcolumntype{Z}{>{\raggedleft\let\newline\\\arraybackslash\nobreak\hspace{0pt}}X} \tabcolsep should be set with \setlength not \renewcommand (but it still behaves oddly here, out of time now...)


2

That is essentially a description of tabulary as opposed to tabularx so you can look in the source of that package for how to do it, but in particular there is a merge of tabulary and longtable here: Multi-page with Tabulary?


2

The threeparttablex seems to work for me: in the following, I inserted the table notes inside the long table, and also at the end. No problem for the caption either. You have to write the table notes just after \begin{ThreePartTable} and to compile twice. \documentclass{article} \usepackage{ltablex} \usepackage{threeparttablex} ...


2

This addresses the issue by moving up vertically a faux \bottomrule (the \raisebox contents) to overlay any residual \midrule, thus avoiding the appearance of a double rule. There is, however, a side effect: an extra line of vertical space is taken by this manipulation, and so one has one less row to work with per page. To see this, comment out my \...


2

It is to do with the way tabularx deals with its argument. The package environ provides a work around for such situations. Instead of \newenvironment you say \NewEnviron{myenv}{start code \BODY end code} Then \begin{myenv} mybody \end{myenv} will run the contents of myenv with \BODY replaced by mybody. In your case the relevant definition is ...


2

The third page of the table (to show referencing): \documentclass[fontsize=12pt,paper=letter,headings=small,bibliography=totoc,DIV=9,headsepline=true,titlepage=on]{scrartcl} \usepackage[spanish,mexico]{babel} \usepackage{fontspec} \defaultfontfeatures{Ligatures=TeX,Mapping=tex-text} \usepackage{xunicode} \setmainfont[ ItalicFont = SourceSerifPro, ...


2

You can make the utf8 handling more robust: \documentclass[ngerman]{scrbook} \usepackage{savesym} \usepackage[LGR,T1]{fontenc} \usepackage[utf8]{inputenc} \input{ix-utf8enc.dfu} \usepackage[math=normal,main=ngerman,greek,]{babel} \usepackage{teubner} \savesymbol{breve} \savesymbol{aa} \usepackage[osf,sc]{mathpazo} \restoresymbol{pplj}{breve} \restoresymbol{...


2

The main problem is bad interaction with tabularx: stating \selectlanguage{polutonikogreek} in the prefix to an X column causes errors that are amplified by teubner; but without it the problem is still present causing \textpi to be considered undefined. A temporary workaround might be delaying the language setting when the paragraph is started: \...


2

It doesn't work to use tabularx with no X columns, but I wouldn't use tabularx here. This is still a bit wide but not knowing the language I can't really abbreviate any more. \documentclass[fontsize=12pt,paper=letter,headings=small,bibliography=totoc,DIV=12,headsepline=true,titlepage=on]{scrartcl} \usepackage{soul} \usepackage[spanish,mexico]...


2

The caption must be incorporated in the table – just as with longtable, inside the foot specifications, if you want the caption at the bottoms of the table, or in the head soecifications to have it above the table (which is recommended). Also, if you load ltablex, you don't have to load tabularx nor longtable since they're loaded by ltablex. \...


Only top voted, non community-wiki answers of a minimum length are eligible