如何安装和使用 nlatexdb?(或 latexdb、ratexdb)?

如何安装和使用 nlatexdb?(或 latexdb、ratexdb)?

这个问题与这个问题关于使用 Xelatex 使用 UTF-8 编码排版 MySQL 数据库。

我绝望地问了这个问题,因为这涉及到为我的论文打印 552 行!我需要在本周将这些信息交给我的导师,而他有点老派(意思是他宁愿把所有东西都写在纸上,而不是写在电脑上,当然也不是写在计算机代码上)。

系统详细信息:

  • Mac OS X Lion 10.7.4
  • 使用 Macports 安装的 Tex Live 2012
  • 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、nohyphenation 的连字模式,已加载。(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls 文档类:article 2007/10/19 v1.4h 标准 LaTeX 文档类(/opt/local/share/texmf-texlive-dist/tex/latex/base/size10.clo))(./database.aux))*

或者它只是像这样挂起:

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”。

相关内容