I am trying to make my own environment for (left-)indented blocks inside hanging footnotes, in which the normal quote
environment doesn't work, it's left indent being the same as that of the indent of the footnote, so that one doesn't see it. I am now trying to do to this with the adjustwidth environment, which does the indentation as I want it, but it inserts horizontal spaces before and after the environment if there's nothing before or after it in the footnote, a behaviour which the quote
environment also seems to have.
I tried to adapt the solution suggested here, but the \compress
didn't seem to do anything, and the negative \vspace
after the environment would pull the next line, if there was one, into last line of the environment.
\documentclass{memoir}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\setlength{\footmarkwidth}{\leftmargin}
\setlength{\footmarksep}{0em}
\footmarkstyle{#1\hfill}
\newenvironment{fnquote}[1][]{\compress\ifx\\#1\\\begin{adjustwidth}{1.5\leftmargin}{}\else\begin{adjustwidth}{1.5\leftmargin}{}[#1]\fi}{\end{adjustwidth}\vspace{-\lastskip}\vspace{-\baselineskip}\leavevmode}
\begin{document}
Some text\footnote{Enough text to be two lines in the footnote. Enough text to be two lines in the footnote. Enough text to be two lines in the footnote.
\begin{adjustwidth}{1.5\leftmargin}{}
And here we have a quote inside the footnote. With some text before or after it it looks fine, but ...
\end{adjustwidth}
Some text after the quote.
}
\footnote{
\begin{adjustwidth}{1.5\leftmargin}{}
If I have a footnote starting or ending with a quotation I get an empty line, before or after, which I don't want.
\end{adjustwidth}
}
\footnote{
\begin{fnquote}
If I have a footnote starting or ending with a quotation I get an empty line, before or after, which I don't want.
\end{fnquote}
And some more text here.
}
\footnote{Just another footnote.}
\end{document}
Is there maybe another switch I could use to trick the environment into thinking there was some text before and after it in the footnote?
Best Answer
I'm not sure this is really what you want: the result is just wrong, nobody will understand why the text in the second and third footnote is shifted right.
The problem is that any footnote has two implicit struts at the beginning and end; when
fnquote
appears at the beginning, it does a\par
and so the strut forms a paragraph by itself. Similarly, if no text followsfnquote
, the final strut makes a paragraph by itself.I measure the last typeset line and if it is longer than
\leftmargin
, it means it has text; otherwise I back up what's necessary.For quotes ending the footnote, it's necessary to use a different environment
fnquote*
that backs up by a baselineskip.