I want to write latex to implement below fancy quotation box as per solution Fancy Quotation Boxes in Latex.
However, I don't know how to indent the quotation box such as:
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: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 theformal
environment I think.The
list
environment is the base for the listing environments such asitemize
orenumerate
and works in the following way:where:
label
specifies how items should be labeled. This argument is apiece 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 defaultspacing 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 thelabel
argument of thelist
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.