With regard to your first question (sidewaystable
which always rotates counter-clockwise) -- and quoting from p. 2 of the rotating
documentation:
If the ‘twoside
’ option has been given to the main document class
(either explicitly, or implicitly as in the default for book class),
the package will rotate sideways figures according to the page number
(this requires at least two passes through LaTeX). If you want the
‘twoside
’ option, but want the figures always in one direction, use
the ‘figuresright
’ or ‘figuresleft
’ options to the package.
While the quoted part uses the term "figures", the package options are also applicable for (sideways) tables.
\documentclass{book}
\usepackage[figuresright]{rotating}
\begin{document}
\begin{sidewaystable}
\centering
(Table content)
\caption{A table}
\end{sidewaystable}
\begin{sidewaystable}
\centering
(Table content)
\caption{Another table}
\end{sidewaystable}
\end{document}
Two simple examples showing two possibilities: one with mdframed
and the other one with tcolorbox
; the advantage of these packages over framed
is that they offer endless customization possibilities with a simple key=value
interface:
\documentclass{article}
\usepackage[a5paper,paperwidth=18cm]{geometry}% just for the example
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}% just to generate text for the example
\newmdtheoremenv[
hidealllines=true,
leftline=true,
innertopmargin=0pt,
innerbottommargin=0pt,
linewidth=4pt,
linecolor=gray!40,
innerrightmargin=0pt,
innertopmargin=-6pt,
]{examplei}{Example}
\newtcolorbox{exampleii}{
freelance,
breakable,
width=\dimexpr\textwidth+28pt\relax,
before=\par\vspace{\bigskipamount}\noindent,
enlarge left by=-14pt,
overlay unbroken and first={
\node[
anchor=north east,
inner xsep=8pt,
xshift=8pt,
rounded corners=5pt,
font=\bfseries,
fill=white] at ([xshift=-0.2cm]frame.north west) (tit) {\strut Example:};
\draw[
line width=3pt,
rounded corners=5pt,gray
] ([xshift=4pt]frame.north west) -- ([xshift=4pt]frame.south west);
},
overlay middle and last={
\draw[
line width=3pt,
rounded corners=5pt,gray
] ([xshift=4pt]frame.north west) -- ([xshift=4pt]frame.south west);
},
frame code={},
interior code={},
top=0pt,
bottom=0pt
}
\begin{document}
\lipsum[1]
\begin{examplei}
\lipsum[4]
\end{examplei}
\lipsum[4]
\begin{examplei}
\lipsum[1-2]
\end{examplei}
\lipsum[1-3]
\begin{exampleii}
\lipsum[4]
\end{exampleii}
\lipsum[1]
\begin{exampleii}
\lipsum[4-6]
\end{exampleii}
\lipsum[4-5]
\end{document}
The page layout was changed just for the example.
You can also take a look at the answer to Typesetting a definition for more examples and variations (the code in that answer can be easily adapted to produce the label "Example" instead of "Definition").
Best Answer