FreeBSD 文件計畫入門書
前一頁 | 附錄 A. 範例 |

# A.3. Producing formatted output

本節有些前提，假設：已經有裝 `textproc/docproj` 上面所安裝各軟體，無論它們是用 port 方式安裝或是手動安裝。 此外，假設所裝的軟體都放在 `/usr/local/` 下的子目錄， 並且所安裝的相關執行檔，都有裝在你的 `PATH` 環境變數內的目錄。 如有必要的話，請依你的系統環境而調整相關路徑。

## A.3.1. 使用 Jade

範例 A-3. 轉換 DocBook 為 HTML (完整模式)

    % jade -V nochunks \
        -c /usr/local/share/xml/docbook/dsssl/modular/catalog \
        -c /usr/local/share/xml/docbook/catalog \
        -c /usr/local/share/xml/jade/catalog \
        -d /usr/local/share/xml/docbook/dsssl/modular/html/docbook.dsl \
        -t sgml  file.xml > file.html

  Specifies the `nochunks` parameter to the stylesheets, forcing all output to be written to STDOUT (using Norm Walsh's stylesheets).
  Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.
  Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.
  Instructs Jade to perform a transformation from one DTD to another. In this case, the input is being transformed from the DocBook DTD to the HTML DTD.
  Specifies the file that Jade should process, and redirects output to the specified `.html` file.

範例 A-4. 轉換 DocBook 為 HTML (章節模式)

    % jade \
        -c /usr/local/share/xml/docbook/dsssl/modular/catalog \
        -c /usr/local/share/xml/docbook/catalog \
        -c /usr/local/share/xml/jade/catalog \
        -d /usr/local/share/xml/docbook/dsssl/modular/html/docbook.dsl \
        -t sgml  file.xml

  Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.
  Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.
  Instructs Jade to perform a transformation from one DTD to another. In this case, the input is being transformed from the DocBook DTD to the HTML DTD.
  Specifies the file that Jade should process. The stylesheets determine how the individual HTML files will be named, and the name of the “root” file (i.e., the one that contains the start of the document.

This example may still only generate one HTML file, depending on the structure of the document you are processing, and the stylesheet's rules for splitting output.

範例 A-5. 轉換 DocBook 為 Postscript(PS) 格式

The source SGML file must be converted to a TeX file.

    % jade -Vtex-backend \
        -c /usr/local/share/xml/docbook/dsssl/modular/catalog \
        -c /usr/local/share/xml/docbook/catalog \
        -c /usr/local/share/xml/jade/catalog \
        -d /usr/local/share/xml/docbook/dsssl/modular/print/docbook.dsl \
        -t tex  file.xml

  Customizes the stylesheets to use various options specific to producing output for TeX.
  Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.
  Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.
  Instructs Jade to convert the output to TeX.

The generated `.tex` file must now be run through `tex`, specifying the `&jadetex` macro package.

    % tex "&jadetex" file.tex

You have to run `tex` at least three times. The first run processes the document, and determines areas of the document which are referenced from other parts of the document, for use in indexing, and so on.

Do not be alarmed if you see warning messages such as `LaTeX Warning: Reference `136' on page 5 undefined on input line 728.` at this point.

The second run reprocesses the document now that certain pieces of information are known (such as the document's page length). This allows index entries and other cross-references to be fixed up.

The third pass performs any final cleanup necessary.

The output from this stage will be ``file`.dvi`.

Finally, run `dvips` to convert the `.dvi` file to Postscript.

    % dvips -o file.ps file.dvi

範例 A-6. 轉換 DocBook 為 PDF 格式

The first part of this process is identical to that when converting DocBook to Postscript, using the same `jade` command line (範例 A-5).

When the `.tex` file has been generated you run pdfTeX. However, use the &pdfjadetex macro package instead.

    % pdftex "&pdfjadetex" file.tex

Again, run this command three times.

This will generate ``file`.pdf`, which does not need to be processed any further.

前一頁 | 內容 |
DocBook `<article>` | 上一層 |

本文及其他文件，可由此下載：ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。

若有 FreeBSD 方面疑問，請先閱讀 FreeBSD 相關文件，如不能解決的話，再洽詢 <questions@FreeBSD.org>。
關於本文件的問題，請洽詢 <doc@FreeBSD.org>。