New answers tagged

1

Here is a way to do it, if I've well understood what you want: \documentclass[a4paper, twocolumn]{article} \usepackage{array, tabularx, float} \usepackage{amsmath} \begin{document} \begin{table}[H] \begin{tabularx}{\columnwidth}{r@{${} = {}$}X} $\phi$ & capacity reduction factor of bolted connections subject to tearout\\ & $ \begin{...


1

I would do it this way, with tabularx. This is a case where vertical rules are preferred, in my opinion. I changed the alignment of the first column to r, and used the showframe option of geometry to check it each row fits within the margins: \documentclass[a4paper, x11names]{article} \usepackage[showframe]{geometry} \usepackage{array, tabularx} \usepackage[...


0

change the line into \begin{tabular}{@{\extracolsep{\fill}} |l|p{11cm}|} and compile. The width of second column can be increased or decreased depending upon the right margin you require.


0

Please check the below code: \documentclass[a4paper,12pt]{article} \usepackage[dutch]{babel} \usepackage{array} % zorgt dat er een tabel gemaakt kan worden zoals auteur \usepackage{booktabs} %multicolumn met array \usepackage{spreadtab} \usepackage{multirow} \begin{document} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}} \newcolumntype{C}[1]{&...


0

Why do you use a tabular instead of a subfloat ? \documentclass{article} \usepackage{mwe} \usepackage{subfig} \begin{document} \begin{figure} \begin{minipage}{.5\linewidth} \centering \subfloat[Sub figure 1]{\label{fig_a}\includegraphics[width=\linewidth]{example-image-a}} \end{minipage}% \begin{minipage}{.5\linewidth} \centering \subfloat[Sub figure 2]{\...


4

For colours you have to use \arrayrulecolor{…} at the beginning of a row. For the thickness of \midrules, you can change the value of\lightrulewidth` or change the thickness of a specific rule with the optional argument. Demo: \documentclass{article} \usepackage{booktabs} \usepackage[x11names, table]{xcolor} \setlength\lightrulewidth{0.3pt} \begin{document}...


4

You can use \arrayrulecolor{<colour>} from colortbl to change the colour, and \specialrule{<width>}{<above>}{<below>} to set a rule of specific dimensions: \documentclass{article} \usepackage[table]{xcolor} \usepackage{booktabs} \begin{document} \begin{tabular}{ c c c } \toprule A & B \\ \midrule Q & M ...


1

The solution that worked best for me was to put it into a minipage : \begin{minipage}{.4\textwidth} \begin{table}[H] \begin{flushleft} \resizebox{\columnwidth}{!}{ \begin{tabular}{ |c|c|c|c| } \hline \textbf{inf.} & \textbf{part. pass. it.} & \textbf{part. pass. lat.} & \textbf{derivé} \\ ...


0

Using \hspace*{\fill} inside the subcaption, as in \caption{This table. \hspace*{\fill}} worked for me. Here's the working example based off of the other posts (see the inline comments for use of \hspace): \documentclass[letterpaper,12pt]{article} \usepackage{caption, subcaption} \usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry} \begin{...


1

Like this? I used the makecell package, which allows for line breaks in cells, and a common formatting of specific cells, with the commands \makecell and \thead: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{array, multirow, makecell} \renewcommand\theadfont{\normalsize\bfseries} \renewcommand\...


0

For simple frames, you can use the framed environment: \documentclass[]{article} \usepackage[flushleft]{threeparttable} \usepackage{tabularx, booktabs} \usepackage{framed} \begin{document} \begin{threeparttable} \centering \begin{tabularx}{\textwidth}{*{3}{ >{\centering\arraybackslash}X}} \toprule Col1 & Col2 & Col3\tnote{1} \\ \addlinespace 1 ...


2

read the documentation of the multicol package. here is the relevant item from the "warnings" section: Floats and marginpars not allowed inside multicols environment! This message appears if you try to use the \marginpar command or an unstarred version of the figure or table environment. Such floats will disappear! edit: as pointed out by ...


2

tcolorbox is your new friend. About the various ways to customise it, see its documentation. \documentclass[]{article} \usepackage[flushleft]{threeparttable} \usepackage{tabularx} \usepackage{tcolorbox} \begin{document} \begin{threeparttable} \centering \begin{tabularx}{\textwidth}{@{\extracolsep{0pt}} llc} \hline Col1 & Col2 & Col3\tnote{1} \\ ...


4

The package collcell is your friend for this: \documentclass{article} \usepackage[version=4]{mhchem} \usepackage{array,booktabs,collcell} \begin{document} \begin{tabular}{>{\bfseries}l >{\collectcell\ce}l<{\endcollectcell}}\toprule R1 & -C6H5 \\ R2 & -C6H4F \\\bottomrule \end{tabular} \end{document} Note ...


4

Beware that for resized X cells, the coefficients are like barycentric coordinates and their sum has to be equal to the columns number. Also, I managed horizontal rules meet vertical rules, and set all rules (vertical as well as horizontal rules but one) to have the width of \midrules, and I simplified your code. \documentclass[12pt]{article} \usepackage{...


2

Try \documentclass[12pt]{article} \usepackage{booktabs,tabularx} \renewcommand\tabularxcolumn[1]{m{#1}} \newcolumntype{Z}[0]{>{\centering\arraybackslash}X}% \newcolumntype{s}[0]{>{\hsize=.4\hsize}Z}% \newcolumntype{n}[0]{>{\hsize=.8\hsize}Z}% \begin{document} \begin{table} \begin{tabularx}{7cm}{s|Z|s|n} & really really really long ...


2

There's a lot of documentation about tables. This is a really good starting point. \documentclass[11pt,a4paper]{article} \begin{document} \begin{tabular}{c c c c c c} cell & cell & cell & cell & cell & cell \\ cell & cell & cell & cell & cell & cell \\ cell & cell & cell & cell & cell & cell \\...


1

At first sight, you could have to possibilities to achieve what you want: You know the total width of your table and the number of columns: you can easily guess the width of each column, and thus create column with adequate fixed width; Or you give the total width of your table, and you let tabularx compute the width of each column ('cuz you know, all the ...


7

You have to add a # in every of your \newcolumntype definitions: \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} \newcolumntype defines a macro with one argument, this argument(the column width) can be accessed by #1.


8

You have \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{1}} You meant \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} as it is it always uses 1 as the width and complains about no unit.


1

First, your table is too wide to fit in the space desired. However I was able to split it across two columns. The idea was to create the longtable in a separate file then copy the pages one at a time. The first step is to determine the available space, and the minimum space needed for the tabular. In this case it was relatively easy to calculate. ...


0

Bernard, thank you very much! Here is what I did in the end: \begin{center} \sisetup{table-format=2.2, output-decimal-marker={,}} \setcellgapes{2pt}\makegapedcells \begin{tabular}{rcrrlclSl} \multicolumn{1}{c}{$i$} & classes & \multicolumn{1}{c}{$x_i$} & \multicolumn{1}{c}{$f_i$} & \multicolumn{1}{c}{${\scriptstyle f_{r_i} = \frac{f_i}{n+1}}...


1

Some time ago I did it with a matrix. \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{positioning, matrix} \begin{document} \begin{tikzpicture}[font=\sffamily\small, llista/.style={matrix of nodes, row sep =-\pgflinewidth, column sep=-\pgflinewidth, outer sep=0pt, nodes={draw=none} ...


2

Here is an alternative approach, using enumerate This is mainly because your table only consisted of two columns, where the first was just an increasing number, with two exceptions, the number 5 and 10. This reduces the amount of manual writing a lot and gives more flexibility, as you don't need to write all numbers manually, you simply change those that ...


2

This is a good case for a tabularx, I guess: % arara: pdflatex \documentclass{article} \usepackage[english]{babel} \usepackage[T1]{fontenc} \usepackage{float} \usepackage{tabularx} \usepackage{caption} \usepackage{microtype} \usepackage{showframe} % just for demo, get rid of it. \begin{document} 11 Crude petroleum and natural gas; services incidental to ...


0

The way to centre cell contents in a Scolumn is to enclose it in brackets. I took the liberty to code an improved version of your table, using booktabs for the horizontal line, in order to have some vertical padding around it. Also, I defined the first column to have S type, to ensure the vertical centring of decimal dots (it would be lost if all elements ...


1

You could typeset the whole table with S column specifier provided by siunitx and specify the format for the numbers in the optional argument with table-format. \documentclass{article} \usepackage{siunitx,booktabs} \begin{document} \begin{center} \sisetup{table-number-alignment = center , output-decimal-marker = {,}} \begin{tabular}{% @{}S[...


1

Using dcolumn also you can adjust the alignment. Now you are using siunitx package. See below code: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{.}{.}{#1}} \begin{document} \begin{center} \begin{tabular}{cccd{3.0}} \multicolumn{1}{c}{$C$} & \multicolumn{1}{c}{$M_i$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}...


0

Just replace the S in your tabular definition with r to align the contents of this column to the right. \documentclass{article} \begin{document} \begin{center} \begin{tabular}{cccr} \multicolumn{1}{c}{$C$} & \multicolumn{1}{c}{$M_i$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}{$G'_i$} \\ \hline 28,2 & 2 & 21 & 80 ...


1

I know this question was asked and answered, however such a question is still relevant today and due to updates in the ctable package I thought I should add my contribution to this question for future visitors. From ctablev1.26 onwards there's an option footerwidth=.. where a width can be specified for the footer seperate to mincapwidth. I should add that ...


4

You can use the \belowbaseline[shift]{…} defined in stackengine: \documentclass[10pt]{amsart} \usepackage{adjustbox} \usepackage{mathtools} \usepackage{array} \usepackage{makecell} \usepackage{siunitx} \usepackage{stackengine} \setstackEOL{\cr} %EOL is abbreviation for "end of line." \begin{document} \noindent \begin{minipage}[t]{3.5in} \textbf{16.) }\...


3

The input can be simplified with some more tabular environments. The trick is to use \begin{minipage}[t] and \begin{tabular}[t]. \documentclass[10pt]{amsart} \usepackage{mathtools} \usepackage{array} \usepackage{makecell} \newcommand{\tabhead}[1]{% \makebox[0pt]{\bfseries\boldmath #1}% } \begin{document} \noindent \begin{minipage}[t]{3.5in} \...


4

Something like this: For above code I use two mini pages aligned at top and omit stackengine package and its macro. Also I add siunitx package for nicer settings of numbers in table. Complete MWE is: \documentclass[10pt]{amsart} \usepackage{array,makecell} \usepackage{siunitx} \begin{document} \noindent\begin{minipage}[t]{3.5in} \textbf{16.)} \...


6

You don't need all these $ … $ in your table. It can look nicer with booktabs and if you use line breaks in column heads, which can be done with the \thead command from makecell. So I suggest this layout: \documentclass{report} \usepackage[paperwidth=5.5in,paperheight=7in,noheadfoot,margin=0in]{geometry} \usepackage{siunitx} \usepackage{longtable, makecell,...


5

This is of course much the same solution as samcarter already provided, but I have a few other suggestions for improvements. We both use longtable to get tables spanning many pages. And we both use siunitx. siunitxprovides some really nice options for formating your numbers in a consistent way. Some other suggestions You don't usually need to write \...


6

If you want a page break in your table, use the longtable environment. For the example below I added the \usepackage{siunitx} package, which provides the handy column type S which helps to align such long list of numbers. You also might want to have a look at the booktabs package, which offers nicer lines and spacing for tables. \documentclass{report} \...


-1

You can get this effect by alternating row and column color like following: \newcolumntype{g}{>{\columncolor{Gray}}c} \begin{table}[ht] \centering \begin{tabular}{c|g|g|g|g|g|g|g} \hline \rowcolor{white} &col1 &col2 &col3 &col4 & col5 &col6 &col7\\ \hline \rowcolor{white} row1& \ra & \ra & \ra & \ra & \ra &...


1

You can actually improve the quality by using siunitx. Here's only some relevant lines, the others will follow the same schemes. \documentclass{article} \usepackage{garamondx} \usepackage{booktabs,threeparttable,siunitx,caption} \begin{document} \begin{table}[htp] \centering \captionsetup{justification=raggedright} \begin{threeparttable} \caption{...


2

Perhaps something like this? \documentclass{article} \usepackage{multirow, rotating, graphicx} \usepackage{siunitx, makecell, bigstrut} \begin{document} \begin{center} \sisetup{table-format=2.2, output-decimal-marker={,}} \setcellgapes{2pt}\makegapedcells \begin{tabular}{r|c|r|r|l|c|l|S|l} \multicolumn{1}{c|}{$i$} & class & \multicolumn{1}{c|}{$...


2

Could any of you tell me ... why is it that I’m not seeing vertical column dividers in the first row except before "classes"? It's because of the \multicolumn{1}{c}{...} "wrappers"; if you want a vertical divider at the end of the column, write \multicolumn{1}{c|}{...}. For what it's worth, I would get rid of all vertical dividers. They aren't needed, and ...


1

You can use dcolumn package: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{,}{,}{#1}} \begin{document} \begin{tabular}{r|c|r|r|l|l|l|d{2,2}|l} \multicolumn{1}{c}{$i$} & classes & \multicolumn{1}{c}{$x_i$} & \multicolumn{1}{c}{$f_i$} & \multicolumn{1}{c}{$f_{ri}$} & \multicolumn{1}{c}{$\sum f_{ri}$} & \...


1

You cannot group multiple columns within the tabular column specification. Moreover, it's not needed. So, instead of \begin{tabular}{ {rr} } <tabular body> \end{tabular} just use \begin{tabular}{ r r } <tabular body> \end{tabular}


2

Using a table environment is easier, actually -- if the screenshot is made with high quality, nobody will notice that the 'table' is a figure actually, especially in printing! If somebody insists on a figure environment, one has to change the \@captype from figure to table inside of the figure environment with \def or \renewcommand. This way, the change is ...


3

Here is a partial table to get your started: \documentclass{article} \begin{document} \begin{table}[ht] \caption{Effects of Moderators on the Relationship Between Exposure to Scary TV and Internalizing Responses} \centering \renewcommand\arraystretch{1.5} \begin{tabular}{l c c c c c c} \hline & & & \multicolumn{2}{c}{95\% CI} & &...


2

You should provide an MWE in the future for the quickest help. The (at least) two ways of doing what you want, sort of: \documentclass{article} \begin{document} % what you are asking to do (rename "Figure" in caption to "Table"): \renewcommand{\figurename}{Table} \begin{figure} \caption{This is my table} <picture of table> \end{figure} % The ...


0

A simpler code with alignat: \documentclass{article} \usepackage{amsmath,siunitx} \begin{document} \begin{alignat*}{2} t_p &\le \SI{-2}{\celsius}, &\quad& \text{frost is expected} \\ \SI{-2}{\celsius}\le t_p &\le \SI{2}{\celsius}, & & \text{frost is possible} \\ t_p &> \SI{2}{\celsius}, & & \text{...


1

A variant with environment tabbing: \documentclass{article} \usepackage{siunitx} \begin{document} \begin{tabbing} $\SI{-2}{\celsius}<{}$\=$t_p\le\SI{-2}{\celsius}$,\quad\= \kill \>$t_p\le\SI{-2}{\celsius}$,\>frost is expected\\ $\SI{-2}{\celsius}<{}$\>$t_p\le\SI{2}{\celsius}$, \>frost is possible\\ \>$t_p>\SI{2}{\...


2

You can use alignat, with some trick. I also recommend siunitx. \documentclass{article} \usepackage{amsmath,siunitx} \begin{document} \begin{alignat*}{4} & && t_p &&\le \SI{-2}{\celsius}, &\quad& \text{frost is expected} \\ \SI{-2}{\celsius} &\le{} && t_p &&\le \SI{2}{\celsius}, &\...


1

You need to add one more column ... for example -- using array instead of tabular, you can obtain: Code: \documentclass{article} \usepackage{siunitx} \setlength{\arraycolsep}{1.5pt} \begin{document} \[ \begin{array}{rll} t_p & \le - \SI{2}{\celsius} & \text{frost is expected} \\ - \SI{2}{\celsius}\le t_p & \le \SI{2}{\celsius} ...


4

Here is a solution with pst-node and arydshln. Is consists in using an ordinary tabularx environment and defining the relevant cells as nodes of various types and linking them with node connections. It compiles with xelatex only. \documentclass{article} \usepackage{array, tabularx, arydshln} \usepackage{geometry} \usepackage{pst-node, multido} \usepackage{...



Top 50 recent answers are included