Forked from yuw/gist:48764995abf8ed7ab3525fb34fec107f
Created
April 12, 2018 10:50
-
-
Save trueroad/80630e95df5af0234e36270b019e6458 to your computer and use it in GitHub Desktop.
参考文献の行長を字幅の整数倍にする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[twocolumn]{jlreq} | |
\makeatletter | |
\renewenvironment{thebibliography}[1]{% | |
\jlreq@oldfontcommand@enable | |
\section*{\refname}% | |
\@mkboth{\refname}{\refname}% | |
\list{\@biblabel{\@arabic\c@enumiv}}% | |
{\settowidth\labelwidth{\@biblabel{#1}}% | |
\@tempdima\linewidth | |
\advance\@tempdima-\labelwidth | |
\advance\@tempdima-\labelsep | |
\@tempdimb\@tempdima | |
\@tempdimc 1\zw | |
\divide\@tempdima\@tempdimc | |
\multiply\@tempdima\@tempdimc | |
\advance\@tempdimb-\@tempdima | |
\advance\labelsep\@tempdimb | |
\leftmargin\labelwidth | |
\advance\leftmargin\labelsep | |
\itemindent=0pt | |
\@openbib@code | |
\usecounter{enumiv}% | |
\let\p@enumiv\@empty | |
\renewcommand\theenumiv{\@arabic\c@enumiv}}% | |
\sloppy | |
\clubpenalty4000 | |
\@clubpenalty\clubpenalty | |
\widowpenalty4000% | |
\sfcode`\.\@m | |
}{% | |
\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}% | |
\endlist | |
\jlreq@oldfontcommand@disable | |
} | |
\makeatother | |
\begin{document} | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
\fontsize{9pt}{12pt}\selectfont | |
\begin{thebibliography}{9} | |
\bibitem{one} | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
\bibitem{two} | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
□□□□□□□□□■□□□□□□□□□■□□□□□□□□□■ | |
\bibitem{three} | |
textwidth: \the\textwidth, linewidth: \the\linewidth, | |
labelwidth: \the\labelwidth, labelsep: \the\labelsep, | |
labelwidth+labelsep: | |
\newlength{\templength}\setlength{\templength}{\labelwidth} | |
\addtolength{\templength}{\labelsep}\the\templength, | |
leftmargin: \the\leftmargin, zw: | |
\newlength{\tempzw}\setlength{\tempzw}{1\zw} \the\tempzw. | |
\end{thebibliography} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
コメントありがとうございます。
元々の @yuw さんの実装では
\labelwidth
を補正していたので、それを踏襲して
\labelwidth
を補正するようにしていたのですが、文献番号の左端を本文の左端と揃えるなら、仰る通り
\labelsep
の補正にした方がいいですね。というわけで変更してみました。
pLaTeX, LuaLaTeX 両対応です。