Add a version number to the title of a LaTeX document

前端 未结 8 1399
攒了一身酷
攒了一身酷 2021-02-04 07:17

The title section of my LaTeX documents usually look like

\\title{Title}
\\author{Me}
%\\date{}      %// Today\'s date will appear when this is commented out.

\         


        
相关标签:
8条回答
  • 2021-02-04 07:39

    For many version control systems, the checkin and checkout programs will expand certain strings in the documents into metadata the version control system has about the system, including the version number.

    If you include these strings in the body of Tex definitions, then you can use them in your documents.

    It's hard to say more without knowing which version control system you are using, but CTAN has the vc bundle, and rcs.sty is nice to use, for folks still using not only non-distributed, but not even concurrent VC...

    Once you've got the strings (oh, I see you said manual entry is OK), you can then typeset this using

    \title{Title\\\normalsize Version \versionnumber}
    

    If you really want the author in between, then you can't use \title and \author together in the usual way - you should put your name on another line in the \title command.

    0 讨论(0)
  • 2021-02-04 07:41

    Simple manual method:

    1. Create a file called (say) version.tex:

      \providecommand{\versionnumber}{3.0.1}

    2. Where you need to use it:

      \input{version}
      \title{Title\\\normalsize Version \versionnumber}

    This will give you a single common place in your project or projects to update the version manually.

    0 讨论(0)
提交回复
热议问题