Tag Info

New answers tagged

1

Using the collcell package you check each entry and step a counter to keep track of the total and at the end output the value of the counter. Notes: With some additional logic one should be able expand it so that there is only one column type, but to keep this simple I defined three separate column types. Code: \documentclass{article} ...


0

Try this: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{tabular}{p{.49\textwidth}p{.49\textwidth}}%%change the number as required a) First point & b) Second point \\ c) Third point & d) Fourth point \\ \end{tabular} \end{document} Improved version: \documentclass{article} \usepackage{amsmath} ...


1

Here is a version using booktabs and makecell. The results are different with IEEEtran.cls, however. (See below: this is why a Minimum Working Example is so important.) \centering is a better option than the center environment within floats (e.g. table, figure etc.) as it avoid adding excessive vertical spacing. \documentclass{article} ...


4

The simplest way to do that is to use the makecell package, which is done for formatting column heads. Here are two ways, with and without vertical rules: \documentclass{article} \usepackage{array, booktabs, caption} \usepackage{makecell} \renewcommand\theadfont{\bfseries} \begin{document} \begin{table}[!htbp] \centering \caption{table description} ...


3

Use \centering inside the \begin{table}...\end{table pair, this is safe, since it's inside a group and won't bleed into the following text... Use \multicolumn{1}{|c|}{\textbf{Key}} for the first column and \multicolumn{1}{c|}{\textbf{Value}} for the 2nd column. Note that the 2nd is c| and not |c|, otherwise the | would be doubled. \textbf{Key} etc. for bold ...


1

You have to repeat the resetting at every \section in the appendix. \documentclass{article} \usepackage[demo]{graphicx} \usepackage[nofiglist,notablist]{endfloat} \usepackage{etoolbox} \begin{document} \section{Section one} The main figure is Figure~\ref{Figure-1}, and the main table is Table~\ref{Table-1}. Supplemental material includes ...


1

A solution replacing booktabs with boldline (for variable-width horizontal lines) and cellspace (for vertical padding of cells): \documentclass{article} \usepackage{geometry} \usepackage{siunitx} % Formatting for units \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % Use colour! \usepackage{cellspace, boldline} \setlength\cellspacetoplimit{5pt} ...


2

As you've noticed, the rules drawn by the macros of the booktabs package don't work very well if entire columns have to be colored. As an alternative, you could insert (typographic) struts to preserve the good spacing generated by \toprule and \bottomrule while getting the entire cell heights colored in. The directives \Tstrut (short for "top strut") and ...


0

\begin{center} \begin{table} \begin{tabular}{p{4cm} p{13cm}} \multicolumn{2}{l}{\textbf{Table 1} This will now go across the table} \hline \textit{Predisposing factors} \\ \hline variable 1 & description \\ variable 2 & description \\ variable i & description \\ \end{tabular} \end{table} \end{center}


2

A starting point using TikZ: \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,calc} \begin{document} \begin{tikzpicture} \node (ul) {% \begin{tabular}{|l|} \hline Reference paper \\ \hline rp sentence1 \\ rp sentence2 \\ \hline \end{tabular}% }; \node[below=of ul] (ml) {% \begin{tabular}{|l|} ...


4

The best way to proceed here is to locally redefine \abovecaptionskip and \belowcaptionskip (default value=7pt). The following example shows this redefinition (it's local since it's done inside an environment): \documentclass{beamer} \mode<presentation> {\usetheme{Madrid}} \usepackage{graphicx} % Allows including images \usepackage{booktabs} % Allows ...


2

Perhaps something like this \documentclass[a4paper,10pt]{article} \usepackage{multirow} \usepackage{array} \usepackage{booktabs} \begin{document} \pagestyle{empty} % non-numbered pages \centering \begin{tabular}{ >{\raggedright \arraybackslash}m{0.25\linewidth} >{\raggedright \arraybackslash}m{0.55\linewidth} c c} \toprule \centering Semester & ...


0

Putting \usepackage{etoolbox} \AtBeginEnvironment{tablenotes}{\small} is preferable to setting \small each time as it ensures consistency and is easier to change if you need to do so later.


3

Here is a code that compiles. There were a few & that should have been \&. Btw, why did you number the table by yourself? This makes two numbers for one table. I took the opportunity to improve the table, especially some vertical padding between rows, rule commands from booktabs and the S column type for the last column (from siunitx). ...


1

This seems to fix the errors. \begin{table*}[ht] \caption{Top 10 Philippine Exports to ASEAN, 1991-2012} \begin{threeparttable} \centering \begin{tabular}{p{0.15\linewidth} p{0.45\linewidth} p{0.20\linewidth}} \hline PSCC & Description\tnote{a} & Shares \\ \hline ...


2

As David suggests in the comments, another approach is use a comma separated syntax: \foo{1,2,3,4,5,6,7,8,9,a} You can then loop over the entries and put them into place. There are still some expansion issues because we are working inside a table but you can get around these using the etoolbox to build each row as you loop over the arguments using ...


5

The first table cell, where \foo is executed, is also a local group. After the next & the local meanings of \tempb, \tempc, ... are lost. There are several ways Global definitions \documentclass{article} \begin{document} \newcommand*\foo[9]{% \gdef\tempa{#1}% \gdef\tempb{#2}% \gdef\tempc{#3}% \gdef\tempd{#4}% \gdef\tempe{#5}% \gdef\tempf{#6}% ...


1

Here is an working example: \begin{tabular}{ | l | p{5cm} | } \hline % the line at the top Parameter & Equation \\ \hline Compensation & \\ % we have an empty cell here Capacitor & $some equation$ \\ \hline % the line at the bottom \end{tabular}


3

Here is a quick demo of linking R and LaTeX using the 'knitr' package. This has been run on Windows 8.1, with MikTeX 2.9, and TeXmaker 4.4.1 as the IDE. The following code is saved as knit02.Rnw (and this is case sensitive). With the package 'knitr' installed in R 3.1.3 you run the command: knit("knit02.Rnw"). This will generate the file 'knit02.tex' ...


1

You could use \begin{tabular}{@{}l@{}}...\end{tabular} around the two tables, but this would make somewhat difficult to paste them. With varwidth we can do it, setting \lineskip to the negative of the rule thickness. Note that I defined two personal commands for the boxes: do this every time you use some particular construction more than in a couple of ...


1

Here, I just stack the two tabulars with left alignment and zero gap. Note that I redefined \cite, since the OP did not provide citation data. \documentclass{article} \usepackage{amsmath,amssymb,stackengine} \def\cite#1{#1} \begin{document} \begin{table}[!h] \begin{center} \caption{Survey Table} \label{table4} \stackengine{0pt}{% ...


1

Using \multirow is similar to using \multicolumn and, when p is specified in the latter, math mode must be resumed in the argument also in array. However, the arrangement you're looking for can be obtained without \multirow: \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} \[ \begin{pmatrix} \;\mathcal{J} & \begin{matrix} a & ...


0

I found the problem. In my main file under the cover page there I introduced a longtable for my abbreviations. I missed to search for tables in the main file because I got all my text via \input{}. Logically it rose the table counter. Werner´s tip led me to reduce the counter directly before that table: % Set table index to 0. We don´t want the table to ...


3

According to multirow's documentation, when you specify the width of the multi-row cell explicitly, it sets the contents in a \parbox of the requested width. This would obviously switch to text mode so you'd need to re-enter maths mode explicitly within the cell. When you specify the width as *, the contents is set in LR mode. So, again, you drop out of ...


0

As a start point you can try this site http://www.tablesgenerator.com it will help you to create table online like in excel


0

So, based on the replies I got here is the table: \begin{table} \centering \begin{tabular}{p{3.5cm}cp{1.75cm}p{3cm}p{1.75cm}} \toprule \multicolumn{3}{c}{Field variables} & \multicolumn{2}{c}{Field equations}\\ \midrule Name & Symbol & Number of Unknowns & Name & Number of equations \\ \midrule Displacement (vector) & $\textbf{u}$ ...


1

I would use the package adjustbox here. Please note the option valign=t I added to each image: % arara: pdflatex \documentclass[headsepline]{scrreprt} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \PassOptionsToPackage{demo}{graphicx} % you can remove this. \usepackage[export]{adjustbox} \usepackage{tikz} \usetikzlibrary{positioning} ...


0

You can start with: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{lmodern} \usepackage{booktabs} \begin{document} \begin{tabular}{p{3.5cm}cp{1.75cm}p{3cm}p{1.75cm}} \toprule \multicolumn{3}{c}{Field variables} & \multicolumn{2}{c}{Field equations}\\ \midrule Name & Symbol & ...


0

Include the package multirow: \usepackage{multirow} And use it in your table like so: \multicolumn{2}{c}{ Field variables } The field will now span across 2 cells, the text will be centered, the content will be 'Field variables'.


2

It would appear to be the case that the floatrow package's code interacts in undesirable ways with that of the rotating package. Since it doesn't look like the floatrow package is truly needed, I wouldn't use it. I would take care to structure the tables' headers so that they have a consistent look while avoiding line breaks in unfortunate places. Making ...


3

You can still use a longtable as this: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage{longtable} \begin{document} \begin{longtable}{cc p{1em} cc} \cline{1-2} \cline{4-5} & vals& & & vals\\ \cline{1-2} \cline{4-5} a & 3.39& & a & 3.39\\ b & 4.35& & b & 4.35\\ c & 6.16& ...


2

You can even have wider margins fiddling with the font size and the value of tabcolsep. I took the opportunity to simplify your code and improve the appearance of the table with siunitx and makecell: \documentclass[landscape, 12pt]{report} \usepackage[showframe, nomarginpar, top=0.8in, bottom=1.25in, left=1in, right=1in]{geometry} \usepackage{siunitx} ...


2

You misquote the error message in your title. It is not \end{tabulary} that is undefined. The first two errors in your document are ! Undefined control sequence. <recently read> \midule l.11 \end{tabulary} ? ! Undefined control sequence. \LT@echunk ->\crcr \LT@save@row \cr \egroup \global \setbox \@ne \lastbox ...


3

Always post fully compilable examples: This compiles just as expected \documentclass[a4paper]{article} \newcommand*\mycmd[3]{#1 & #2 & #3 \\} \begin{document} \begin{tabular}{ccc} \mycmd{a}{b}{c} \mycmd{d}{e}{f} \end{tabular} \end{document}


2

Use tabular in a better way: \documentclass{article} \usepackage{graphicx} \begin{document} \begin{tabular}{|c|l|r|r|} \hline \raisebox{-.7\height}[0pt][0pt]{\includegraphics[height=1.8\normalbaselineskip]{duck}} & 1111 & 1111 & 111111 \\ \cline{2-4} & 222222 & 222222 & 2222 \\ \hline \end{tabular} \end{document} Two ...


2

Package ltxtable allows the combination of longtable with tabularx column type X. The latter is useful for the last column with the description text. The first columns can be set via column type l. The indentation in the description part can be achieved via \hangindent and \hangafter (assuming there is only one paragraph). Since the package ltxtable ...


1

\multicolumnn can also be used for a single column to overwrite the column specification. The first argument of \cmidrule specifies some trimming. The example uses (lr). Then you will see, the line is also shorter at the right side. Example: \documentclass{article} \usepackage{booktabs} \usepackage{multirow} \begin{document} \begin{table} ...


2

With help of `makecell˙package is really simple: Code: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{multirow,booktabs,makecell} \renewcommand\theadfont{\normalfont} \begin{document} \begin{table} \begin{tabular}{lrrrr} \toprule \multirow{2}[3]{*}{Method} & \multicolumn{2}{c}{group} ...


0

Perhaps placing two tabulars side-by-side will work for you? \documentclass{article} \begin{document} \begin{tabular}{ll} Title & Name \\ \hline Mr & Tom \\ Mrs & Eliza \\ \end{tabular} \begin{tabular}{ll} Title & Name \\ \hline Mr & Tim \\ Mr & Ohm \\ \end{tabular} \end{document}


1

Evidently using \ttabbox put the target back where it belongs. \documentclass{article} \usepackage[style=Plaintop]{floatrow} %\usepackage{threeparttable} \usepackage[referable]{threeparttablex} \usepackage{caption} \usepackage[raiselinks=true]{hyperref} \begin{document} \listoftables \ref{Example} \begin{table}[t] \ttabbox% % Link DOES jump ...


0

A little bit late to the game, but hopefully still useful. Note that all \multicolumn{1}{c|}{...} wrappers are gone. \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage[nomarginpar]{geometry} \usepackage{amsmath} \usepackage{rotating,caption,booktabs} %% macro for a "small", i.e., compressed table ...


0

This may be a visual artefact from a regular list's way of indenting itself. Perhaps creating your own tabularitemize that doesn't use much list formatting suits your needs better: \documentclass{article} \usepackage[margin=1in]{geometry}% Just for this example \usepackage{array,varwidth,booktabs} \newcolumntype{C}{>{\centering\arraybackslash} ...


1

If I simplify your code (remove minipage, instead tabular* use just tabular) and left aesthetic point of view aside, then I obtain: The code is now: \documentclass[12pt]{article} \usepackage{lmodern,caption} \usepackage{array} \usepackage{siunitx} \newcolumntype{C}[1]{>{\centering\arraybackslash} m{#1}} \begin{document} \begin{table} ...


1

I more liked this form: For itt I add two packages: makecell and siunitx and make p{...} column wider so, that the actors names are fit in one line: \documentclass[12pt]{article} \usepackage{lmodern,caption} \usepackage{array,booktabs,makecell} \renewcommand\theadfont{\normalsize} \usepackage{siunitx} \begin{document} \begin{table} \centering ...


2

I suggest you drop the vertical lines completely. And increase the value for width of p columns in your \multicolumn. \documentclass[12pt]{article} \usepackage{lmodern,array,booktabs} \begin{document} \begin{table}[h] \centering \caption{Top 5 popular casts(1) VS popular casts(2)} \label{table:popularCasts} ...


2

Here's a version using booktabs which follows at least some (though not all) of the recommendations it makes. This does not exceed the width (\textheight) available. \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{rotating,multirow,booktabs,tabularx} \begin{document} \begin{sidewaystable} \centering ...


4

You can make some column heads two-lined, with the makecell package. I took the opportunity to give some vertical padding to the table, and simplified your code, keeping only the necessary \multicolumns. Loading the caption package makes the vertical (?) spacing between caption and table more sensible. \documentclass[a4paper, twoside]{Thesis} ...


1

If you're willing to write $\bar{R}^2$ instead of Adj. $r^2$ -- the former notation is much more common in my field, viz., econometrics -- you can shorten the header material sufficiently so that the table will fit in "ordinary", i.e., portrait mode. Like the other two persons giving answers up to now, I also recommend using the rule-drawing macros of the ...


6

The following code shows a comparisson between the current code and one produced using booktabs and siunitx: \documentclass[12pt,oneside,a4paper,fleqn]{report} \usepackage{float} \usepackage{booktabs} \usepackage{siunitx} \usepackage{slashbox} \begin{document} \begin{table}[H] \centering \begin{tabular}{|l|lll|} \hline \backslashbox{$f_i$}{$c_j$} ...


1

Here are two possibilities. I don't think multirow is useful here. I fromatted some numerical columns with the siunitx package. In the version with vertical lines, I added some vertical padding with the cellspace package. In my opinion, the version without vertical lines looks better, using the rule commands from `booktabes (which incorporate some vertical ...



Top 50 recent answers are included