【问题标题】:How to add an image to asciidoc book cover page?如何将图像添加到 asciidoc 书籍封面页?
【发布时间】:2013-10-21 15:43:10
【问题描述】:

我想用 asciidoc 创建一本 pdf 书。标题页应包括标题、副标题和图像。到目前为止,我找不到任何关于如何实现这一点的文档。

直觉上我会做类似的事情

My book title
=============
:author: myself
:toc:
image:images/titelimage.png[width=400]

但这只是添加了image:images/titelimage.png[width=400] 作为字幕。我想要的是类似的东西

My book title
<titleimage>
subtitle

有没有办法在 ascciidoc 中做到这一点?如果没有,我需要做什么才能得到这个?

【问题讨论】:

    标签: pdf-generation asciidoc


    【解决方案1】:

    如果您使用asciidoctor-pdf,您可以为徽标定义一个属性。它将图像放置在文档标题的上方

    :title-logo-image: images/titelimage.png
    

    在此处查看example pdfraw adoc

    【讨论】:

    【解决方案2】:

    如果有人仍在寻找这个答案,这是正确的方法(使用 asciidoctor-pdf):

    = Book title
    Authors
    :front-cover-image: image::./images/title_page.png[]
    

    这会将图像本身作为第一页,然后是显示标题、作者、修订等的页面。

    如果您希望图片与标题和作者在同一页,则需要使用:title-logo-image:

    【讨论】:

      【解决方案3】:

      如果您想要使用 docbook 4.x 输出的 PDF,您应该:

      为首页生成带有图像的 docinfo 文件。这是一个类似于以下示例的 XML 文件。在http://www.methods.co.nz/asciidoc/userguide.html#X87进行讨论

      例子:

      <mediaobject>
        <imageobject>
          <imagedata align="center" depth="400" fileref="../images/tiger.png" />
        </imageobject>
      </mediaobject>
      <subtitle>Subtitle of this book</subtitle>
      

      然后,自定义您的 DocBook 样式表以包含标题页的媒体元素(默认情况下,样式表不包含该元素)。 http://www.sagehill.net/docbookxsl/TitlePagePrint.html

      DocBook 5 在其样式表中包含一个封面元素。

      【讨论】:

        【解决方案4】:

        这个:

        = The Book's Title
        :author: First Last
        :email: first.last@company.com
        :toc:
        :toc-placement: preamble
        :doctype: book
        
        image:./images/title_page.jpg[]
        

        生产:

        My book title
        first.last@company.com - first.last@company.com
        Image
        Table of Contents
        ...
        

        【讨论】:

        • 我可能会在下周尝试一下,如果它对我有用,会告诉你。
        【解决方案5】:

        你只需要在目录和图像之间添加一个空行:指令。这就是 asciidoc 区分集团的方式。

        【讨论】:

        • 其实我不再使用 :toc: 了,只是标题。我生成了一本书,它会自动添加一个目录。把图片放在标题后面,中间有一条空线是不行的。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-05-26
        • 1970-01-01
        • 2022-01-16
        • 2015-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多