How to add an image to asciidoc book cover page?

空扰寡人 提交于 2019-12-03 17:02:52

问题


I would like to create a pdf book using asciidoc. The title page should include the title, subtitle and an image. So far I could not find any documentation on how to achive this.

Intuivly I would do something like

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

but this just adds image:images/titelimage.png[width=400] as a subtitle. What I would like to have is something like

My book title
<titleimage>
subtitle

Is there a way to do this in ascciidoc? If not, what do I need to do to get this?


回答1:


If you're using asciidoctor-pdf you can define an attribute for the logo. It will place the image above the document title.

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

See an example pdf here and the raw adoc.




回答2:


If anyone is still looking for this answer, this is the correct way to do it (using asciidoctor-pdf):

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

This gives you the image by itself as the first page followed by a page that shows the title, authors, revision etc.

If you want the image on the same page as the title and author, you need to use :title-logo-image: instead.




回答3:


If you want a PDF using the docbook 4.x output you should:

Generate a docinfo file with an image for the front page. This is an XML file looking like the following example. It is discussed at http://www.methods.co.nz/asciidoc/userguide.html#X87

Example:

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

Then, customize your DocBook stylesheets to include the media element for the title page (by default the stylesheets do not include this). http://www.sagehill.net/docbookxsl/TitlePagePrint.html

DocBook 5 includes a cover element in its stylesheets.




回答4:


you just need to add a empty line between the toc and the images: instruction. That's how asciidoc kinda separates blocs.




回答5:


This:

= The Book's Title
:author: First Last
:email: first.last@company.com
:toc:
:toc-placement: preamble
:doctype: book

image:./images/title_page.jpg[]

Produces:

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


来源:https://stackoverflow.com/questions/19354075/how-to-add-an-image-to-asciidoc-book-cover-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!