如何在 newlfm 信件的签名后放置参考书目?

如何在 newlfm 信件的签名后放置参考书目?

我正在写一封信,需要我引用大量新闻文章。很快发现脚注对我来说不起作用,因为脚注会占用比实际信件更多的空间,所以我选择了标准的文档末尾参考书目。问题:我无法正确呈现参考书目。所以这里有一个 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}

我希望我的参考书目位于签名之后,最好是单独一页,但放在\printbibliography签名之前\end{newlfm},虽然看起来不错,但会将其放在签名行之前,所以这不行。但是,将其放在 MWE 中当前的位置会导致参考书目呈现与信件其余部分完全不同的边距,底部边距(意味着丢失了几处引用),总体来说看起来很糟糕。

那么我该如何格式化\printbibliography才能解决这个问题?

答案1

好吧,结果是\restletter{} 有点有效,但一次只能处理一页,而我的参考书目不止一页。(是的,真的。)此外,\restlettera-e意味着您最多只能处理五页。但是,根据该命令进一步谷歌搜索让我找到了我需要的答案,这需要从模板本身借用一段代码。感谢上面的评论者 Elad Den;Toby Cubitt,他的网站给了我这个重要信息;还有 LaTeX 论坛用户 jaybz,他给了我最后一块

\closlfm模板中的命令newlfm插入签名部分,通常在行中执行。但是,您显然可以通过在执行一次后\end{newlfm}告诉它来覆盖它。因此,如果您在代码开头放置以下内容:\relax\newcommand

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

然后,您可以将\closelfm(请注意拼写;您可能想给它一个不同的名字,但我很懒)放在需要签名的地方,然后继续写附言。(在 Toby 的例子中,它是同行评审;在我的例子中,它是参考书目。)但是,格式仍然有点奇怪 - 我认为这是因为 的错误 - 因此我需要使用包中的命令\printbibliography来修复边距。我知道 和不相容,但使用 的内置命令并没有给我任何有意义的底部边距,至少 是这样。\newgeometrygeometrynewlfmgeometrynewlfm\printbibliography

这是新的 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}

这应该可以帮助任何想要在信件中添加附言的人newlfm,特别是长度不简单的信件。

答案2

我已经按照我的评论修复了您的 MWE。然后我添加了更多引用,最终理解了问题所在:之后\end{newlfm}格式和几何形状有点不可预测。

restlettera可以使用(或restletterb restletterc等等)来解决此问题,它允许您在新的页面中“重新启动”您的信件而无需格式化。

梅威瑟:

\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}

相关内容