[Tex/LaTex] Indent fancy quotation box in latex

indentationquoting

I want to write latex to implement below fancy quotation box as per solution Fancy Quotation Boxes in Latex.

enter image description here

However, I don't know how to indent the quotation box such as:

enter image description here

You may observe the quotes part of definition D has been indented, so it aligns with Definition D.

I update the code:

% <!-- language: latex --> Comment this line for avoid errors
\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{framed}
\usepackage[strict]{changepage}    

%Defining colour with different models.
\definecolor{mypink1}{rgb}{0.858, 0.188, 0.478}
\definecolor{mypink2}{RGB}{219, 48, 122}
\definecolor{mypink3}{cmyk}{0, 0.7808, 0.4429, 0.1412}
\definecolor{mygray}{gray}{0.8}

\definecolor{formalshade}{rgb}{0.95,0.95,1}    

\newenvironment{formal}{%
  \def\FrameCommand{%
    \hspace{1pt}%
    {\color{mygray}\vrule width 6pt}%
    {\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}

\subsubsection*{Definition Lists}

\textbf{Markdown Extra} has a special syntax for definition lists too: \newline

\noindent
\textbf{Term 1} \\
\noindent
\textbf{Term 2} \\
\indent \indent Definition A \\
\indent \indent Definition B \\

\noindent
\textbf{Term 3} \\

\indent \indent Definition C \\

\indent \indent Definition D \\

% indent quote blocks?
\begin{formal}
    part of definition D
\end{formal}    

\begin{formal}
\begin{quote}
    part of definition D
\end{quote}
\end{formal}

\end{document}

Best Answer

Well, I saw the page from where you took the code, I see what you do and... perhaps the list environment can be useful in this case. From the code of your MWE:

\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{framed}
\usepackage[strict]{changepage}    

%Defining colour with different models.
\definecolor{mypink1}{rgb}{0.858, 0.188, 0.478}
\definecolor{mypink2}{RGB}{219, 48, 122}
\definecolor{mypink3}{cmyk}{0, 0.7808, 0.4429, 0.1412}
\definecolor{mygray}{gray}{0.8}

\definecolor{formalshade}{rgb}{0.95,0.95,1}    

\newenvironment{formal}{
  \def\FrameCommand{
    \hspace{1pt}
    {\color{mygray}\vrule width 6pt}
    {\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
}

\newcounter{definitio}    

\begin{document}

\subsubsection*{Definition Lists}

\textbf{Markdown Extra} has a special syntax for definition lists too: \newline

\begin{list}{\textbf{Term} \textbf{\arabic{definitio}}}{\usecounter{definitio}\setlength{\labelwidth}{42.5pt}}
  \item bla bla bla
  \item bla bla bla
  \begin{list}{Definition \Alph{definitio}}{\usecounter{definitio}\setlength{\labelwidth}{60pt}\setlength{\leftmargin}{56pt}}
    \item  
    \item
  \end{list}
  \item  bla bla bla
  \begin{list}{Definition \Alph{definitio}}{\usecounter{definitio}\setlength{\labelwidth}{60pt}\setlength{\leftmargin}{56pt}}
    \item  
    \item 
  \end{list}
\end{list}

% indent quote blocks?

\begin{formal}
    part of definition D
\end{formal} 

\begin{formal}
  \begin{list}{}{\setlength{\labelwidth}{60pt}\setlength{\leftmargin}{56pt}}
    \item  part of definition D
  \end{list}
\end{formal}

\end{document}

As you can see I was trying to rebuild your MWE using list environment. Unfortunately the result is not exactly what you want. But I see the environment can help you with the indentation building nested environments with few adjustments in the formal environment I think.

The list environment is the base for the listing environments such as itemize or enumerate and works in the following way:

\begin{list}{label}{format parameters}
\item First item
\item Second item
    .
    .
    . 
\item Last item
\end{list}

where:

  • label specifies how items should be labeled. This argument is a
    piece of text that is inserted in a box to form the label. This
    argument can and usually does contain other LaTeX commands
    .
  • format parameters contains commands to change the spacing parameters for the list. An empty argument will select all default
    spacing which should suffice for most cases. The format parameters
    are:

  • \itemsep

  • \labelsep
  • \labelwidth
  • \leftmargin
  • \listparindent
  • \parsep
  • \parskip
  • \partopsep
  • \rightmargin
  • \topsep

Also you can create a new counter for automatic numbering, I used one in the preamble \newcounter{definitio} and I used again to define how to use it in the label argument of the list environments I used.

Anyway, I couldn't pause and restart the numbering of definitions as you did in your MWE. I can think that the counter \value can be used for this, but I have not tried. You can read more about counters here.