2

I'm writing a letter that requires me to cite a non-trivial number of news articles right now. After quickly discovering that footnotes were not going to work for me, because the footnotes would take up more space than the actual letter, I went with a standard end-of-document bibliography. Problem: I can't get the bibliography to render properly. So here's a MWE:

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\usepackage[style=ieee]{biblatex} % for numeric citations

% I hope this is right? I use a separate file.
\begin{filecontents}{dummy.bib}
    @misc{foo1,
        author={Q. Tip},
        date={2019-07-02},
        title={{Don't Stick That In Your Ear}},
        url={https://www.youllgodeaf.com/}}
    @misc{foo2,
        author={C. Cup},
        date={2019-07-02},
        title={{Tasty Bean Juice}},
        url={https://www.coffee.com/}}
    \end{filecontents}
\addbibresource{dummy.bib}

\newlfmP{dateskipbefore=50pt}
\newlfmP{sigsize=50pt}
\newlfmP{sigskipbefore=50pt}
\newlfmP{Headlinewd=0pt,Footlinewd=0pt}

\namefrom{Santa Claus}
\addrfrom{%
    555 Main St \\
    North Pole \\
    H0H 0H0
}

\addrto{
    Parliament Hill \\
    Ottawa, ON \\
    Canada \\
}

\dateset{July 2, 2019}
\greetto{Dear Dave,}
\closeline{Sincerely,}

\begin{document}
\begin{newlfm}

Say some stuff \cite{foo1} then some more stuff \cite{foo2} then a bunch more stuff.

\end{newlfm}
\printbibliography
\end{document}

I want my bibliography to be after my signature, preferably on a separate page, but putting \printbibliography before the \end{newlfm}, while it looks fine, places it before the signature line, so that's out. However, placing it where it currently is in the MWE causes the bibliography to render with completely different margins to the rest of the letter, with no bottom margin (meaning several citations get lost), and just generally looks bad.

So how do I format \printbibliography in order to fix this?

  • 1
    Hi and welcome! It's not that the printbibliography doesn't work as much as the MWE does not compile. Take a look at this solution:tex.stackexchange.com/questions/377454/… Also, your bibfile is missing a coma in foo1 before the url – Elad Den Jul 2 at 15:31
  • Oh shoot, I keep doing that when I make the entries, too. I edited it to fix it. Thanks! – Doogie2K Jul 2 at 16:48
3

Okay, so it turns out that \restletter{} sort of works, but only for one page at a time, and my bibliography is more than one page. (Yes, really.) Also, \restlettera-e means you're at five pages max. However, Googling further based on that command led me to the answer I needed, which involved borrowing a piece of code from the template itself. Thanks to commenter Elad Den above; Toby Cubitt, whose website gave me this vital information; and LaTeX forum user jaybz, who gave me the last piece.

The command \closlfm, from the newlfm template, inserts the signature piece, and is usually executed at the \end{newlfm} line. However, you can apparently override this by telling it to \relax once you've done it once. So if you put the following \newcommand at the start of your code:

\newcommand\closelfm{\closlfm\let\closlfm\relax}

You can then put \closelfm (note the spelling; you may want to give it a different name but I was lazy) wherever you need your signature to be, and then carry on with your postscript. (In Toby's case, it was a peer review; in mine, a bibliography.) However, the formatting was still a bit wonky -- I think that's \printbibliography's fault -- so I needed to fix the margins using the \newgeometry command from the geometry package. I'm aware that newlfm and geometry don't get along with each other, but using newlfm's built-in commands didn't give me any meaningful bottom margin, at least with \printbibliography.

Here's the new MWE.

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\usepackage[style=ieee]{biblatex} % for numeric citations
\usepackage{geometry} % New
\newcommand\closelfm{\closlfm\let\closlfm\relax} % New

\begin{filecontents}{dummy.bib}
    @misc{foo1,
        author={Q. Tip},
        date={2019-07-02},
        title={{Don't Stick That In Your Ear}}, % Corrected
        url={https://www.youllgodeaf.com/}}
    @misc{foo2,
        author={C. Cup},
        date={2019-07-02},
        title={{Tasty Bean Juice}},
        url={https://www.coffee.com/}}
    \end{filecontents}
\addbibresource{dummy.bib}

\newlfmP{dateskipbefore=50pt}
\newlfmP{sigsize=50pt}
\newlfmP{sigskipbefore=50pt}
\newlfmP{Headlinewd=0pt,Footlinewd=0pt}

\namefrom{Santa Claus}
\addrfrom{%
    555 Main St \\
    North Pole \\
    H0H 0H0
}

\addrto{
    Parliament Hill \\
    Ottawa, ON \\
    Canada \\
}

\dateset{July 2, 2019}
\greetto{Dear Dave,}
\closeline{Sincerely,}

\begin{document}
\begin{newlfm}

Say some stuff \cite{foo1} then some more stuff \cite{foo2} then a bunch more stuff.

% Added new.
\closelfm
\newpage
\newgeometry{hmargin={1in,1in},vmargin={1in,1in}}
\printbibliography

\end{newlfm}
\end{document}

This should help with anyone who wants to add a postscript to a newlfm letter, particularly one of non-trivial length.

1

I've fixed your MWE as stated in my comment. I then added many more citations and finally understood the problem: after the \end{newlfm} the formatting and geometry are a bit unpredictable.

This can be fixed by using restlettera (or restletterb restletterc and so on) which allows you to "restart" your letter in a new page without the formatting.

MWE:

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\usepackage[style=ieee]{biblatex} % for numeric citations

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@zfancyhead}{\fancy@reset}{\f@nch@reset}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyorh}{\f@nch@orh}{}{}
\makeatother

% I hope this is right? I use a separate file.
\begin{filecontents}{dummy.bib}
    @misc{foo1,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo2,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo3,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo4,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo5,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo6,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo7,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo8,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo9,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo10,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo11,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo12,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo13,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo14,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo15,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo16,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo17,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo18,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }
    @misc{foo19,
        author={Q. Tip},
        date={2019-07-02},
        title={Don't Stick That In Your Ear},
        url={https://www.youllgodeaf.com/}}
    @misc{foo20,
        author={C. Cup},
        date={2019-07-02},
        title={Tasty Bean Juice},
        url={https://www.coffee.com/}
        }        
\end{filecontents}
\addbibresource{dummy.bib}

\newlfmP{dateskipbefore=50pt}
\newlfmP{sigsize=50pt}
\newlfmP{sigskipbefore=50pt}
\newlfmP{Headlinewd=0pt,Footlinewd=0pt}

\namefrom{Santa Claus}
\addrfrom{%
    555 Main St \\
    North Pole \\
    H0H 0H0
}

\addrto{%
    Parliament Hill \\
    Ottawa, ON \\
    Canada
}

\dateset{July 2, 2019}
\greetto{Dear Dave,}


\begin{document}
\closeline{Sincerely,}
\begin{newlfm}

Say some stuff \cite{foo1} then some more stuff \cite{foo2,foo3,foo4,foo5,foo6,foo7,foo8,foo9,foo10,foo11,foo12,foo13,foo14,foo15,foo16,foo17,foo18,foo19,foo20} then a bunch more stuff.

\restlettera{
\printbibliography
}
\end{newlfm}


\end{document}
  • 2
    +1 In order to save you some typing in future answers you can use biblatex-examples.bib as an example .bib file. It is installed on all systems that have biblatex installed and is found automatically by Biber and BibTeX. – moewe Jul 2 at 15:49
  • 1
    I looked into restletter{} and it turns out it can only handle one page at a time. Knowing about restletter{} led me to this webpage [dr-qubit.org/…, which finally gave me the solution, which I'll explain in my own answer. – Doogie2K Jul 2 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.