\documentclass[11pt]{article} \usepackage{verbatim} \usepackage{lmodern} \usepackage[utf8]{inputenc} \usepackage[margin=0.5in]{geometry} \usepackage{url} \setlength{\parindent}{0.0in} \setlength{\parskip}{0.1in} \raggedright \begin{document} \paragraph{R users:} Suppose you have a table (or matrix or dataframe) with a lot of text in a cell, such as the following. <>= bigmess<- data.frame( animal=c("I have done the state some service and they know it. No more of that. I pray you, in your letters, When you shall these unlucky deeds relate, Speak of me as I am. Nothing extenuate, Nor set down aught in malice." , "Elephant" , "primate", "puma") , x=sample(1:199, size=4, replace=FALSE)) bigmess$why<- rep("Aye", nrow(bigmess)) # Note that bigmess has three variables (columns): names(bigmess) @ If you print it out ``naïvely'' using xtable and Sweave, the table marches off your page and you don't even see all of the first column: <>= tmess<-xtable(as.matrix( bigmess)) print(tmess, include.rownames=FALSE) @ You could convert \texttt{bigmess} to a spreadsheet format such as Excel\textregistered{}; then you could highlight the "animal" column and specify ``wrap text.'' But suppose you prefer to do this in a reproducible way in R. Try the following. <>= align(tmess) <- c("r", "p{1.5in}", "c", "c") print(tmess, include.rownames=FALSE) @ \begin{verbatim} Sweave("foo.Rnw") texi2dvi("foo.tex", pdf = TRUE) \end{verbatim} Jacob Wegelin \linebreak{} Thanks to \scriptsize{} \url{http://stackoverflow.com/questions/2686320/how-to-put-a-newline-into-a-column-header-in-an-xtable-in-r/2687142#2687142}. \normalsize{} % Sweave("foo.Rnw") % texi2dvi("foo.tex", pdf = TRUE) \end{document}