2

I'm using the code below (which I got off this website: https://jevon.org/wiki/Fancy_Quotation_Boxes_in_Latex) to generate this formal box

I want to have the left-hand vertical bar repeated on the right-hand side of the box, but I'm not sure how to modify the code. Any help would be appreciated. Thanks in advance.

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color, colortbl}
\usepackage{changepage}
\usepackage[english]{babel}
\usepackage{lipsum}
% for formal definitions
\usepackage{framed}
% environment derived from framed.sty: see leftbar environment definition
\definecolor{formalshade}{rgb}{0.95,0.95,1}
\definecolor{darkblue}{rgb}{0.0, 0.0, 0.55}

\newenvironment{formal}{%
  \def\FrameCommand{%
    \hspace{1pt}%
    {\color{darkblue}\vrule width 2pt}%
    {\color{formalshade}\vrule width 4pt}%
    \colorbox{formalshade}%
  }%
  \MakeFramed{\advance\hsize-\width\FrameRestore}%
  \noindent\hspace{-4.55pt}% disable indenting first paragraph
  \begin{adjustwidth}{}{7pt}%
  \vspace{2pt}\vspace{2pt}%
}
{%
  \vspace{2pt}\end{adjustwidth}\endMakeFramed%
}

\begin{document}

\begin{formal}
    \textit{``\lipsum[1]''}
\end{formal}

\end{document}
1

1 Answer 1

2

I'd use tcolorbox insted of framed and define the box as shown in the following example: enter image description here

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\definecolor{formalshade}{rgb}{0.95,0.95,1}
\definecolor{darkblue}{rgb}{0.0, 0.0, 0.55}

\newtcolorbox{mybox}{
    enhanced,
    boxrule=0pt,
    frame hidden,
    borderline west={2pt}{0pt}{darkblue},
    borderline east={2pt}{0pt}{darkblue},
    colback=formalshade,
    sharp corners, 
    fontupper=\itshape
    }
\begin{document}

\begin{mybox}
``\lipsum[1]''
\end{mybox}

\end{document}
3
  • Awesome, thanks leandriis! May 13, 2021 at 13:14
  • @JonathanNewman: Glad I was able to help you. If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓).
    – leandriis
    May 13, 2021 at 13:25
  • I made it the accepted answer but unfortunately, I do not have enough reputation points to upvote your answer. Thanks again! May 14, 2021 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .