I define an environment that changes the standard text shape (to \small and \itshape). I then add a table inside this environment and I would like it to have the same appearance as defined in the environment.
Is this possible without modifying the table separately? And if so, how? The same question would apply to a figure (or any other float) inside the environment. Also, it would be nice if the table would adjust to the smaller textwidth inside the environment (look at the table caption to see what I mean).
MWE:
\documentclass{article}
%define environment
\newcounter{examplecounter}
\newenvironment{example}{\small\begin{quote}%
\refstepcounter{examplecounter}%
\textbf{Example \arabic{examplecounter}}%
\quad%
\itshape%
}{%
\end{quote}%
}
\begin{document}
This is normal text.
\begin{example}
This is small and italics text.
\begin{table}[htp]
\centering
\begin{tabular}{lrr}
\hline
Parameters & Values & Description \\
\hline
$t$ & 2 & Time\\
$c$ & 0.01 & Bond coupon\\
\hline
\end{tabular}
\caption{This and the table contents should be small and italics
as well.}
\label{tab1}
\end{table}
\end{example}
\end{document}




tableenvironment is that it may float to a different part of the document so it goes to some lengths not to pick up the surrounding environment. If you want a local table using the current settings why not just usetabulardirectly? – David Carlisle Sep 26 '16 at 17:19tableenvironment. take a look at the linked answer to this question: How to influence the position of float environments like figure and table in LaTeX?. removing the floating aspect will automatically result in application of the local font size and text sidth. – barbara beeton Sep 26 '16 at 17:25\let\@parboxrestore\relax\let\@floatboxreset\relaxmight be all you need) but it would be massively complicated to make a floating environment pick up the evironment of the page it floats to (you would need to re-write the entire float mechanism) so if you are OK with a float on page 10 using a narrow width and italic font because it was saved in an environment on page 2, I could make an answer, }% – David Carlisle Sep 26 '16 at 17:35exampleenvironment or not. So none of the existing tables have to be rewritten. But it looks like an hack to me. As long as the number of existing tables is just a few dozens, I'd still rename them to another environment name, sayextable, to separate clearly the two types. – gernot Sep 26 '16 at 19:22