Hi all if anyone can help me. I am new to latex. I am trying to add table in my latex. I know the format but i don't know what I am doing wrong because my table is not in the form I want moreover it is giving me the error when I add caption.
I need some thing like this in the image
but I am getting this when I compile my latex code
Here is my code:
\begin{center}
\begin{tabular}[!ht]{||c c ||}
\caption{Dataset Specifications}
\centering \label{data}
\hline
Dataset & Samples \\ [0.5ex]
\hline\hline
Vovid & 349 \\
\hline
noncovid & 397 \\ [1ex]
\hline
\end{tabular}
\end{center}
My minimal code:
\documentclass{article}
\setlength{\tabcolsep}{1em}
\renewcommand{\arraystretch}{1.5}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|}
\hline
Dataset & Samples \\
\hline
Covid & 349 \\
Non Covid & 397 \\
\hline
\end{tabular}
\caption{Dataset Specifications}
\label{tab:data}
\end{table}
\end{document}
and its output:
Please comment below here if any feature is missing or something is not clear to you :)
How about that:
\begin{table}[!ht]
\centering
\begin{tabular}{|c |c|}
\hline
Dataset & Samples \\ [0.5ex]
\hline
Vovid & 349 \\
noncovid & 397 \\ [1ex]
\hline
\end{tabular}
\caption{Dataset Specifications}
\label{tab:data}
\end{table}
So, the trick is 1) to pack the tabular in a table environment, 2) play with \hline and | to modify the lines around the table cells. More ways to polish tables in https://en.wikibooks.org/wiki/LaTeX/Tables
Related
How can I align this table. It does not algin column two and three at center.
I am using following code:
\begin{table}[htbp]
\caption{Comparison with the hybrid architecture}
\label{tab:comparison}
\begin{center}
\begin{tabular}{|l|c|c|}
\hline
\multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{\textit{Average Episode Reward for 10 Runs (deviation)}} \\ \cline{2-3}
\multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{\textit{Disturbance Magnitude}} \\
\cline{2-3}
\multicolumn{1}{|c|}{\multirow{-3}{*}{\textit{Architecture}}}
& 65\% & 70\% \\ \hline
PID & -17.71 & -23.54 \\
CoL-DRL & -2.58 & -12.25 \\
\rowcolor[HTML]{9AFF99} CoL-DRPRL & -1.85 & -6.25 \\ \hline
\end{tabular}
\end{center}
\end{table}
How can I get rid of vertical extra space in latex? I am getting unnecessary space between the table and the figure in the latex appendix.
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tabularray}
\begin{document}
\chapter{Appendix}
\begin{table}[!ht]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
Sender & Receiver & Total(Bits) & Frame Rate (ms) \\ \hline
VCU & ACU & 88 & 10 \\ \hline
VCU & BCU & 488 & 10 \\ \hline
VCU & DataRecorder & 536 & 10 \\ \hline
\end{tabular}
\end{table}
\begin{figure}
\centering
\includegraphics[width = \textwidth,trim={2.3cm 2.3cm 2.3cm 2.3cm},clip]{Device Graphics.pdf}
\caption{Device Block}
\label{fig:DeviceOverview}
\end{figure}
\end{document}
I tried using [H] in front of image but did not work instead [H] got printed in script
You have to specify where your images is allowed to be placed. To give latex the best possible chances to find a good location, you can use [htbp] to allow the image to be placed here, at the top, at the bottom or on a separate float page:
\documentclass{scrbook}
%\usepackage[utf8]{inputenc} % default since several years
%\usepackage{tabularray} % nothing to do with the question
\usepackage{graphicx}
\begin{document}
\chapter{Appendix}
\begin{table}[!ht]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
Sender & Receiver & Total(Bits) & Frame Rate (ms) \\ \hline
VCU & ACU & 88 & 10 \\ \hline
VCU & BCU & 488 & 10 \\ \hline
VCU & DataRecorder & 536 & 10 \\ \hline
\end{tabular}
\end{table}
\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth,trim={2.3cm 2.3cm 2.3cm 2.3cm},clip]{example-image-duck}
\caption{Device Block}
\label{fig:DeviceOverview}
\end{figure}
\end{document}
Can anyone give an idea on how to make this table?
Use \begin{table} [...] \end{table}
Here is a minimal working example:
\begin{table}
\centering
\begin{tabular}{l r}
& 119 Responses\\
Field & Percentage \\
\hline
Very convenient & 63\% \\
Sowewhat convenient & 28\% \\
Neutral & 5\% \\
Somewhat inconvenient & 2\% \\
Very inconvenient & 3\% \\
\end{tabular}
\end{table}
\end{document}
It looks like this:
I have a table need to write in latex, then I need to use the following code to make a table.
\begin{table}[]
\begin{tabular}{|l|r|}
\hline
\textbf{Item} & \textbf{Amount} \\ \hline
User Account & 15,763 \\ \hline
Original Post & 56,797 \\ \hline
Post Reply & 1,515,618 \\ \hline
Post (Original+Reply) & 1,572,415 \\ \hline
Adopted Post & 88,240 \\ \hline
\end{tabular}
\end{table}
However, it cannot set a specific width. When I want to write \begin{tabular}{|l{3.8}|r{3.8}|}, it does not work.
If I use p{3.8cm}, it does work. However, it does not keep right but left.
I want to make a specific width from the table and set it to keep right instead of the left.
Can anyone help me? Thanks!!
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{table}[]
\begin{tabular}{|l|>{\raggedleft\arraybackslash}p{3.8cm}|}
\hline
\textbf{Item} & \textbf{Amount} \\ \hline
User Account & 15,763 \\ \hline
Original Post & 56,797 \\ \hline
Post Reply & 1,515,618 \\ \hline
Post (Original+Reply) & 1,572,415 \\ \hline
Adopted Post & 88,240 \\ \hline
\end{tabular}
\end{table}
\end{document}
Hello everyone I am creating a table on latex my code looks like this:
\begin{table}[H]
\centering
\caption{caption}
\label{my-label}
\begin{tabular}{lll}
\hline
\multicolumn{3}{|c|}{\cellcolor[HTML]{34CDF9}{\color[HTML]{000000} Matriz confusión Genero.}} \\ \hline
\multicolumn{1}{|l|}{} & \multicolumn{1}{l|}{M} & \multicolumn{1}{l|}{F} \\ \hline
\multicolumn{1}{|l|}{M} & \multicolumn{1}{l|}{43} & \multicolumn{1}{l|}{7} \\ \hline
\multicolumn{1}{|l|}{F} & \multicolumn{1}{l|}{11} & \multicolumn{1}{l|}{39} \\ \hline
\end{tabular}
\end{table}
It works well but the problem comes when I try to fix the width of the columns I tried:
\begin{tabular}{l{2cm}|l{2cm}|l{2cm}}
The result is the same table, with variable length of columns, I would like to fix the length of the columns, I would like to appreciate any suggestion to solve this problem.
Consider the following code:
\documentclass[a4paper]{article}
\usepackage{}
\begin{document}
\begin{table}%[H]
\centering
\caption{caption}
\label{my-label}
\begin{tabular}{|p{20mm}|p{15mm}|p{10mm}|}
\hline
% \multicolumn{3}{|c|}{\cellcolor[HTML]{34CDF9}{\color[HTML]{000000} Matriz confusión Genero.}} \\ \hline
\multicolumn{3}{|c|}{Matriz confusión Genero.} \\ \hline
& M & F \\ \hline
M & 43 & 7 \\ \hline
F & 11 & 39 \\ \hline
\end{tabular}
\end{table}
\end{document}
that outputs the following table:
You may be interested in particular in the line
\begin{tabular}{|p{20mm}|p{15mm}|p{10mm}|}
implementing paragraph alignment for the contents of a column of given width (here 20, 15 and 10 mm respectively).
To make it simpler, you should just get rid of all of those \multicolumn{1}{}{} and change
\begin{tabular}{l{2cm}|l{2cm}|l{2cm}}
to
\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|}