1

This table comes from SAS output. The \newline is not working correctly. E.g. "Percent trimmed in tail" ought to be

Percent Trimmed In tail

but it is showing up as

Percent Trimmed In Tail

Here is a minimal example

\documentclass{article}
\usepackage{natbib}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{longtable}

\usepackage{array}
\usepackage{listings}
\usepackage{multicol}
\usepackage{url}
\lstloadlanguages{SAS} \lstset{language = SAS}

\begin{document}
 \begin{longtable}{|r|r|r|r|r|r|r|r|r|}\hline
   \multicolumn{9}{|c|}{Trimmed Means}\\\hline
   Percent {\newline} Trimmed \newline in Tail &    Number \newline Trimmed \newline in Tail &    Trimmed \newline Mean &    Std Error \newline Trimmed \newline Mean &    \multicolumn{2}{|c|}{95\%~Confidence~Limits} &    DF &    t for H0: \newline Mu0=0.00 &    Pr~>~|t|\\\hline
\endhead
   10.27 &    27 &    463.8867 &    25.08152 &    414.4401 &    513.3332 &    208 &    18.49516 &    <.0001\\\hline
\end{longtable}
\end{document}
  • 2
    You need a cell spec with p{<width>} for \newline to work. – Arash Esbati Jul 8 '15 at 20:47
  • 1
    If you want to have an explicit line break, use \thead for example (requires makecell). Is this an auto-generated table? – user31729 Jul 8 '15 at 20:47
  • Yes, the table was generated by SAS, but not quite correctly, apparently. – Peter Flom Jul 8 '15 at 20:57
  • @Peter Flom: No, not really. The math LaTeX is weird ;-) And I've got no idea what SAS is at all. – user31729 Jul 8 '15 at 20:59
  • 1
    I should correct myself, \makecell is sufficient. – user31729 Jul 8 '15 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.