问题
我目前正在使用microtype
允许某些字符突出到边距的包,并且在典型使用中大部分情况下效果很好。但我一直在尝试它并发现对于上标,包microtype
似乎给了太多的余地,导致非常难看的突出。参见 MWE:
平均能量损失
\documentclass[a4paper,11pt,parskip = half*]{scrreprt}
\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true,stretch=10]{microtype}
\usepackage{filecontents,lipsum}
\usepackage[super]{cite}
% Not really 'essential' but your code should take this into account
% Also for easier demonstration of the problem
\newcommand\mcite[1]{\,$^[$\mcitehelp#1&\relax$^]$}
\let\svcite\cite
\def\mcitehelp#1\relax{%
\svcite{#1}\ifx\relax#2\relax%
\else$^,$\mcitehelp#2\relax\fi%
}
\let\cite\mcite
% References
\begin{filecontents}{samplebib.bib}
@article{testref1,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref2,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref3,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref4,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref5,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
\end{filecontents}
\begin{document}
\section{Citing and Bibliography test}
Single citations test\cite{testref1}. Multi citations test\cite{testref2,testref3}.
Protrusion is hard to test some words longgggg\mcite{testref1&testref2&testref3&testref4, testref5}.
\lipsum[1] % To see the protrusion more clearly
\bibliographystyle{plain}
\bibliography{samplebib}
\end{document}
请注意 Lipsum 文本中的正常突起,以及上标引用的突起。
问题
如何为上标文本设置类似的突出限制,尤其是考虑到我将引用括在方括号中?
答案1
我认为问题microtype
本身并不在于 。相反,TeX 段落形成算法只是遇到了困难。我看到有三个选项,尽管每个选项都有缺点:
重新定义
\mcitehelp
以包括\allowbreak
允许中间引用换行;雇用
sloppypar
相关段落;或重写该段落以避免出现这种情况。
这是 MWE,展示了前两种方法。
\documentclass[a4paper,11pt,parskip = half*]{scrreprt}
\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true,stretch=10]{microtype}
\usepackage{filecontents,lipsum}
\usepackage[super]{cite}
% Not really 'essential' but your code should take this into account
% Also for easier demonstration of the problem
\newcommand\mcite[1]{\,$^[$\mcitehelp#1&\relax$^]$}
\let\svcite\cite
\def\mcitehelp#1\relax{%
\svcite{#1}\ifx\relax#2\relax%
\else$^,\allowbreak$\mcitehelp#2\relax\fi%
}
\let\cite\mcite
% References
\begin{filecontents}{samplebib.bib}
@article{testref1,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref2,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref3,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref4,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
@article{testref5,
title = {Test title},
journal = {Test Journal},
author = {Test authors and others},
volume = {1},
year = {2016}
}
\end{filecontents}
\begin{document}
\section{Citing and Bibliography test}
Single citations test\cite{testref1}. Multi citations test\cite{testref2,testref3}.
Protrusion is hard to test some words longgggg\mcite{testref1&testref2&testref3&testref4, testref5}.
\begin{sloppypar}
Single citations test\cite{testref1}. Multi citations test\cite{testref2,testref3}.
Protrusion is hard to test some words longgggg\mcite{testref1&testref2&testref3&testref4, testref5}.
\end{sloppypar}
\lipsum[1] % To see the protrusion more clearly
\bibliographystyle{plain}
\bibliography{samplebib}
\end{document}