1. […] and MacTex… A table ususally has the following structure (for an introduction to tables click here) with the “small”- environment added to slightly decrease its size: begin{table}[htdp] […]

2. […] font size. E.g. begin{footnotesize} begin{floatingtable} … end{footnotsize} Check this post for an introduction to […]

3. Lavinia

Hi,

I am trying to change the “title” of a table in Latex. You know that first part of the tile: “Table 1: —–“. I want this “Table” to disappear or to replace it with something else. Is there any way that I can do that?

Thanks,
Lavinia

• Hi Lavinia,

Try the caption package:

\usepackage{caption}

\captionsetup{tablename=Tab.}

for “Tab.” instead of “Table” and similarly for figures:

\captionsetup{figurename=Fig.}

Source: Caption documentaton

Cheers,
Tom

4. TeXin

I am using LaTeX to make some reports, one problem I am having is with Tables, the headings to the tables are quite long. Right now I use the tabularx package, when I compile I get underfull hbox badness 10000, I know it will still work but I want LaTeX to compile with no warnings. A minimal example is given below.

\documentclass[a4paper,10pt]{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[H]
\centering
\begin{tabularx}{\linewidth}{ |X|X|X|X|}
\hline
Long Name &amp; Long Name&amp; Long Name &amp; Very Long Namesssdsdsdsdsdsdsdssdsdsdsdsdsdsdsssdsds \\
\hline
1 &amp; 2.3 &amp; 30.3 &amp; 36\\
\hline
2 &amp; 8.6 &amp; 10.4 &amp; 17\\
\hline
3.5 &amp; 18.2 &amp; 5.2 &amp; 12\\
\hline
5 &amp; 28.2 &amp; 3.4 &amp; 6\\
\hline
\end{tabularx}
\end{table}
\end{document}
• Hi!

Thanks for your question and the minimal working example. As you already pointed out, the problem lies with the very long names of the column headings. I suggest you try the microtype package. Loading that packages possibly resolves most of the warnings. Otherwise, you can enforce how LaTeX splits long names using:

\hyphenation{}

Hope it helps,
Tom.

5. TeXin

Hi Tom,

Thanks, it fixed it up, however I have decided to make the shift to the booktabs table, it looks much more professional. However another problem with the long names in booktabs is Overfull hbox badness 10000, sometimes I get this when placing figures side by side, any assistance?

• Hey!

These warnings are relatively easy to fix. Use the documentclass option draft to highlight any “overfull hbox”. I suspect you are using 0.5\linewidth or 0.5\textwidth for two figures side-by-side. Just slightly reduce the size to e.g. 0.47\textwidth for both figures, since LaTeX add some space in between.

\usepackage{graphicx}
...
\includegraphics[width=0.47\textwidth]{filename}

Please provide a minimal working example again in case this does not solve your problem.

Thanks, Tom.

6. mero

Hello tom

I’m using lyx and I want to make word table bold and put caption below word table, also i want both word table and caption to be most left justified with left border of table , like this

Table1
This is table1 caption

what will be code to modify or steps in lyx

• Hi mero,

I’m sure you can do it in LyX. But since I never use LyX, here is how I would go about it.
Insert TeX code before and after your table:

% before
\begin{table}[ht]
\begin{bfseries}
%after
\end{bfseries}
\caption{Table caption text.}
\end{table}

Once that’s done, you’ll also need to align the caption which turns out a little more challenging, since you’ll need to load the caption package. Navigate to “Document –> Settings” and choose “LaTeX preamble”. Then paste the following line in the textbox:

\usepackage[singlelinecheck=off]{caption}

That did the trick for me. Hope it works for you!

Cheers, Tom.

7. Markus

Hi, I have a problem

\begin{table}
\begin{tabular}{l*3S[table-format=4.4]}
\toprule
\input{result1.tex}
\bottomrule
\end{tabular}
\end{table}

Result1.tex:

&amp;\multicolumn{1}{c}{(1)}&amp;\multicolumn{1}{c}{(2)}&amp;\multicolumn{1}{c}{(3)}\\
&amp;\multicolumn{1}{c}{Success}&amp;\multicolumn{1}{c}{Total}&amp;\multicolumn{1}{c}{Round1}\\
\midrule
main&amp;&amp;&amp;\\
Round1&amp;0.405\sym{***}&amp;&amp;\\
&amp;(0.121)&amp;&amp;\\
Gender&amp;0.167&amp;2.852\sym{**}&amp;0.336\sym{***}\\
&amp;(0.298)&amp;(1.177)&amp;(0.128)\\
Biology&amp;-0.695&amp;0.373&amp;0.047\\
&amp;(0.461)&amp;(0.422)&amp;(0.086)\\
Mathematics&amp;0.355&amp;-3.533&amp;-0.829\sym{***}\\
&amp;(0.595)&amp;(2.545)&amp;(0.221)\\
Economics&amp;0.195&amp;-1.535&amp;-0.140\\
&amp;(0.358)&amp;(1.308)&amp;(0.148)\\
Psychology&amp;0.471&amp;-0.011&amp;0.017\\
&amp;(0.608)&amp;(1.833)&amp;(0.248)\\
Law&amp;0.628&amp;0.638&amp;-0.257\\
&amp;(0.568)&amp;(2.058)&amp;(0.211)\\
Treatment&amp;0.722\sym{*}&amp;&amp;0.105\\
&amp;(0.411)&amp;&amp;(0.073)\\
Constant&amp;-1.935\sym{***}&amp;14.719\sym{***}&amp;1.527\sym{***}\\
&amp;(0.702)&amp;(1.343)&amp;(0.138)\\
\midrule
Observations&amp;234&amp;234&amp;234\\

I always get the error:

missplaced\noaligne.
\bottomrule-> noaligne

I can solve the problem by changing \input{result1.tex} to \input{result1.tex} \\

But then I have a empty line before the bottomrule and thats not what I want.

Anybody an idea?

• Hi Markus,

I recommend to place the entire table, not only the table content, into the file and try again. It works for me. Also, next time, please provide a minimal working example. I first had to google before I was able to run your code. It only works when using quite a substantial amount of additional code.

Cheers, Tom.

• Markus Karde

Thanks for your help Tom. It was the first time that I posted a problem in a forum like this one. Thats why I had no idea how I should really do it. Next time I will do it as you recommend. Thanks again. The problem is that the file result1.tex is provided from Stata.It’s important for me that it stays like this. But thats exactly the point. Isn’t it strange that it works when one puts everything in the file. I mean what else does the the input command do as just putting the code at it’s place. But that’s not working.

• Hi Markus,

Thanks for following up on your question. Not sure, why you get the error. Here is what works for me with your Stata output (result1.tex):

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{caption}
\newcommand{\sym}[1]{\rlap{#1}}%
\usepackage{siunitx} % centering in tables
\sisetup{
detect-mode,
tight-spacing		= true,
group-digits		= false ,
input-signs		= ,
input-symbols		= ( ) [ ] - + *,
input-open-uncertainty	= ,
input-close-uncertainty	= ,
table-align-text-post	= false
}
\let\estinput=\input%
\newcommand{\estauto}[3]{
\vspace{.75ex}{
\begin{tabular}{l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\end{tabular}
}
}
\begin{document}
\begin{table}
\estauto{result1.tex}{4}{l}
%\begin{tabular}{l*3S[table-format=4.4]}
%\toprule
%\input{result1.tex}
%\bottomrule
%\end{tabular}
\end{table}
\end{document}

I copied most of the code from this blog.

Your code (commented with %) also works. Give it a try!

Hope it helps. Tom.

8. Hello Tom,
I have a query. I want to make a table which is very long in terms of column. So I divided the whole thing into 2 parts. Now these are titled as Table 1 and Table 2. But how can I make them Table 1.(A) and Table 1.(B)…. Is there any way?

• Hi Arindam,

The longtable package does what you are looking for. You can find an example here.

Best, Tom.

• It’s so kind of you, I think I have got my answer……:) So quickly….

• Great! And good luck with the table… Tom.

9. himanshu sekhar panda

hi tom

In my pdf, why it is showing Tab. in place of Table.?

himanshu

• tom

Hi Himanshu,

This might be due to the document class or package you’re useing. Try adding this line to your preamble:

\renewcommand{\tablename}{Table}
• himanshu sekhar panda

Hi Tom

With your suggestion also, it is not showing TABLE.

Please do me a favour. I am about to submit my Ph.D. thesis.

PREAMBLE:

\documentclass[a4paper,12pt]{thesis}

** code removed by Tom **

• tom

Hi Himanshu,

Thanks for sending your preamble. It’s the thesis document class that defines \tableshortname to be “Tab.” and \figureshortname to be “Fig.” (on line 1092/3).

\def\figureshortname{Fig.}
\def\tableshortname{Tab.}

So, simply redefine these in your preamble, e.g.:

\documentclass{thesis}

\renewcommand{\tableshortname}{Table}

\begin{document}
\listoftables

\chapter{First chapter}
\begin{table}[ht]\caption{default}\centering
\begin{tabular}{|c|c|}\hline a&b\\\hline c&d\\\hline\end{tabular}
\end{table}%

\end{document}
• himanshu sekhar panda

Hi Tom

thanks a lot for your sweet solution. it worked.

Actually, I am a learner of LaTeX. I will need your help at times, if permitted….

Regards

himanshu

• tom

Sure, no problem! Feel free to drop me a comment, should you have other questions. However, please find an relevant article using the search field on the right. Also, I can help more efficiently when you provide a minimal example :).

Tom

10. tamonekolevi

Hi, does anyone now how to write words ‘figure’ and ‘table’ which looks like in amsart?
I think that all letters are capital letters, but only the first is large and the other are small.

• tom

They are using small capitals, provided by the \sc command.

Here’s a minimal working example where the list headings look similar to what amsart produces.

\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hfil\sc}
\renewcommand{\cftloftitlefont}{\hfil\sc}
\renewcommand{\cftlottitlefont}{\hfil\sc}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\end{document}

Hope this helps,
Tom

• tamonekolevi

Thanks!

I found that I can use \textsc{•} command, but example was helpful.

• tom

Tom

11. A. M. Alshuaib

I use a spreadtab package in tables. I try to enter a text column in it on which no calculation done, but it doesn’t work. Please any help!

• tom

Hi there,

Thanks for this question. You’ll have to use ‘@’ or ‘\STtextcell’ for text cells. Next time, please consider the package documentation before asking a question and/or provide a minimal example (see code below).

Best, Tom

\documentclass[11pt]{article}
\end{document}