I am trying to create a new environment that works similar to the {\bfseries } command.
For example:
\documentclass{report}
\usepackage{rotating}
\newenvironment{stext}
{\begin{sideways} \bfseries \raggedleft }
{\end{sideways}}
\begin{document}
\begin{stext}
This is an example environment.
\end{stext}
\end{document}
In the above example, I want to redefine the stext environment so that it works as follows:
{\stext This is an example environment.}
Here is the use case for this new environment:
\documentclass{article}
\usepackage{rotating}
\usepackage{array}
\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces
}
\begin{document}
\begin{tabular}{$l^c^r}
\rowstyle{\rotatebox{-90}}% <- I know, the usage is wrong.
abc & abc & abc\\
b & b & b \\
c & c & c \\
\end{tabular}
\end{document}
The aim here is to get the text in the first row sideways so that they don't occupy as much width. For the \rowstyle command to work properly, I need an environment which can be invoked like so:
{\rotatetext Rotated text}

stextenvironment in the MWE. – Adi Feb 14 '12 at 18:23\rowstylecommand here takes formatting commands in the form{\formatting Text goes here}. I cannot use abegin{environment}-\end{environment}construct here. – Adi Feb 14 '12 at 18:31\rowstyle. Consider\rotateboxinstead of thesidewaysenvironment. – egreg Feb 14 '12 at 18:38\rotateboxhelps in this case. – Adi Feb 14 '12 at 18:55