New answers tagged

0

Another solution is to load the cellspace package, which defines minimal vertical spacing between a cell and the above and below cells in columns with specifier prefixed with the letter S (or C if you use siunitx). I added the caption package to have a decent vertical spacing between caption and table (basic latex doesn't permutes the values of ...


3

For horizontal centering, use the c ("center") column type instead of the l ("left-align") column type. Vertical centering may be achieved in a number of ways. Since the table appears to contain mostly numbers, I suggest you provide the instruction \setlength\extrarowheight{2.5pt} immediately after \begin{table}. By the way, "vertical centering" has both ...


4

Like this? \documentclass{article} \usepackage{graphicx} \begin{document} \begin{tabular}{llll} (A) & (B) & (C) & (D) \\ \includegraphics[width=.2\linewidth]{example-image} & \includegraphics[width=.2\linewidth]{example-image} & \includegraphics[width=.2\linewidth]{example-image} & ...


1

This is more extended comment than answer: you show as only code snipped, which can not be compiled (see above comments) tablefootnote works only in table environment environment \begin{center}\centering ...\end{center} is strange the way of use \thead{} nullify the column type m{...} etc With MWE below I got the following result: ...


2

Basic option would be my_rows.tex with \rowdef{row_complex}{\arow{this}{is}{a}{nastyyyy}{$\mathcal{C}$ row}} \rowdef{row_real}{\arow{this}{is}{a}{less nasty}{$\mathcal{R}$ow}} Then adding in the preamble \newcommand*\arow[3]{#1&#2&#3\tabularnewline} \newcommand*\rowdef[1]{\expandafter\def\csname row@#1\endcsname} \newcommand*\rowuse[1]{\csname ...


4

With tikz \documentclass[a4paper]{article} \usepackage{tikz} \newcommand{\tikzmark}[2][]{\tikz[remember picture, overlay]\node[#1,inner sep=0pt,xshift=-\tabcolsep](#2){};\ignorespaces} \newcommand{\tm}[2][]{\tikzmark[yshift=#1]{#2}} \begin{document} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{|l|l|l|l|l|l|l|} \hline ...


2

I propose a solution with tabularx. I also added (automatically) some vertical padding between rows, with the cellspace package: \documentclass[11pt]{scrartcl} \usepackage{fontspec} % for the Swedish chars \usepackage{polyglossia} \setmainlanguage{swedish} \usepackage{fontspec} % for the Swedish chars \setmainfont{Minion Pro} ...


3

looks like a bug but as usual with these things, an extra {} helps \documentclass[11pt]{article} \usepackage{listings} \usepackage{matlab-prettifier} \lstdefinestyle{matlab}{style=Matlab-editor, basicstyle=\ttfamily\normalsize, escapechar = `, mlshowsectionrules = true, frame=none } \begin{document} \begin{tabular}{p{0.5\textwidth} } ...


4

LaTeX provides a p{length} specifier for this purpose. With array.sty, you can reduce the amount of repeated code by defining a new column specifier: \documentclass{scrartcl} \usepackage{fontspec} % for the Swedish chars \usepackage{array,booktabs,ragged2e} \newcolumntype{N}[1]{>{\hspace{0pt}\RaggedRight\itshape}p{#1\textwidth}} \begin{document} ...


5

Here is one way of doing it, using the graphicx package: \documentclass[10pt,letterpaper]{article} \usepackage{graphicx} \begin{document} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{|l|l|l|l|l|l|l|} \hline \multicolumn{1}{|c|}{CONCEPT} & \multicolumn{6}{c|}% {COMPREHENSIVE ...


3

Just replace in the main table preamble c with @{}c@{} for each column which contains a nested tabular. Note this requires the array package. I also improved the table loading the cellspace package, which defines minimal vertical padding between a row and the above and below cells in columns with a specifier prefixed by the letter S: ...


3

Something like this: For this you need to elininate table column separation in column in which you nested table. This is done with use of @{}: \begin{table} \centering \begin{tabular}{ |c|@{}c@{}| }% <-- aded @{} \hline no test & no test \\ \hline no test & \begin{tabular}{c|c} D1 & 1.23 \\ \hline D2 & 1.23 \\ \end{tabular} \\ ...


2

You can use \only. For example: 1 & \only<1>{?}\only<2>{somethingelse} & 3 The parameter in <> specify when it will be displayed. You can also use ranges: \only<1-3>{abc}: Display abc for the first 3 steps \only<2->{abc}: Display nothing on the first step, then display abc for each following step


3

like this? \documentclass{beamer} \usepackage{booktabs} \usepackage{colortbl} \begin{document} \begin{frame} \frametitle{Example} \begin{table} \centering \begin{tabular}{c c c} \toprule H1 & H2 & H3\\ \midrule 1 & \only<2>{\cellcolor{blue!50}}? & 3 \\ 2 & 4 & ?\\ \bottomrule \end{tabular} \end{table} \end{frame} ...


1

It is easier for people to help if you post a complete document, as below, that shows the problem rather than disconnected fragments, but anyway, it fits on the page if you reduce the font size, and steal a bit of the bottom margin. \documentclass[12pt]{book} \usepackage{lscape,longtable} \begin{document} \begin{landscape} \scriptsize ...


4

You can do it with \csvautotabular, provided you change the category code of & before reading the file. \begin{filecontents*}{\jobname.csv} CategoryName,Pageviews Restaurants,37951 Shopping,22002 Things to do,20067 Nightlife,10612 Gifts,9194 Food Shopping,8655 Useful Stuff,8536 Parenting ,8353 Home,7654 Fitness,6623 Event & Party Planning,6387 ...


5

The problem is the ampersand character &. Edit your CSV file to replace all instances of & by \& or by the text string and solves the problem. The ampersand is a special character to delineate fields in tabular and array environments. To access it you need to escape it. The csvsimple package doesn't do any sanity checks on your csv data: it ...


1

Here are two possibilities. Since you have not provided an MWE, it is hard to know what you are doing and what else you should or could be doing. One possibiliy is to use multirow, which has the following syntax: \multirow{nrows}[bigstruts]{width}[fixup]{text} I do not use the optional arguments in the example below. Another idea is to embed a 'mini ...


2

You should look into using a longtable environment, as is done in the following modified (and simplified/shortened) version of your code. \documentclass[12pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[brazilian]{babel} \usepackage{longtable} % <---- new \usepackage[justification=centering]{caption} ...


3

One easy way to do is to use \parbox{} to limit the header width. You can give the size for each parbox as shown below. Another change I would suggest is to use \ding{51} and \ding{55} instead of \textsurd and x. they can be found in pifont package. In Lyx you can use the insert Tex code facility to insert just the {\parbox{2cm}{Header}} inside the table ...


2

Here is a solution \documentclass{article} \usepackage{lipsum} \newcommand*\editorialtable{% \beforeeditorialtable \begin{tabular}{|l|l|l|l|} \hline \multicolumn{1}{|c}{Section} & \multicolumn{1}{|c}{Subsection} & \multicolumn{1}{|c}{Responsible}&\multicolumn{1}{|c|}{Helpers}\\ \hline \makeeditorialtable \end{tabular} \aftereditorialtable} ...


2

See the updated and better version at the end, please! A preliminary version with expl3 features and key-value interface, only working for a table at the end at the moment! \documentclass{article} \usepackage{xparse} \usepackage{xkeyval} \makeatletter \let\latex@@section\section \let\latex@@subsection\subsection \define@key{editorial}{helper}{% ...


3

A few notes: the preamble is rather problematic: it includes too much which is too ancient and too disordered e.g. hyperref needs to be loaded late - cleverref must come later, but almost everything else should come earlier; epsfig is obsolete; etc. tabularx requires one or more X columns in some guise or other. The table doesn't fit the page. The ...


0

For completeness I add the \usepackage[flushleft]{threeparttable} and the \begin{threeparttable} environment, to add table notes: \documentclass[12pt]{report} \usepackage[left=35mm, right=25mm, top=30mm, bottom=30mm]{geometry} \usepackage{booktabs,tabularx} \usepackage{siunitx} \usepackage[flushleft]{threeparttable} \begin{document} ...


0

Depending on the variant of latex you use (latex, pdflatex, xelatex, etc.), the canonical way is to rotate the table, and if necessary to minimize it. You might need \usepackage{graphicx} rather than \usepackage{graphics} \resizebox{\textwidth}{!}{ \begin{tabularx} … \end{tabularx}} Might work.


3

See, if the following code gives what you expect: \documentclass[12pt]{report} \usepackage[left=35mm, right=25mm, top=30mm, bottom=30mm]{geometry} \usepackage{booktabs,tabularx} \usepackage{siunitx} \begin{document} \begin{table}[htbp] \centering \caption{Systematic review of type 2 vs. type 1 diabetic pregnancies: maternal and fetal secondary ...


2

I didn't find any way to do this in the manual for the exam class, so I made a quick custom solution that prints a list of answers automatically. The only thing that you must do is to use \CC for the correct choice, and then write \printmyanswers to display the answers as a list. There are some examples on this site for the tabular, but it's pretty verbose ...


0

An alternative solution which also need manual tweaking of final layout: \documentclass{article} \usepackage{array, makecell, multirow} \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} \newcommand\mrc[2]{\multirowcell{#1}{#2}}% #1 number of lines in the tallest cell \begin{document} ...


1

I would simply use minipages like it is seen so often on TeX.SX. \documentclass{article} \usepackage{graphicx} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{minipage}{.45\linewidth} \begin{subfigure}[t]{.9\linewidth} \includegraphics[width=\textwidth]{example-image-golden-upright} ...


0

There is no \caption before \label{t:table}, therefore the label is referencing the previous section. Example file with some other suggestions and some simplifications: \documentclass[a5paper]{report}% a5paper to get a smaller image for TeX.SX \usepackage{caption} \usepackage{booktabs} \usepackage{siunitx} \sisetup{output-decimal-marker={,}} \makeatletter ...


2

There are a few problems here: You have a opening { after \mode<presentation> but no closing brace, so I deleted that. beamer doesn't define a starred table environment. And it doesn't really make sense for it to do so either, columns in beamer are more like two minipages next to each other, text doesn't flow from one column to the other, as in e.g. ...


2

For a table of figures like this one you can use the package booktabs, like this: \documentclass[a4paper,10pt]{article} \usepackage{booktabs} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \newcommand{\dummyfigure}{\tikz \fill [NavyBlue] (0,0) rectangle node [black] {Figure} (2,2);} \begin{document} \begin{table} \centering ...


5

Assuming that all figures could be 6em wide, this can be done using booktabs in a normal tabular environment. \documentclass{article} \usepackage{graphicx,booktabs,array} \begin{document} \newcommand{\addpic}{\includegraphics[width=6em]{example-image}} \newcolumntype{C}{>{\centering\arraybackslash}m{6em}} \begin{table}\sffamily ...


1

The cellspace package defines minimal vertu=ical padding at the top and bottom of cells in columnns with specifiers prefixed by the letter S (or C if you use siunitx): \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{array, cellspace} \setlength\cellspacetoplimit{4pt} ...


0

I can make two suggestions Embed the tabular environment in a center environment (and omit the \centering instruction), or Embed the tabular environment, along with the \centering instruction, in a table environment, taking care to add [h!] as the positioning specifier in order not to let the environment "float" too far away. This method may be preferable ...


4

Here, environment center makes sense, because it adds space: \begin{center} \begin{tabular}{...} ... \end{tabular} \end{center} Nicer lines are available with package booktabs: \usepackage{booktabs} ... \begin{center} \begin{tabular}{...} \toprule ... \bottomrule \end{tabular} \end{center} Full example: \documentclass{article} ...


3

Your calculations do not take account of the width of the | or of the separation between the columns. You could take these into account explicitly. \documentclass[11pt]{book} \usepackage[letterpaper,showframe]{geometry} \usepackage{array,calc} \newcolumntype{Y}[1]{>{\hsize=#1\hsize}X} \begin{document} \noindent ...


2

As @Zarko and @Bernard have already pointed out, setting \small at the start of each cell is not the same as having \small apply to the entire row of a tabular environment: even though the cell contents will be typeset at the same size, the values of \baselineskip will differ. Specifically, given that the main font size of your document is 11pt, the value of ...


2

That is normal: the result of \arraystretch depends on \baselineskip, which depends on the font size. Instead of playing with \arraystretch you can load the cellspace package which defines minimal vertical spacing between a cell and the above and below cells. \documentclass[11pt,openright]{book} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} ...


2

You seem to know how to add options to individual cells, with |[...]| already, so in that sense you've almost answered your own question: Add fill=<color> in those options, e.g. |[fill=blue!20]|. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,matrix} \usepackage{amsthm} \usepackage{colortbl} \begin{document} \begin{table}[h] ...


0

You can use \raggedright{insert notes here} after \end{tabular} but before \end{table}: \documentclass{article} \begin{document} \begin{table} \centering \caption{Sample ANOVA table} \begin{tabular}{lllll} \hline \hline Stubhead & \( df \) & \( f \) & \( \eta \) & \( p \) \\ \hline ...


3

You can disable the spacing with the nosep option from enumitem. I add also some ways to improve your table, for instance how to make it into filling the whole text width without guessing. Note that the center environment should not be used; also it's better if the \label sits next to the \caption, for easier lookup. I recommend using siunitx for units and ...


10

The following might shed some light on when to use which: tabular creates an unbreakable block, while tabbing can break across the page boundary. tabular allows for creating specific alignments using the column specification, while tabbing assumes all tabs are left aligned. tabular can insert vertical and horizontal rules that span the width of the ...


2

The explanation is the image is laid on the base line, so you have to use `\raisebox{ a minimal vertical padding between the above and below rules: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{geometry} \usepackage{graphicx} % \usepackage{array, booktabs, longtable, cellspace} \renewcommand\cellspacetoplimit{5pt} ...


2

\documentclass{article} \usepackage{hvfloat} \begin{document} \hvFloat[floatPos=!h,rotAngle=90,capPos=b,capVPos=c,capWidth=w,floatCapSep=10] {table}{% \begin{tabular}{|c|c|} \hline A & B\tabularnewline \hline \hline 1 & 2\tabularnewline \hline 3 ...


2

You can do that with the makecell package, which allows for line breaks in cells and a common formatting, through the\thead and \makecell commands. I propose another, looking better, solution, with only horozontal rules of different thickness, with the booktabs package. Finally I added some improvements to your table (unbreakable thin space between number ...


5

You can define a new caption label format, and use threeparttable: \documentclass[]{report} \usepackage{caption} \usepackage{threeparttable} \DeclareCaptionFormat{mine}{\raggedright #1.\\\centering #3}% \captionsetup[table]{labelformat=simple, singlelinecheck=off, format=mine} \begin{document} \begin{table}\centering \begin{threeparttable} \caption{Dummy ...


2

You could use \global\@namedef but then it will have global scope. It also makes assumptions about the implementation of \@namedef but the assumptions are true, but for example you can not use \global in general before macros, \global\newcommand does not work at all.


0

If one did not need horizontal rules between rows of the data, then a grouped TABstack could suffice, in particular, an \alignCenterstack. \documentclass{article} \usepackage{tabstackengine} \setstackEOL{\cr} \setstackgap{L}{\normalbaselineskip} \begin{document} \begin{tabular}{c|ccc} & A & B& C\\ \hline \Centerstack{D\cr C\cr B} & ...


1

The siunitx package is primarily used for typesetting physical quantities with SI units, but can also be used for this purpose. The package provides the S column type, which is used to typeset numbers with uncertainties in tables. By using the column specification S[table-align-uncertainty] will align the numbers at the plus-or-minus sign.



Top 50 recent answers are included