4

Very new to this. Have written something like this:

\begin{threeparttable}

..... table contents....


\end{tabular}
   \begin{tablenotes}[flushleft]
     \small
\item table comment 1
\item table comment 2
\item blah blah comment 3
   \end{tablenotes}
 \end{threeparttable}

I wanted the notes to be flush left against the left edge of table, which it has done, but it is misagligned - there is a space before the first character of the first line of each note, the second line is aligned further left.

So looks like this:

    table comment 1..........

 table 1 comment continued (spans two lines)

    table comment 2

I want the notes to line up left in a straight line.

Also, anyway to put a small space between the notes? Thanks for any help!

1
  • 3
    Welcome to TeX.SE! I've taken the liberty of editing your posting by indenting all lines of code by four spaces; doing so automatically pretty-prints them. A suggestion: Don't post just some relevant code snippets, but an entire MWE -- minimum working example, starting with \documentclass and ending with \end{document} -- that generates the problem behavior you're looking to fix. Having such an MWE to work with greatly simplifies the task of finding out what's going on and how to provide a fix.
    – Mico
    May 29, 2014 at 4:40

2 Answers 2

6

\item[<marker>] without the optional marker argument uses an empty marker as default. The marker is put into \tnote, more or less a wrapper for \textsuperscript (an empty superscript in math mode). Then \item appends the space \labelsep.

In short we have: $^{}$\kern\labelsep

The first adds space \scriptspace (see "The TeXbook", "Appendix G. Generating Boxes from formulas", rule 18c). The amount is 0.5 pt. \labelsep is 0.2em or about 2 pt. Thus the overall space is about 2.5 pt.

The space can therefore be removed by:

\item
  \leavevmode
  \kern-\scriptspace
  \kern-\labelsep

The following example also adds some vertical space between the notes, by patching \TPTdoTablenotes:

\documentclass{article}
\usepackage{threeparttable}
\usepackage{etoolbox}

\makeatletter
\patchcmd\TPTdoTablenotes{%
  \TPTnoteSettings
}{%
  \TPTnoteSettings
  \setlength{\itemsep}{2ex}%
}{}{\errmessage{Patching \noexpand\TPTdoTablenotes failed}}
\makeatother

\begin{document}
\begin{threeparttable}
\begin{tabular}{ll}
1&a\tnote{a}\\2&b\tnote{b}\\3&c\\
\hline
\end{tabular}
\begin{tablenotes}[flushleft]
\small
\item[a] table comment~1
\item[b] table comment~2
\item \leavevmode\kern-\scriptspace\kern-\labelsep table comment~3
\end{tablenotes}
\end{threeparttable}
\end{document}

Result

4
  • I think -- but I could be wrong! -- that what the OP wants is some indentation of continuation lines of table footnotes, so that the text part is uniformly indented.
    – Mico
    May 29, 2014 at 9:14
  • @Mico: The OP said "straight" line. But additionally he wants additional vertical spaced, which I now have addressed by the updated answer. May 29, 2014 at 9:28
  • 1
    The space for separating the table note mark seems not exactly \, -- the first line of 'table comment 3' in the output above still isn't exactly flush left. Using \item\hspace{-2.5pt}table comment~3 made it appear exactly flush left, regardless of font size or shape. Maybe it's -2.5pt? Sep 18, 2014 at 16:32
  • @YangchenLin Yes, you are right. With a finer analysis I now get as horizontal indentation space: \scriptspace + \labelsep (= 2.49997 pt). Answer fixed. Sep 18, 2014 at 17:38
1

I have adapted Heiko Oberdiek answer to something simpler that won't work properly with \tnote though. The magic number 2.49997 as pointed by Heiko comes from \scriptspace + \labelsep

All I did was to set the label indent to a negative value and added \\ at end of the line to get the extra space, but any vertical spacing can be used (like \vspace{0.5pt).

This isn't pretty and I strongly recommend you use booktabs package to get nicer tables.

labelsep to the left

\documentclass{article}
\usepackage{threeparttable}
\begin{document}
\begin{table}[]
\begin{threeparttable}
\begin{tabular}{|c|c|c|}
\hline 
something &  &  something else \\ 
\hline 
 & & \\ 
\hline 
\end{tabular}
   \begin{tablenotes}[flushleft]
        { %this is to restrict the following commands to this group of tablenotes
        \setlength{\itemindent}{-2.49997pt}
        \small
\item table comment 1 \\
\item table comment 2, a very very very very long comment \\
\item blah blah comment 3 %if you supress the \\ then lines have default spacing
\item blah blah comment 4
} %end the group
   \end{tablenotes}
 \end{threeparttable}
 \end{table}
\end{document

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .