Hi Reddy, you could try the resizebox option, here is an example: \begin{table} \centering
esizebox{\columnwidth}{!}{% \begin{tabular}{r|lll} \multicolumn{1}{r}{} & \multicolumn{1}{l}{Heading 1} & \multicolumn{1}{l}{Heading 2} & \multicolumn{1}{l}{Heading 3} \\ \cline{2-4} Row 1 & Cell 1,1 & Cell 1,2 & Cell 1,3 \\ Row 2 & Cell 2,1 & Cell 2,2 & Cell 2,3 \end{tabular}% } \end{table} You can see the tabular environment is within the esizebox{X}{Y} environment where X is the width option and Y is the height option. The features in the example set X=\columnwidth which will make the table span the entire width of the page. Y=! will make it so that the height scales with the width so you only need to set one and your original proportions will be kept. Otherwise, you could customize both to your liking e.g. esizebox{3cm}{2cm}. I hope that helps!
Hi TJR . Thanks for making this video. A quick question though. How do you make a table of 4 columns where the first column is single but the other three are multi-columns with two smaller columns within each? I hope the question is clear enough... thanks.
I don't really understand what you mean by "the other three are multi-columns with two smaller columns within each?" Do you mean you want a row that spans the last 3 columns but not the first?
From my understanding you don't need to include any packages for multicolumn. I can run the table (after removing the colors) with only: \documentclass[11pt]{article} \begin{document} \begin{center} \setlength{\tabcolsep}{1cm}
enewcommand{\arraystretch}{1.5} \begin{tabular}{|c|c|c|p{3cm}|} \hline \multicolumn{4}{|c|}{Title of the table}\\ \hline \multicolumn{2}{|c|}{Category 1} & \multicolumn{2}{c|}{Category 2} \\ \hline \tiny A & B & C & Longer text here Longer text hereLonger text hereLonger text hereLonger text hereLonger text here \\ \hline E & F & G & H\\ \hline I & J & K & L\\ \hline M & N & O & P\\ \hline \end{tabular} \end{center} \end{document} If this code doesn't work for you then it could be that you don't have the full version of Latex installed.
I'm REALLY new to LaTeX. I'm working on a document about a particular topic in math that I'm interested in, and I need a table of values. I know how to format it and make it look how it's supposed to, but it's appearing at the top of the page instead of after the paragraph describing it on that same page. How can I make it appear after that paragraph instead of at the top of the page?
Good question! It is really simple, put your code for the table in between \begin{figure}[h] code for table \end{figure} The h in the bracket is an option that stands for "here" meaning that it will place the figure where it is in the tex file. Other options are t (top of page) and b (bottom of page). Fair warning though, you may have to play around with where the table is actually place in the tex file to get it to show up exactly where you want it. For example, if you place it below a paragraph too close to the end of the page it may show up on the next page etc. Just play around with it and you should find the solution. GOOD LUCK!
As a quick fix, just add \centering to the cell you want the text centered on. EX: \begin{tabular}{c|p{5cm}|c} A & \centering Longggggggggggggggggg centered text& B \end{tabular}
Hi Azmat, Thanks for the question. The simplest answer is to add one of the following commands into the cell whose text size you want to change: \tiny \scriptsize \footnotesize \small \large \Large \huge \Huge this list goes from smallest to biggest text size. There are of course many other ways. Hope that helps!
Thank you, aint no one else show the multicolumn stacked side by side like you did.
Just what I was looking for, thanks!
Thanks so so much. You helped me a lot. I have looked for a explanation about tables like yours a so time... Thanks again
Really awesome.. this is what i was looking for..superb..thanks
Thanks For Video Sir, Very informative Video
Thanks, TJR. I am struggling in fitting a big table on one page. Could you please show us how to do it?
Hi Reddy, you could try the resizebox option, here is an example:
\begin{table}
\centering
esizebox{\columnwidth}{!}{%
\begin{tabular}{r|lll}
\multicolumn{1}{r}{}
& \multicolumn{1}{l}{Heading 1}
& \multicolumn{1}{l}{Heading 2}
& \multicolumn{1}{l}{Heading 3} \\ \cline{2-4}
Row 1 & Cell 1,1 & Cell 1,2 & Cell 1,3 \\
Row 2 & Cell 2,1 & Cell 2,2 & Cell 2,3
\end{tabular}%
}
\end{table}
You can see the tabular environment is within the
esizebox{X}{Y} environment where X is the width option and Y is the height option. The features in the example set X=\columnwidth which will make the table span the entire width of the page. Y=! will make it so that the height scales with the width so you only need to set one and your original proportions will be kept. Otherwise, you could customize both to your liking e.g.
esizebox{3cm}{2cm}.
I hope that helps!
@@tjr1252 Many thanks, TJR.😁
More than grateful!
good vid 👍
Hi TJR . Thanks for making this video. A quick question though. How do you make a table of 4 columns where the first column is single but the other three are multi-columns with two smaller columns within each? I hope the question is clear enough... thanks.
I don't really understand what you mean by "the other three are multi-columns with two smaller columns within each?" Do you mean you want a row that spans the last 3 columns but not the first?
What are the packages we need to add for multi column command?
From my understanding you don't need to include any packages for multicolumn. I can run the table (after removing the colors) with only:
\documentclass[11pt]{article}
\begin{document}
\begin{center}
\setlength{\tabcolsep}{1cm}
enewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|p{3cm}|}
\hline
\multicolumn{4}{|c|}{Title of the table}\\
\hline
\multicolumn{2}{|c|}{Category 1} & \multicolumn{2}{c|}{Category 2} \\
\hline
\tiny A & B & C & Longer text here Longer text hereLonger text hereLonger text hereLonger text hereLonger text here \\ \hline
E & F & G & H\\ \hline
I & J & K & L\\ \hline
M & N & O & P\\ \hline
\end{tabular}
\end{center}
\end{document}
If this code doesn't work for you then it could be that you don't have the full version of Latex installed.
@@tjr1252 Thank you so much for the reply!
I'm REALLY new to LaTeX. I'm working on a document about a particular topic in math that I'm interested in, and I need a table of values. I know how to format it and make it look how it's supposed to, but it's appearing at the top of the page instead of after the paragraph describing it on that same page. How can I make it appear after that paragraph instead of at the top of the page?
Good question! It is really simple, put your code for the table in between
\begin{figure}[h]
code for table
\end{figure}
The h in the bracket is an option that stands for "here" meaning that it will place the figure where it is in the tex file. Other options are t (top of page) and b (bottom of page). Fair warning though, you may have to play around with where the table is actually place in the tex file to get it to show up exactly where you want it. For example, if you place it below a paragraph too close to the end of the page it may show up on the next page etc. Just play around with it and you should find the solution. GOOD LUCK!
Thomas J. Rivera Thanks so much! Especially for replying so quickly.
but now its figure not table ,i need table and when putting [t] or any practices not implement the code as table
brilliant
Thanks a lot.
How do I merge and center texts in the table at the same time?
As a quick fix, just add \centering to the cell you want the text centered on.
EX:
\begin{tabular}{c|p{5cm}|c}
A & \centering Longggggggggggggggggg centered text& B
\end{tabular}
How to change the text size in different cells of the table ?
Hi Azmat,
Thanks for the question. The simplest answer is to add one of the following commands into the cell whose text size you want to change:
\tiny
\scriptsize
\footnotesize
\small
\large
\Large
\huge
\Huge
this list goes from smallest to biggest text size. There are of course many other ways. Hope that helps!