0

In an earlier question, I defined a modified version of the quoting environment using \tcolorboxenvironment.

But now I want a different, and hopefully better, modified version of the quoting environment, while leaving the original altered version in place for backward compatibility purposes.

I thought I'd called the second one boxquoting. And I also want to redefine it using \tcolorboxenvironment.

It seems like first making a copy of the quoting environment called boxquoting, and then altering that using \tcolorboxenvironment was the correct approach.

Does the following example test code look correct?

I used Duplicating Environments and When to use \LetLtxMacro? for reference.

The upshot seems to be that using \LetLtxMacro is best from a defensive point of view, though I did not understand the nuances.

\documentclass[12pt]{article}

\usepackage{quoting}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\usepackage[most]{tcolorbox}
\usepackage{letltxmacro}

% Keep this modified version for backwards compatibility

\tcolorboxenvironment{quoting}{
  code={\mbox{}},nobeforeafter,
  boxrule=2pt,sharp corners,breakable,skin=enhanced,colback=white}

% Now want to create a different environment, also based on the
% quoting environment, called boxquoting.

% First, make a copy of the quoting environment called
% boxquoting.

\LetLtxMacro\boxquoting\quoting
\LetLtxMacro\endboxquoting\endquoting

% Then modify it with \tcolorboxenvironment

\tcolorboxenvironment{boxquoting}{
  beforeafter skip=\baselineskip,
  boxrule=2pt,sharp corners,breakable,skin=enhanced,colback=pink}

\begin{document}

Some text.
\begin{quoting}
  Original modified quoting environment
\end{quoting}
Some more text.\\
And yet more.\\
And yet more.
\begin{boxquoting}
  New modified box quoting environment.
\end{boxquoting}
Yes more text.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.