1) a verse like environment
2) with a variable right margin, to prevent certain linebreaks
3) the env should have one optional argument that increases or
decreases the right margin
4) the default value of this argument is 0pt, i.e. no modification of
margins
5) everything within this env is bold
margin manipulation is provided by the "changepage" package. Its
"adjustwidth" environment takes two required length arguments:
\begin{adjustwidth}{hleftmargini}{hrightmargini}
A positive length value will increase the relevant margin (shortening
the text
lines) while a negative length value will decrease the margin
(lengthening text
lines).
So I tried the following:
\newenvironment{varioquote}[1][0pt]{\begin{quote}%
\begin{adjustwidth*}{0pt}{#1}\bfseries}%
{\end{adjustwidth*}%
\end{quote}}
Yet, when I say:
\begin{varioquote}{-2em}
TEXT TEXT...
\end{varioquote}
in order to reduce the right margin by 2em, this does not work;
instead "-2em" is printed our literally (not recognized as an argument
to the environment)! What is wrong with my definition?
Thanks,
Antis.
> Hello,
> I'm trying to define a new latex environment with the following
> characteristics:
[...]
> Yet, when I say:
>
> \begin{varioquote}{-2em}
> TEXT TEXT...
> \end{varioquote}
>
> in order to reduce the right margin by 2em, this does not work;
> instead "-2em" is printed our literally (not recognized as an argument
> to the environment)! What is wrong with my definition?
I guess the definition is fine, but optional args don't have curlies.
Without having tried, I'd guess that
\begin{varioquote}[-2em]
will work just fine.
HTH
Ulrich
Ah! yes indeed, that was the problem: options to newly defined
environments do go in brackets!
I was misled by the tabular environment (and its options in curlies).
Thanks for your help!
Antis
> On 7 Mrz., 08:03, "Ulrich M. Schwarz" <brother...@gmx.net> wrote:
Well, yes and no. _Optional_ arguments always go in brackets, _mandatory_
arguments always go in curlies.
But you cannot have a mandatory argument with a default value, because the
default would never be used.
tabular needs the specification of the columns because there's no
reasonable default. If you omit the default specification [0pt] in your
definition, #1 will turn into a mandatory argument and you'll have to put
it in curlies.
HTH
Ulrich