Tag Info

Hot answers tagged

8

You can use either a tabular* or a tabularx environment to create a table with a prespecified width of, say 0.5\textwidth. As the screenshot below demonstrates, the looks of the tabular* and tabularx environments are quite different even though the overall widths are the same (by construction!). tabular* works by expanding the intercolumn whitespace, ...


8

The algorithm of setting \topskip is applied twice by package longtable. Its output routine takes the material from the current vertical list including \topskip in a box and reinserts it to the now empty vertical list triggering the \topskip setting again. Usually nothing is inserted in the latter case, because the height of the re-inserted box is usually ...


5

\documentclass{article} \usepackage{longtable,array,xcolor} \renewcommand*\arraystretch{10} \newcounter{counter} \newcolumntype\specifier{|% *2{ >{\centering\selectfont\stepcounter{counter}\thecounter}m{1cm} |>{\centering}m{\dimexpr.5\linewidth-1cm-4\tabcolsep-3\arrayrulewidth\relax} |} } \makeatletter \def\row[#1]#2{% & #1 \par ...


5

Some suggestions: Since the material in the table contains (mostly) math expressions, I'd use an array environment instead of a tabular environment. By having all cells automatically in math mode, unary minus symbols will be typeset correctly. Setting the parameter \arraycolsep, which governs the amount of intercolumn whitespace in array environments, to ...


5

You can do this table via \multirow and \multicolumn: For the case where the first column has longer text, I'd use a \parbox with \raggedright: \multirow{10}{*}{\parbox{2.0cm}{\raggedright Test1 with some more text}} which yields: Code: \documentclass{article} \usepackage{multirow} \begin{document} \begin{tabular}{| l | l | l | l | l |}\hline ...


4

You can do this with or without multirow. Use graphicx for the rotation via \rotatebox[<opts>]{<deg>}{<stuff>}: \documentclass{article} \usepackage{graphicx,multirow} \begin{document} \begin{tabular}{ |c|c|c| } \hline \multirow{8}{*}{\rotatebox[origin=c]{90}{Text}} & row 1 & row 1 \\ & row 2 & row 2 \\ & row ...


4

colortbl adds a padding \tabcolsep wide; instead of using @{\,} you should reduce \tabcolsep: \documentclass[12pt]{report} \usepackage{colortbl} \begin{document} \begin{table} \centering \setlength{\tabcolsep}{0.3em} \begin{tabular}{|c|c|c|c|} \hline Column1 & Column2 & Column3 & Column4 \\ \hline A & \cellcolor[gray]{0.5} & D & E ...


4

To change the amount of vertical whitespace that LaTeX inserts to the left and right of every column, change the length parameter \tabcolsep. Its default value is 6pt; change it via either \setlength or \addtolength. In the example below, the second table features a value of 1.5pt for \tabcolsep. \documentclass{article} \usepackage{graphicx} ...


4

I suggest you take the following steps: Use a table environment, with a \caption that's distinct from the tabular material itself. The caption can be placed either above or below the tabular material. In the example below I use \caption* -- a macro provided by the caption package -- to create an unnumbered table float. (If you want a "regular", i.e., ...


4

Here is a way of setting the table in landscape mode. I've also used booktabs to make things look a bit nicer, dispensing with the vertical rules. The only downside of combining booktabs and longtable is that you have to go through and comment out some rules in the middle of the table to avoid spurious double-rules. In this case, you also need to manage the ...


4

copied from the duplicate question: \documentclass[a4paper]{article} \usepackage{indentfirst} \usepackage{amsmath} \usepackage[english]{babel} \usepackage{graphicx} \usepackage{subfigure} \usepackage{multirow} \usepackage{longtable} \usepackage{tabularx} \begin{document} {\small \setlength\tabcolsep{1.4pt} ...


4

Using minipages and package capt-of \documentclass[11pt,a4paper,twoside]{book} \usepackage{capt-of} \usepackage{mathtools} \begin{document} \begin{minipage}{0.45\linewidth} \centering \begin{tabular}{c|c|cc|} & & $x_1$ & $x_2$ \\ \cline{1-4} $z$ & 0 & 3 & 1 \\ \cline{1-4} ...


4

You should use the makecell package for that. It's dedicated to common formatting of multiline cells and defines a \thead and a \makecell command a multirow version of these. The default alignment in such cells is centred (vertically and horizontally) with keywords to choose among t, b, c and l, r, c, independently of the column specifier. Here are two ...


3

You can't create cells with equal height automatically with tabular. This is a case where \valign comes handy. \documentclass{article} \usepackage{lipsum} \usepackage[a4paper,showframe]{geometry} \usepackage{xcolor} \usepackage{microtype} \newcommand{\keyabs}[2]{% \noindent \valign{% \hrule height 1pt \vskip .5ex ...


3

You could use a tabu with the tabu package: \usepackage{tabu}. And your tabular will be a tabu with the \tabcolsep and \extrarowsep adjusted. Also using the X[-1] creates columns with just the width needed for the content. For treating all but the first column as math mark them with a $ in the tabu-preamble and remove the $s from your table body: ...


3

Assuming you have one-inch wide horizontal margins, all you need to do to make the table fit into the width of the text block is to reduce the length parameter \tabcolsep to about 5pt (default is 6pt). I would suggest, actually, that you use the method described on page 5 of the user guide of the longtable package to make the table occupy automatically the ...


3

May be this would do: \documentclass{article} \usepackage{multirow} \begin{document} {\centering Steepener Sharpe Ratio Estimation Results \begin{tabular}{l|cc} %\hline %\multicolumn{3}{c}{Steepener Sharpe Ratio Estimation Results} \\ \cline{1-3} \multirow{2}{*}{Estimate} & \multicolumn{2}{c}{Percentile} \\ & 2.5 & 97.5 \\ \cline{2-3} TNA ...


3

tex tries to keep rows \baselineskip apart but if the depth of one row plus the height of the next is already close to or more than \baselinekip it gives up on that and instead just inserts a fixed \lineskip glue. a minipage or tabular with [t] has everything but the height of the top row in the depth so the following box is just separated by \lineskip glue. ...


3

You can construct the inner part of the table outside the tabular in the form of a macro, and then set it with the construction of the table by just calling the macro. Improper expansion of "sensitive elements" (& and \\) are protected via \protected@xdef - a global expansion definition. With each iteration of \multido, a new row is added to the ...


3

The dgruyter_author package redefines tabular so that it basically uses booktabs commands without user's intervention. As such, vertical rules shouldn't be used. For the split cells you can use a stack: \documentclass[USenglish,twocolumn]{article} \usepackage[utf8]{inputenc}%(only for the pdftex engine) \usepackage[big]{dgruyter_author} ...


2

As mentioned by @Christian Hupfer, you can do that with rotatebox. But maybe, depending on the real contents, aesthetically, you'll prefer the vertical text ‘rule-free’. Some adjusment is often necessary to ensure vertical centring: \documentclass{article} \usepackage{multirow} \usepackage{mathtools} \usepackage{array, caption} \usepackage{graphicx} ...


2

The issue is nothing to do with listings, the lines are bold as you have specified two adjacent rules. &1 &\multicolumn{1}{|r|}{25} & \multicolumn{1}{|r|}{35}\\ specifies a rule at the right edge of one column and the left edge of the next so you get two rules which look like one double thickness rule. All latex inter-column material is on ...


2

Is this what you looking for? \documentclass{article} \usepackage{graphicx} \newcommand*\rot{\rotatebox{90}} \begin{document} \begin{table}[!ht] \centering \begin{tabular}{|@{\hskip3pt}c@{\hskip3pt}| c |@{\hskip3pt}c@{\hskip3pt}|} \hline 1 & 2 & 3\\ \hline \rot{\textbf{1st column}} & ...


2

Borrow the idea from David but use \path instead (since it is a path) \documentclass{article} \usepackage{url} \begin{document} \begin{table} \begin{tabular}{l p{2cm}} datapath & \path{/home/username/path/to/directory/very/long} \end{tabular} \end{table} \end{document}


2

Maybe I don't understand your setup, but I don't think it's possible to have a table with a column that's 20cm wide and still have the entire table fit in the allocated width (which is equal to \columnwidth, i.e., less than half of \textwidth). I suggest you use the tabularx package, specify the total width of the tabularx environment to equal ...


1

You can construct this \upbracefill manually: \documentclass{article} \usepackage{colortbl} \begin{document} \begin{tabular}{ *{9}{l} } letters: & a & b & c & d & e & f & g & h \\ blah & \multicolumn{8}{c}{\raisebox{.5\normalbaselineskip}[0pt][0pt]{$\underbrace{\phantom{abcdefgh}\hspace*{14\tabcolsep}}$}} ...


1

You can test the vertical spacing by placing constructions side by side in a minipage, here you see that the tabular has the same spacing as a normal line of text and the following line in each of the minipages is at the same vertical position: \documentclass{article} \begin{document} \noindent \begin{minipage}{.5\textwidth} aa aa aa aa aa aa aa aa aa ...


1

One possible solution: wrap a tabular environment around the two particular tables and use the optional [t] alignment parameter of \begin{tabular}. By the way: The tables are too large, but I did not address this issue! \documentclass[10pt]{book} \begin{document}% \small \begin{tabular}{cc}% \begin{tabular}[t]{|c|c|c|c|c|} \hline $\textbf{Q\#}$&$ ...


1

You can get what you want with a wraptable environment. I used an array environment (with r specifier for a better alignment of numbers with a minus sign), deleted the vertical lines, and used the booktabs, so as to have variable thickness for horizontal rules, and less tight vertical spacing. Also, I used the nccmath package for its medium-sized fractions ...


1

The data should be split in three columns; for the general layout I show two ways. Note the format of the data subtables: \begin{tabular}{ >{$}r<{{}$} @{} S[table-format=1.2] @{\,} s } The first column is right aligned in math mode; the {} ensures good spacing after the = sign. The second column is S; adjust the table-format to the ...



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