I would like to include a centered tabular inside an itemize environment item, is this possible? This is what I am working with, but I can't find a way to center the tabular. Paragraphs are not allowed inside items...
\documentclass{article}
\begin{document}
\begin{itemize}
\item Text before tabular
\newline
\begin{tabular}{ccc}
a & b & c \\
a & b & c \\
\end{tabular}
\newline
text after tabular
\item second item
\end{itemize}
\end{document}
Do you want the table centered relative to the other list contents or to the whole page?
For the whole page, what is wrong with the obvious solution:
\newenvironment{nscenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
\begin{itemize}
\item Text before tabular
\begin{nscenter}
\begin{tabular}{ccc}
a & b & c \\
a & b & c \\
\end{tabular}
\end{nscenter}
text after tabular
\item second item
\end{itemize}
(with credit to this answer).
For centering relative to the other contents, this works:
\begin{itemize}
\item \begin{tabular}[t]{#{}l#{}}
Text before tabular\\
\multicolumn{1}{c}{
\begin{tabular}{ccc}
a & b & c \\
a & b & c \\
\end{tabular}}\\
Text after tabular\\
\end{tabular}
\item Second item
\end{itemize}
But I admit that it's not very pretty. Maybe someone else has a better solution?
Related
I am trying to use the following code in the table using latex
\begin{table}[htb!]
\caption {Table}
\begin{center}
\small\setlength\tabcolsep{5.2pt}
\renewcommand{\arraystretch}{0.005}
\begin{tabular}{|p{0.14\textwidth}|p{0.14\textwidth}|p{0.14\textwidth}|}
\hline
\textbf{Text}& \textbf{Text} & \textbf{Text}\\
\hline
Text & \begin{itemize} \item{Text} \item {Text} \item \end{itemize} & Text \\
\hline
\hline
\end{tabular}
\label{tab1}
\end{center}
\end{table}
How to make the Text using the itemize to align to the left and remove the spacing between each bullet points as shown in the photo
How to remove or decrease the row spacing in the table
The following code should align the itemize text to the left and remove the spacing between bullet points:
\begin{itemize}[leftmargin=*, noitemsep, topsep=0pt]
\item Text
\item Text
\end{itemize}
To decrease the row spacing in the table, you can use the following command in the preamble:
\renewcommand{\arraystretch}{0.5}
Or you can adjust the number in the argument to set the desired row spacing.
You need to load enumitem to gain access to addition options. Then, either apply settings in-place for a specific list or clone itemize with additional settings.
In settings, you have to negate vertical spacing added by environments. But then, this messes up with the lists which you want to mix with a regular texts. So, one workaround is to clone itemize into two separate lists you use with or without surrounding text--you can still apply global settings common for two lists. Here's an example:
\documentclass{article}
\usepackage{array}
\usepackage{tabularx}
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}
\newlist{soloitemize}{itemize}{1}
\setlist[tabitemize,soloitemize]{
nosep, nolistsep,
topsep=6pt,
align=left,
left=0pt,
label=$\bullet$,
}
\setlist*[soloitemize]{
before=\vspace{\dimexpr-6pt-\topsep},
after=\vspace{-10pt},
}
\begin{document}
Regular text with a regular itemize:
\begin{itemize}
\item Text
\item Text
\item X
\end{itemize}
\begin{table}[htb!]
\renewcommand*{\arraystretch}{1.25}
\caption {Table with custom itemize}
\begin{center}
\small\setlength\tabcolsep{5.2pt}
\begin{tabular}{|p{0.14\textwidth}|p{0.14\textwidth}|p{0.14\textwidth}|}
\hline
\textbf{Text} & \textbf{Text} & \textbf{Text}\\
\hline
Text & \begin{soloitemize}
\item Text
\item Text
\item Text
\item Text
\item X
\end{soloitemize} & Text text
\begin{tabitemize}
\item Text
\item X
\end{tabitemize}
Text \\
\hline
\hline
\end{tabular}
\label{tab1}
\end{center}
\end{table}
Regular text.
\end{document}
This below latex code has warning saying Overfull \hbox (1.38991pt too wide) in paragraph at lines; pdf is getting generated without any issue, I am trying to find out where exactly I am making a mistake to see that warning.
Latex code1:
\begin{document}
\setbeamertemplate{caption}[numbered]
\begin{frame}
\titlepage
\end{frame}
Latex code2:
%\section{Literature Review}%
\begin{frame}{OBJECTIVE}
\begin{table}[h!]
\centering
\begin{tabular}{ p{3cm}|p{7cm}}
\hline
\vspace{1pt}
Title & “CompaRob:The shopping cart assistance robot" \textit{’ Int. J. Distrib. Sensor Netw., vol. 12,no. 2, Feb. 2016, Art. no. 4781280.} \\
\hline
\vspace{6mm}
Methodology &
\begin{itemize}
\item Radio and ultrasound signals
\item Provide freedom of movements for elderly people
\end{itemize}\\
\hline
\vspace{1pt}
Demerit &
\begin{itemize}
\item Not able to show how to find a product
\end{itemize}\\
\hline
\end{tabular}
\end{table}
\end{frame}
There is not enough space to fit 10 cm worth of columns and the default padding before and after the columns. Either remove the padding by using #{}p{2.9cm}|p{7cm}#{} or make the columns a bit smaller:
\documentclass{beamer}
\begin{document}
\setbeamertemplate{caption}[numbered]
\begin{frame}
\titlepage
\end{frame}
%\section{Literature Review}%
\begin{frame}{OBJECTIVE}
\begin{table}[h!]
\centering
\begin{tabular}{ p{2.9cm}|p{7cm}}
\hline
\vspace{1pt}
Title & “CompaRob:The shopping cart assistance robot" \textit{’ Int. J. Distrib. Sensor Netw., vol. 12,no. 2, Feb. 2016, Art. no. 4781280.} \\
\hline
\vspace{6mm}
Methodology &
\begin{itemize}
\item Radio and ultrasound signals
\item Provide freedom of movements for elderly people
\end{itemize}\\
\hline
\vspace{1pt}
Demerit &
\begin{itemize}
\item Not able to show how to find a product
\end{itemize}\\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}
I want to create a table like what is shown in the figure, i.e. to have a bullet list of items in some of the table cells.
I tried to use simply the "itemize" environment within the "tabular" environment, like this:
\documentclass[12pt]{extarticle}
\begin{document}
\begin{table}
\centering
\begin{tabular}{| l | l | l | l |}
\hline
Verticals & Drivers & Enablers & 5G requirement \\
\hline
Education &
\begin{itemize}
\item Remote delivery
\item Immersive experiences
\end{itemize} &
\begin{itemize}
\item Video streaming
\item Augmented reality
\item Virtual reality
\end{itemize} &
\begin{itemize}
\item Large bandwidth
\item Low latency
\end{itemize} \\
\hline
\end{tabular}
\end{table}
\end{document}
But it doesn't work and pops up this error:
! LaTeX Error: Something's wrong--perhaps a missing \item.
Does anyone know the cause of the error? By search, I realized that this technique is correct and using items inside a table is possible. But I cannot figure out the problem in my code.
You need a column of fixed width, e.g. m{4cm} instead of l
\documentclass[12pt]{extarticle}
\usepackage{geometry}
\usepackage{array}
\begin{document}
\begin{table}
\centering
\setlength{\leftmargini}{0.4cm}
\begin{tabular}{| m{2cm} | m{4cm} | m{4cm} | m{4cm} |}
\hline
Verticals & Drivers & Enablers & 5G requirement \\
\hline
Education &
\begin{itemize}
\item Remote delivery
\item Immersive experiences
\end{itemize} &
\begin{itemize}
\item Video streaming
\item Augmented reality
\item Virtual reality
\end{itemize} &
\begin{itemize}
\item Large bandwidth
\item Low latency
\end{itemize} \\
\hline
\end{tabular}
\end{table}
\end{document}
I'm trying to make this table:
But I haven't found the possibility to include a list in a cell.
You can use itemize in all column types which allow linebreaks, e.g. in a p column of fixed with:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{tabular}{|l|p{3cm}|}
\hline
abc & \begin{itemize}[left=0pt,topsep=0pt]
\item abc
\item def
\end{itemize}\nointerlineskip\\
\hline
abc & abc\\
\hline
\end{tabular}
\end{document}
Ok so i wrote this simple code (shown below) to create an alternate colour table using \rowcolors, yet instead of just colouring the rows of the table it colours the whole row (even more than textwidth). Any help how to fix this?
begin{table}[ht]
\scriptsize
\begin{center}
\rowcolors{1}{lightgray}{white}
\caption{...}
\begin{tabular}{p{0.45\textwidth} | p{0.55\textwidth}}
Filename & Contents \\
\hline
\hline
A & B \\
C & F \\
\end{tabular}
\end{center}
\end{table}
While 0.45\textwidth + 0.55\textwidth would seem to fit within \textwidth, each of your p-columns have an extra column separation... on both sides. To that end, you should remove them in order to make it fit within the text block boundary:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{lipsum}
\begin{document}
\begin{table}[ht]
\scriptsize\centering
\rowcolors{1}{lightgray}{white}
\caption{This is a table.}
\begin{tabular}{
p{\dimexpr0.45\textwidth-2\tabcolsep} |
p{\dimexpr0.55\textwidth-2\tabcolsep}}
Filename & Contents \\
\hline
\hline
A & B \\
C & F
\end{tabular}
\end{table}
\lipsum[1]
\end{document}
Also, don't use the center environment; use \centering instead.