如何安裝和使用 nlatexdb? (或 Latexdb、ratexdb)?

如何安裝和使用 nlatexdb? (或 Latexdb、ratexdb)?

這個問題與這個問題關於使用 Xelatex 使用 UTF-8 編碼排版 MySQL 資料庫。

我絕望地問這個問題,因為它涉及為我的論文打印 552 行!本週我需要將這些資訊提供給我的顧問,他有點守舊(這意味著他寧願將所有內容都寫在紙上,而不是電腦上,當然也不會用電腦程式碼表示)。

系統詳細資訊:

  • Mac OS X Lion 10.7.4
  • Tex Live 2012 與 Macports 一起安裝
  • MySQL 5.5 伺服器(透過 DMG 安裝)

如何安裝三個 Latexdb 系統中的任何一個? (上面的相關問題涉及使其與 xelatex 一起工作)。

伺服器運作良好。我可以登入並進行查詢。

我有一個簡單的文檔:

\documentclass[a4]{article}
\usepackage{fontspec}
\texdbconnection{MySQL,localhost,root,password,mydatabase}
\texdbdef{##query1}{select hd,md from mytable}{##hd,##md}

\begin{document}
This is a header for the page.

\begin{tabular}{|l|l|}
\hline
Hochdeutsch & Mantakisch \\
\texdbfor{##query1}{\hline \textit{##hd} & \textbf{##md}\\}
\hline
\end{tabular}\\

\end{document}

我不斷收到以下錯誤:

Latexdb database.tex 預編譯database.tex(循環1) 這是XeTeX,版本3.1415926-2.4-0.9998(TeX Live 2012/MacPorts 2012_7)受限\write18 啟用。進入擴展模式(./database.tex LaTeX2e <2011/06/27> Babel 和英語連字符模式、dumylang、無連字符、lo aded。(/opt/local/share/texmf-texlive-dist/tex/latex /base /article.cls 文件類別:文章2007/10/19 v1.4h 標準LaTeX 文件類別(/opt/local/share/texmf-texlive-dist/tex/latex/base/size10.clo)) (./ database.輔助))*

或者它只是這樣掛起:

latexdb database.tex
Pre-Compiling database.tex (loop 1)
Traceback (most recent call last):
  File "/opt/local/bin/latexdb.py", line 274, in <module>
    _main_()
  File "/opt/local/bin/latexdb.py", line 262, in _main_
    texDBparseForLoop(l)
  File "/opt/local/bin/latexdb.py", line 151, in texDBparseForLoop
    for qR in texDBresult(queryString):
  File "/opt/local/bin/latexdb.py", line 68, in texDBresult
    cursor=db.cursor()
NameError: global name 'db' is not defined
This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/MacPorts 2012_7)
 restricted \write18 enabled.
entering extended mode
(./database.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
aded.
(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive-dist/tex/latex/base/size10.clo))
(/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/expl3.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3names.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3bootstrap.sty))
(/opt/local/share/texmf-texlive-dist/tex/latex/etex-pkg/etex.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/color.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/latexconfig/color.cfg)
(/opt/local/share/texmf-texlive-dist/tex/xelatex/xetex-def/xetex.def))
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/graphics.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/trig.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/latexconfig/graphics.cfg))
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3basics.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3expan.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3tl.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3seq.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3int.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3quark.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3prg.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3clist.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3token.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3prop.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3msg.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3file.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3skip.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3keys.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3fp.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3box.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3coffins.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3color.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3luatex.sty))
(/opt/local/share/texmf-texlive-dist/tex/latex/l3packages/xparse/xparse.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec-patches.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fixltx2e.sty)
*************************************************
* LaTeX warning: "xparse/redefine-command"
* 
* Redefining document command \oldstylenums with arg. spec. 'm' on line 107.
*************************************************
) (/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec-xetex.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fontenc.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/euenc/eu1enc.def)
(/opt/local/share/texmf-texlive-dist/tex/latex/euenc/eu1lmr.fd))
(/opt/local/share/texmf-texlive-dist/tex/xelatex/xunicode/xunicode.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/tipa/t3enc.def
(/opt/local/share/texmf-texlive-dist/tex/latex/euenc/eu1lmss.fd))
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/graphicx.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/keyval.sty)))
(/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec.cfg)))

LaTeX Warning: Unused global option(s):
    [a4].

(./database.aux) (/opt/local/share/texmf-texlive-dist/tex/latex/tipa/t3cmr.fd))

*

看來我真的很接近讓這份工作開始了。

答案1

Nlatexdb 不需要安裝。您只需要 nlatexdb.exe 檔案。您可以將其複製到任何地方,例如複製到與 xelatex 相同的資料夾中。

對於 MySql 和 Mono,您將必須執行更多步驟,如本頁所述: http://sourceforge.net/p/nlatexdb/wiki/MySQL%20and%20Mono/

另外,如果 tex 檔案採用 UTF-8 格式,則必須新增命令列參數「-e utf-8」。

相關內容