New answers tagged

4

IMHO opinion the vertical rules should be avoided and colored rows have no sense if there are horizontal rules or any other delimiter, as a simple but nice vertical empty space. I suggest this, without rules and without colors for this table. For this table, bulleted items are quite inconvenient, because the waste of horizontal space, forcing narrower ...


6

This is a slight variation of leandriis' nice answer in which the cells get filled programmatically. This is done with a style colorize cells/.style={/utils/exec={% \pgfmathsetmacro{\mycolor}{ifthenelse(\the\pgfmatrixcurrentrow>\the\pgfmatrixcurrentcolumn, "gray!20",ifthenelse(\the\pgfmatrixcurrentrow==\the\pgfmatrixcurrentcolumn, "gray!50","...


7

Here is a tikz solution (that is most likely still in need of some improvement): \documentclass{article} \usepackage{tikz} \usetikzlibrary{fit,matrix} \usepackage{amsmath} \usepackage{multirow} \usepackage{tabulary} \colorlet{mylightgray}{gray!20} \colorlet{mygray}{gray!50} \begin{document} \begin{tikzpicture}[cell/.style={rectangle,draw=black}, nodes in ...


8

\documentclass{article} \usepackage[T1]{fontenc} \usepackage{amsmath} \usepackage[table]{xcolor} \definecolor{ColHead}{gray}{0.6} \definecolor{ColDiag}{gray}{0.7} \definecolor{ColBelow}{gray}{0.9} \newcommand{\NA}{\cellcolor{ColDiag}} \newcommand{\B}{\cellcolor{ColBelow}} \usepackage{ragged2e} \usepackage{multirow, tabularx} \newcolumntype{C}{>{\...


1

Such diagram/tabulars/coloured grids are unbelievable easy to build with cals: \documentclass[a4paper, 12pt]{report} \usepackage[margin=1.5cm ]{geometry} \usepackage{mathpazo, cals} \usepackage[table, x11names]{xcolor} \colorlet{slightgray}{LightSteelBlue3!25} \let\nc=\nullcell % Shortcuts \let\sc=\...


1

I improved upon the great answer by Sveinung, these are more personal preferences. The result looks like this Whenever I have to type something twice or thrice I consider that a smell, and a good indication that part of my code (in this case LaTeX) should be extracted and simplified. Keep it DRY (Don't repeat yourself) When it comes to dealing with ...


10

I suggest you use a tabularx environment, with width set to \textwidth, ragged-right rather than full justification in all five columns, and a bespoke itemize-like environment (called mylist in the code below) that uses all available space. I also wouldn't use vertical lines to separate the columns -- they're not needed, and I wouldn't use \hline directives ...


17

I would rather have table with following design: Edit: In comparison with your table code I made the following changes: With use of geometry package and its default settings for pages' borders the width of text width is increased. With this a more space for table columns are available. Consequently, the text can be in a more beautiful form than in cells ...


6

For example: \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[svgnames,table]{xcolor} \usepackage{tabularx} \usepackage{ragged2e} \usepackage{enumitem} \setlist{nosep,noitemsep,topsep=0pt,leftmargin=1em} \usepackage{biblatex} \addbibresource{biblatex-examples.bib} \renewcommand\tabularxcolumn[1]{>{\RaggedRight}p{#1}} \begin{...


1

I would spread the columns and their width differently: \documentclass{article} \usepackage[margin=3cm]{geometry} \usepackage{booktabs,tabularx} \begin{document} \begin{table}\centering \scriptsize \setlength\cmidrulekern{0.25em} \begin{tabularx}{\linewidth}{@{} l >{\raggedleft\hsize=1.2\hsize}X@{,}>{\raggedright\hsize=1.2\hsize}X ...


0

With a smaller font size, a reduced \tabcolsep and the proper use of X type columns from the tabularx package you can easily fit the table into the margins. To make the table narrower, I have also introduced symbols for the "Status" column. If your table will contain more entries it might not fit onto the page. In this case, you might want to use the ...


2

With the valign option from the adjustbox package: \documentclass[paper=a5]{scrreprt} \usepackage{graphicx} \usepackage{tabularx} \usepackage[export]{adjustbox} \begin{document} \begin{tabularx}{\linewidth}{l X} Laptop & \rule{2cm}{3cm} \\ Laptop & \includegraphics[width=2cm,valign=t]{example-image} \\ \end{tabularx} \end{document}


4

Some of your X-columns are too narrow. I converted them to c and then removed multicolumn two places as unnecessary. In addition, I added an additional empty column as a new fourth column to balance white space. Annother possibility is to remove the two empty columns and replace them with a fixed width space using !{\hspace{<wd>}}: \documentclass{...


3

You can achieve the desired result by using the table environment and the \caption command as shown in the following example: \documentclass[final,3p,times,12pt]{elsarticle} \usepackage{caption} \usepackage{booktabs} \begin{document} \begin{table} \small \setlength{\tabcolsep}{4pt} \captionsetup{font=large} \caption{Table Title} {\footnotesize This ...


2

Assuming that your question is not just about the partial horizontal lines but also about adding the two additional column header rows, I'd suggest the following: In the example, I have used booktabs for lines with a bit more vertical white space around them. Since the table will be too tall for a landscape page if we use these lines and add two more rows, ...


2

booktabs package for partial rules: \documentclass[final,3p,times,12pt]{elsarticle} \usepackage{lscape} \usepackage{booktabs} \begin{document} \begin{landscape} \begin{tabular}{lcccccc} \toprule & \multicolumn{6}{c}{"Dependent Variable: Log(Average Fare)"} \\ \cmidrule{2-7} & \multicolumn{3}{c}{City} & \multicolumn{3}{c}{State}\\ \cmidrule(r)...


1

With geometry for smaller margins, a slightly smaller \tabcolsep and the help of an abbreviation you can get the following: \documentclass{article} \usepackage[usenames,dvipsnames]{xcolor} %\usepackage[table,svgnames]{xcolor} \usepackage[many]{tcolorbox} \tcbuselibrary{skins} \usepackage{tabularx} \usepackage{array} \usepackage{colortbl} \usepackage{...


3

This is just an idea: if you rotate the table, it easily fits in one text line. \documentclass{article} \usepackage[usenames,dvipsnames]{xcolor} \usepackage[most]{tcolorbox} \usepackage{tabularx} \usepackage{array} \usepackage{colortbl} \usepackage{array,multirow,tabularx} \newtcolorbox[blend into=tables]{mytable}[2][]{% enhanced, fonttitle=\...


1

No need to use tabularx: \documentclass{article} \usepackage{graphicx} \begin{document} \noindent\begin{minipage}{\textwidth} \fontfamily{phv}\selectfont % Helvetica \begin{tabular}{@{}c@{}} \includegraphics[width=1.02in]{uaqlogo} \end{tabular}\qquad \begin{tabular}{@{}l@{}} \LARGE Universidad Autónoma de Querétaro \\[0.15in] \Large Facultad de Ingeniería ...


2

Here it is, with adjustbox and a local definition of the X columntype. Note that beforehand, I converted the logo to .pdf with the epspdf utility: \documentclass{article} \usepackage{multirow, tabularx} \usepackage{graphicx} \usepackage[export]{adjustbox} \begin{document} \cleardoublepage \thispagestyle{empty} \bgroup \renewcommand{\tabularxcolumn}[1]{m{#...


4

I suggest you change the setup of the tabularx structure so that all five columns are of (modified) type X; then make the first column about three times as wide as each the four data columns. See the code below for how this may be achieved. Since you're loading the booktabs package, I suggest you actually make use of it: Get rid of all vertical rules and ...


3

You could put "For yield displacement of" in a common header for the last four columns. This way you can drastically decrease the width of thous columns: \documentclass[a4paper, 12pt]{report} \usepackage{array} \usepackage{tabularx,booktabs} \newcolumntype{Y}{>{\centering\arraybackslash}X} \usepackage{caption} \begin{document} \noindent \begin{...


3

The same question has been submitted in GitHub, see Simplest MWE to have an alternating row color #18. The proposed solution for the version v2.9 2019/01/11 of tabu comments some commands, see Figure. For further details, please check the solution provided in GitHub. I try this fix in tabu.sty (v2.9) and does what you are looking for. Maybe it will be ...


4

like this? Why not use tabu package is explained in comments below your question ... Solution can be use tabularx instead of tabu and boldline for horizontal lines with adjusted thickness (instead booktabs rules, which have (white) space above/below rule): \documentclass[12pt]{article} \usepackage{boldline}% for rules, part of Shipunov bundle \usepackage{...


1

Like this? It is not automatic. As you manually interrupt numbering of rows, you can do the same for \dotfill: \documentclass{memoir} \newcounter{rownum} \newcommand{\getEqNo}{\refstepcounter{rownum} \therownum.\,} \newcommand\mcl[1]{\multicolumn{1}{l}{#1}} \begin{document} \begin{tabularx}{.9\textwidth}{>{\getEqNo}r @{} X<{\...


0

You're mentioning three tabulars, but show just two, so I repeated the second table in each case. You can get alignment of top and bottom tables, with also alignment at the decimal period, using siunitx. \documentclass{article} \usepackage{booktabs,siunitx,caption} \begin{document} \begin{table}[!htbp] \scriptsize \centering \caption{U.S. Petroleum ...


2

Title suggests you are wanting largest possible 2rows of 3 sets x 2 tabular x 3 column like this I have included Sebasiano 's suggestion to alter 2nd Title \documentclass[a4paper]{article} \usepackage{geometry}%[landscape] would be much easier \geometry{margin=0.5in} %1.3cm needed to fit 3 times x 2tabular x 3column @small % if you change \small to \tiny ...


2

\documentclass{article} \begin{document} \begin{table}[!p] \tiny \begin{minipage}[b]{0.3\linewidth} \centering \caption{U.S. Petroleum Stocks} \label{foo} \begin{tabular}{@{\extracolsep{5pt}} ccc}\hline\hline lag & ADF & p.value \\ \hline $0$ & $$-$0.990$ & $0.702$ \\ $1$ & $$-$1.448$ & $0.541$ \\ $2$ & $$-$1.888$ & $0....


4

Example 1 I leave it to you to fill in the correct data where I put the Xs. You should also consider to use less arraystrech, remove vertical lines and use booktabs, see my second example: \documentclass{article} \usepackage{caption} \usepackage{adjustbox} \usepackage{setspace} \usepackage[margin=1in]{geometry} \usepackage{multirow,tabularx} \renewcommand{...


2

You have two possibilities to fix the issue you encountered: manipulate the table counter put both panels in the same tabularx environment and manually add some vertical white space Here is an MWE for the first possibility. I have commented out the table environment and added \addtocounter{table}{-1} after the caption command. \documentclass[12pt]{...


1

\newcommand*\rot[1]{\rotatebox[origin=r]{90}{ #1 }}


0

Rotated word "medium" is longer than height of the row, where it is. To improve its placement you need to increase row's height (for example with adding rule[-3ex]{0pt}{0pt}) beside use correct syntax for rot as suggested in comment of @Kurniawan Prihadi. \documentclass[a4paper, 11pt]{article} \usepackage[hmargin=30mm, vmargin=22.5mm]{geometry} \usepackage{...


Top 50 recent answers are included