The tufts-book class provides a \sidenote-command with an optional offset parameter, that allows the sidenote to be vertically adjusted. I use biblatex' \footcite command to get citations in the margin. If a citation is near the bottom, the citation is below the text or runs off the page (code follows later):
Using the answer from this question I added a citation-command which allows for manual offset of the margin citation:
The problem is that
- you need to manually compute the offsets depending on baselineskips and number of lines of the citation
- Kerning between citation mark and (optional) punctuation cannot be handled by fnpct
The tufte-latex documentation states that the offset parameter of the \sidenote-command was specifically added when sidenotes run of the top or the bottom of the page, so I presume it is not possible the limit sidenotes to the text height.
My question: Is it possible to have a citation command that
- can be kerned with fnpct
- results in a margin citation
- can be passed an offset parameter (or adjusts its vertical offset appropriately)
If not, my current approach requires to pass an optional punctuation with which the citation mark should be kerned. The syntax is quite kludgy (see the following code). Does anyone have a better idea?
\documentclass[a4paper,nobib]{tufte-book}
\usepackage[autocite=footnote,style=verbose,backend=biber]{biblatex}
\usepackage{xparse}
\usepackage{xpatch}
\DeclareCiteCommand{\sidecitehelper}
{\usebibmacro{prenote}\toggletrue{blx@footnote}}
{\usebibmacro{citeindex}\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{cite:postnote}}
\newlength{\spc}
\DeclareDocumentCommand{\sjcitep}{ O{} O{0pt} m O{} }{%
\settowidth{\spc}{#4}%
\addtolength{\spc}{-1.8\spc}%
#4\hspace*{\spc}\sidecite<#2>[#1]{#3}%
}
\ExplSyntaxOn
\NewDocumentCommand\sidecite{D<>{}O{}omo}{%
\iftoggle{blx@footnote}%
{\cs_set_protected_nopar:Npn \__sct_wrapper:nn ##1 ##2 {\mkbibparens{##2}}}%
{\cs_set_protected_nopar:Npn \__sct_wrapper:nn ##1 ##2 {\sidenote[][##1]{##2}}}%
{\IfNoValueTF{#3}%
{\__sct_wrapper:nn{#1}{\sidecitehelper[#2]{#4}}}%
{\__sct_wrapper:nn{#1}{\sidecitehelper[#2][#3]{#4}}}}%
}
\ExplSyntaxOff
\makeatletter
\xpatchcmd{\@footnotetext}%
{\color@begingroup}
{\color@begingroup\toggletrue{blx@footnote}}
{}
{}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\vspace*{\fill}
Margin baselineskip: {\footnotesize\the\baselineskip}\\
Baselineskip: \the\baselineskip\\
Test sentence\sjcitep[6][-42pt]{springer}[.]
Test sentence\sjcitep[][-16pt]{springer}[,]
Test sentence\sjcitep[][-10pt]{springer} and so on and so on.
\end{document}
PS: I know my question is not very concise. I appologize. I don't know LaTeX very well and would like to avoid replacing all \footcite{}<punctuation>-commands with \sjcitep{}[<punctuation>].



\AdaptNotefor trying to add the kerning feature to other commands. See section 8 of the fnpct manual. Maybe that could be what you're looking for? – David R Apr 29 '17 at 09:10