# altering the orientation of column headers

I would like to generate a table that has each column header displayed sideways. For example:

\documentclass{article}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}
\begin{tabular}{cccc}
Name & Location & Latitude & Longitude\\
name1 & loc1 & lat1 & lon1\\
name2 & loc2 & lat2 & lon2\\
\end{tabular}
\end{sidewaystable}
\end{document}


From this example I would like the first 4 arguments (i.e. the column headers) to be orientated vertically. How can this be achieved?

-

Like in this answer you can use the \rotatebox:

\documentclass{article}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}
\begin{tabular}{cccc}
\rotatebox{-90}{Name} & \rotatebox{-90}{Location} & \rotatebox{-90}{Latitude} & \rotatebox{-90}{Longitude}\\
name1 & loc1 & lat1 & lon1\\
name2 & loc2 & lat2 & lon2\\
\end{tabular}
\end{sidewaystable}
\end{document}


-
Great. One more question: say if one of the cell entries was really long for example if instead of 'Latitude' I would have 'Latitude at a location', how could I separate that cell entry over two lines? So have 'Latitude' and then 'at a location' in the same cell but extending over two lines? – Andy Aug 4 '12 at 8:56
@Andy: Use \rotatebox{-90}{\parbox{2cm}{Longitude \\ at a location}}. – Harish Kumar Aug 4 '12 at 16:00