A fellow LaTeX user ran into a problem using quotations inside an itemize/enumerate environment. When using automatic quotation marks from csquotes at the beginning of an item, the quotation mark is not protruded properly into the "margin". Is there a way to fix this in a sustainable way?
Ideally, I am trying to find a solution which would consist of some code that I can include in the preamble of my document, following which every instance of \item "quotes" will automatically have the right protrusion.
Otherwise, I will have to manually change several hundred quotes in my document, which will be very painful.
LaTeX Version
pdfTeX 3.141592653-2.6-1.40.23 (TeX Live 2022/dev)
LuaLaTeX Version (This is what is used in this MWP, albeit it doesn't seem to make a difference)
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021)
Minimal Working example:
%!TEX TS-program = lualatex
\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{libertinus-otf}
\usepackage{lipsum}
\usepackage{csquotes} \MakeOuterQuote{"}
\usepackage{microtype}
\SetProtrusion
{ encoding = *}
{
% char right left
{.} = { , 1000},
{,} = { , 1000},
{«} = {1000, },
{»} = { , 1000},
{(} = {1000, },
{)} = { , 1000},
{-} = { , 500 },
\textquotedblleft
= {1000, },
\textquotedblright
= { , 1000},
\quotedblbase
= {1000, }
}
\begin{document}
\noindent
"\lipsum[1-1]"
\begin{enumerate}
\item First regular item, without quotations.
\item "Second item with quotation marks."
\item First multi-line item, contains content that is deliberately very, very long: "with multiple clauses that are designed to trigger a line break," so that it will wrap around and create multiple rows.
\item "Second multi-line item, but keep in mind it is different from the first since it is quoted. However it also contains content that is deliberately very, very long: with multiple clauses just like the first."
\item "Multiple quoted lines with a single item"
\item \leftprotrusion
"This is the second quoted line"
This is a third unquoted line.
\end{enumerate}
\end{document}
Attempts to fix:
Adding \items in the following way instead seems to fix the problem:
\item \leftprotrusion ``quotes''
However, this would mean a lot of manual adjustment. (As a side-note, this workaround also doesn't work in conjunction with csquotes
, meaning \item \leftprotrusion "something in quotes"
doesn't give the right result either.)
Best Answer
I don't have time for an explanation right now, so for now I'll just add the code. (If you read this after 2021-01-10 and this note has not been replaced by a proper explanation by now, feel free to remind me.)
Requires LuaLaTeX.