参考书目中的文本对齐

参考书目中的文本对齐

我现在的参考书目如下: 在此处输入图片描述

我需要正确对齐文本。我一直在自己尝试,这里的问题对齐参考书目不能解决我的问题。

我认为问题在于我使用了定制的文内引用,如 [Gaz14-ol] 或 [MQT21-ol]。

但是,对于在线资源,我别无选择,只能这样做,除非有人能建议有其他方法可以做到这一点。

我使用的代码:

\documentclass[a4paper, 
    twoside, 
    12pt, 
    toc=bibliographynumbered, 
    numbers=noendperiod, 
    ngerman,
    openany, 
    fleqn]{scrbook}
\begin{document}

Example to cite \cite{Latex1} and also \cite{Latex4}.

\bibliographystyle{literature/myalphadin}
\raggedright
\nocite{*}
\bibliography{literature/literature}
\end{document}

我的 literature.bib 如下所示:

@misc{Latex1,
    mylabel = {Uni21-ol},
    author = {Unity},
    title = {{Unity Technologies}},
    howpublished = "\url{https://unity.com/}",
    year = {Apr-2021}, 
    note = "[Online; accessed 04-Apr-2021]"
}

@misc{Latex2,
    mylabel = {ROS21-ol},
    author = {ROS},
    title = {{ROS Index}},
    howpublished = "\url{https://index.ros.org/packages/}",
    year = {Apr-2021}, 
    note = "[Online; accessed 04-Apr-2021]"
}

@INPROCEEDINGS{Latex3,
    author={R. {Codd-Downey} and P. M. {Forooshani} and A. {Speers} and H. {Wang} and M. {Jenkin}},
    booktitle={2014 IEEE International Conference on Information and Automation (ICIA)}, 
    title={From ROS to unity: Leveraging robot and virtual environment middleware for immersive teleoperation}, 
    year={2014},
    volume={},
    number={},
    pages={932-936},
    doi={10.1109/ICInfA.2014.6932785}}
@misc{Latex4,
    mylabel = {GPP$^+$20-ol},
    author = {Greene,Cameron and Platin,Jacob and Pinol,Michael and Trang,Amanda and Vij,Vidur and Gibson,Sarah},
    title = {{Robotics simulation in Unity is as easy as 1,2,3}},
    howpublished="\url{https://blogs.unity3d.com/2020/11/19/robotics-simulation-in-unity-is-as-easy-as-1-2-3/}",
    journal = {Unity Technologies Blog},
    year = {19-Nov-2020}, 
    note = "[Online; accessed 04-Apr-2021]"
}

@misc{Latex5,
    mylabel = {Gaz14-ol},
    author = {Gazebo},
    title = {{Open Source Robotics Foundation}},
    howpublished = "\url{http://gazebosim.org/}",
    year = {Mar-2014}, 
    note = "[Online; accessed 04-Apr-2021]"
}

@misc{Latex6,
    mylabel = {MQT21-ol},
    author = {MQTT},
    title = {{The Standard for IoT Messaging}},
    howpublished = "\url{https://mqtt.org/}",
    year = {Jan-2021}, 
    note = "[Online; accessed 04-Apr-2021]"
}

@INPROCEEDINGS{Latex7,  author={A. {Hussein} and F. {García} and C. {Olaverri-Monreal}},  booktitle={2018 IEEE International Conference on Vehicular Electronics and Safety (ICVES)},   title={ROS and Unity Based Framework for Intelligent Vehicles Control and Simulation},   year={2018},  volume={},  number={},  pages={1-6},  doi={10.1109/ICVES.2018.8519522}}

然而,据我所知,问题出在 myalphadin.bst 文件中。

我在.bst 文件中仅更改了以下内容:

ENTRY
  { mylabel
...
}

FUNCTION {output.bibitem}
{ newline$
"\bibitem[" write$
mylabel empty$ 'label 'mylabel if$ write$
"]{" write$
cite$ write$
"}" write$
newline$
""
before.all 'output.state :=
}

有人能帮我解决这个问题吗?

myalphadin.bst 文件在这里

完整的 literature.bib 文件可以在这里找到

我不能使用 natbib 或其他。

如有任何建议或提示,我们将不胜感激。

答案1

我认为引入mylabel已经FUNCTION {output.bibitem}太晚了。BibTeX 需要能够找出最长的标签才能使缩进正常工作。

我认为更好的做法是calc.label。让该函数读取

FUNCTION {calc.label}
{ 
  mylabel empty$
    {
      type$ "book" =
      type$ "booklet" =
      type$ "inbook" =
      or or
        'author.editor.key.label
        { type$ "proceedings" =
            'editor.key.organization.label
            { type$ "manual" =
                'author.key.organization.label
                'author.key.label
              if$
            }
          if$
        }
      if$
      duplicate$
      year field.or.null purify$ #-1 #2 substring$
      *
    }
    { mylabel duplicate$ }
  if$
  'label :=
  year field.or.null purify$ #-1 #4 substring$
  *
  sortify 'sort.label :=
}

并恢复FUNCTION {output.bibitem}默认设置

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  label write$%
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

您可以获取完整文件以及格式良好的 diffalphadin.bst文件https://gist.github.com/moewew/9697e9f14f6a5b15bf1dce6322c31d67


看起来您的mylabel通常只是标签alphadin会分配的,并附加了“-ol”。如果我理解正确的话,这个想法是为了识别这样的在线资源(我不赞成这样做,在线资源应该是一等公民,不应该受到这样的歧视)。如果这是正确的,那么一个更好的、更 TeX-y 的解决方案是让样式添加它-ol自己。为此,您需要一种稳定的方法来识别“在线资源”。目前,该.bib文件使用howpublishednote添加 URL 和访问日期,但样式支持一个url字段,这将使识别在线资源变得更容易。

相关内容