New answers tagged

0

Assuming you really need that the table are as wide as the text block, you can better use tabular* instead of tabularx and ltablex (they can be confused when several floats appear in the same page). In the code below I removed some wrong settings and reorganized the preamble. Note that: \fontfamily{phv}\selectfont is wrong and should be omitted. \def\...


1

Your MWE doesn't reproduce described problem tabularx table, which can be fit on one page and encapsulated into table float cannot protrude out of page Edit: above statements hold as long as you not load ltablex or xltabular packages. Both can cause that tables even in tabular float environment in some circumstances can protrude through text bottom. This ...


1

Placement of table is consequence of use ltablex package. It is combination tabularx and longtable package. Consequently it enable to break tables between packages. If you not like this, you need to encapsulate your table into float table environment (the best solution) or in minipage. Use of ltablex also reformat X column. If its contents are shorter than ...


0

In order to get the desired output you could either go without colortbl or, if you need this package for a different table in your document, try th following workaround: \documentclass[11 pt, a4paper, oneside, openany]{book} \usepackage[table, svgnames]{xcolor} \usepackage{tabularx} \usepackage{array} \usepackage{calc} \newlength{\mylength} \setlength{\...


0

It is not very clear, if you like to have equal width of columns or tables. Well, in bot cases use of tabularx table environment can be handy. FOr example for later case you can write them as: \documentclass{article} \usepackage{booktabs, makecell, tabularx} \setcellgapes{2pt} \newcolumntype{L}{>{\raggedright\arraybackslash\linespread{0.84}\selectfont}X} ...


5

How to organize table is quite opinion base. Some ones might liked the following (based on Sveinung and my comment above): \documentclass[12pt]{article} \usepackage{geometry} \usepackage{booktabs, makecell, multirow, tabularx} \usepackage[skip=1ex]{caption} \begin{document} \begin{table}[hb] \centering \small \caption{Results at $\mu_j=U(91,876)$ ...


5

NB! I Corrected the \label[tab]{results}, which is wrong syntax unless your thesis-package redefines the label-command. However, I really recommend you to have a look at cleveref. Use tabular X-column since you are using tabularx. In addition, I used a fixed width column as first column using array’s w-column (require an updated version of array). Also, use ...


1

As it currently is, your question is unfortunately somewhat unclear. What exactly is your problem? Is it how you can insert the image into a cell, is it the alignment, the column widths... However, here is a MWE that creates two tables somewhat similar to the ones in your question: \documentclass{article} \usepackage{tabularx} \usepackage{graphicx} \...


3

To answer your final question first. tabularx takes special care not to over-increment latex counters, but it can not by default handle other kinds of side effects that may get executed during the trials. (LaTeX maintains a global structure for resetting counter values mainly for the \includeonly system so counters can be reset after omitted sections, and ...


1

Probably you are more satisfied with one of the following examples. Please note that I have decluttered your premable. (Please also do that in your actual document. Do not load packages more than once.) I have also corrected the wrong options in your S type columns. \documentclass[12pt,oneside]{book} \usepackage{multirow} \usepackage{siunitx} \usepackage{...


2

Like this? Solution: first four column headers are in multirow cells: \documentclass[12pt,oneside]{book} \usepackage{ragged2e} \usepackage{booktabs, makecell, multirow, tabularx, threeparttable} \renewcommand\theadfont{\small\bfseries} % for bold in table using \small \renewcommand\theadgape{} \newcolumntype{A}{>{\raggedright\arraybackslash}X} % ...


0

Similar to the sugestions in David Carlisle's previous comments, here are two possible versions of your table. To place obs as a header to just the second column, I have removed the \multicolumn{2} command aound it and added a &. Additionally, I have used siunitx to align the numbers with respect to the decimal marker and deleted the empty line in the ...


4

Here's another tabularx-based solution. It uses the L column type for three of the four columns, while making it easy to specify unequal (relative) column widths. The only rule you need to keep in mind is that the sum of the relative column widths (here: 1.5+0.75+0.75=3) must be the same as the number of columns of type L. In the following solution, the ...


3

I would use tabularx table environment and left line braking to the L column tape defined as \newcolumntype{L}{>{\RaggedRight}X}. For vertical centering of cells' contents I suggest to redefining X column type: \renewcommand\tabularxcolumn[1]{m{#1}}: \documentclass[12pt, oneside]{book} \usepackage{caption} \usepackage{booktabs, makecell, tabularx, ...


2

Here it the completed way of my comment (sorry for the gap -fixed here-) \documentclass[12pt,oneside]{book} % Remove draft option to show figures (for final draft), otherwise keep for faster production \usepackage{tabularx,seqsplit, caption} %for table spacing to second row \usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical ...


0

The second column is center aligned: \documentclass{article} \usepackage{tabularx} \newcolumntype{R}{>{\raggedleft\arraybackslash}X} \newcolumntype{C}{>{\centering\arraybackslash}X} \newcommand{\zerovline}{\kern-0.5\arrayrulewidth\vline\kern-0.5\arrayrulewidth} \begin{document} \noindent \begin{tabularx}{\textwidth}{@{\zerovline}l@{\zerovline}C@{\...


2

The best I could come up with from various information I found was to introduce a new macro (\Xwdth) to pre-compute the size, taking into account additional width variables. Then I created a multicolumn wrapper \multiX for convenience. \documentclass{article} \usepackage{tabularx} \begin{document} \pagestyle{empty} \newcommand{\Xwdth}[1]{\dimexpr#1\hsize+#...


2

You can use \linewidth: \documentclass{article} \usepackage{tabularx} \begin{document} \def\text{This is a text example inside a cell} \newcommand{\cell}[2]{\parbox[t][#1][c]{\linewidth}{#2}} % \newcolumntype{C}{>{\centering\arraybackslash}X} \begin{tabularx}{\textwidth}{|X|C|} \hline \text & \cell{0.5\linewidth}{\text} \\ \hline \end{tabularx}...


4

Thinking outside of the box... Hat tip to Phelype for clueing me in to both \@wholewidth and \linethickness. \documentclass{article} \usepackage{stackengine} \newcount\cellwd \newcount\cellsep \cellwd=80 \cellsep=5 \makeatletter %\linethickness{.1pt} \newcommand\acell[1]{\noindent% \framebox(\cellwd,\cellwd){\parbox{\the\numexpr\cellwd-\cellsep\relax pt}% ...


0

You can use the enlarge right by={<somelength>} key \documentclass{article} \usepackage{tabularx} \usepackage[most]{tcolorbox} \begin{document} \tcbset{enhanced,colback=red!5!white,colframe=red!75!black,width=5cm} \begin{flushright} \begin{tcolorbox}[arc=0mm] This is a \textbf{tcolorbox}. \end{tcolorbox} \begin{tcolorbox}[arc=0mm,enlarge right by=...


1

Similar to the solution in @Zarko's answer, except that it (a) uses a sidewaystable environment rather than a table environment, as the table is quite wide and fits better in the page if it's typeset in landscape format (for portrait format, a small and hard-to-read font size such as \footnotesize is required), and (b) uses a non-zero value of the length ...


2

See if the following solution provide what you like to obtain: \documentclass{article} \usepackage[margin=20mm]{geometry} \usepackage{multirow} \newcommand\mcl[1]{\multicolumn{2}{|l|}{#1}} \begin{document} \begin{table} \footnotesize \sffamily \renewcommand\arraystretch{1.2} \centering \begin{tabular}{|*{4}{l|}} \hline \mcl{\textbf{...


1

Similar to \endhead and \endfirsthead there are \endfoot and `\endlastfoot. In order to achieve the desired result, you might want to use \noalign{\hrule height 0.8pt} \endhead \noalign{\hrule height 0.8pt} \endfoot


2

pgf keys are "only" some cleverly packaged macros. Therefore the order in which you use them matters, simply because the order in which you execute macros matters, too. So you may want to put the key that sets the line width "as late as possible". In your case, there are only two keys so you may want to put boxrule=5pt last. \documentclass{article} \...


Top 50 recent answers are included