Code: Select all
\documentclass{book}
\usepackage{xcolor}
%---------------------- Highlight ----------------------
%Framed box that can be splitted across page.
\usepackage{framed}
\renewenvironment{leftbar}[1][\hsize]{%
\def\FrameCommand{{%
\color{red!70}\vrule width 5pt}%
\hspace{0pt}%must be set to 0.
\fboxsep=\FrameSep\colorbox{cyan!15%
}}%
\MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}}%
{\endMakeFramed}%
%
\newenvironment{HL}[1][\textwidth]%
{%
\par\nointerlineskip\vspace{\baselineskip}%
\begin{leftbar}[#1]%
\noindent\small%
\ignorespaces%must be put right before the contents.
}
{%
\end{leftbar}%
%\ignorespacesafterend
\par\nointerlineskip\vspace{\baselineskip}%
}
\def\dummytext{Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.}
\begin{document}
\dummytext
\begin{HL}
\dummytext
\end{HL}
\begin{itemize}
\item \dummytext
\begin{HL}[\linewidth]
\dummytext
\end{HL}
\item \dummytext
\end{itemize}
\end{document}
I have an HL (highlighting) environment inside an itemize environment.
I don't want the itemize alignment to interfere the HL alignment.
My idea is to pause the itemize alignment temporarily before entering HL and resuming it after exiting HL.
My question is how to do that?
Thank you in advance.
regards,
Yuko.