我有以下简单文档,我想访问 ODS 电子表格。
\documentclass[]{report}
\usepackage{odsfile}
% Title Page
\title{odsfile Test}
\author{}
\begin{document}
\maketitle
\begin{tabular}{lr}
\includespread{file=simpleodsfile.ods}
\end{tabular}
\end{document} `
但编译失败并出现以下错误消息:
lualatex --shell-escape odsfile_test.tex
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Arch Linux) (rev 5238)
\write18 enabled.
(./odsfile_test.tex
LaTeX2e <2015/10/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/share/texmf-dist/tex/latex/base/report.cls
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/lualatex/odsfile/odsfile.sty
(/usr/share/texmf-dist/tex/lualatex/luacode/luacode.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)))
(/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))) (./odsfile_test.aux)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
! LuaTeX error /usr/share/texmf-dist/tex/lualatex/odsfile/odsfile.lua:71: attemp
t to index local 'x' (a nil value)
stack traceback:
/usr/share/texmf-dist/tex/lualatex/odsfile/odsfile.lua:71: in function 'getTabl
e0'
/usr/share/texmf-dist/tex/lualatex/odsfile/odsfile.lua:26: in function 'getTabl
e'
[\directlua]:1: in main chunk.
\luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }
l.13 \includespread{
file=simpleodsfile.ods
? quit()
OK, entering \batchmode[peter@rohan groupprojectaudit]
我不认为我的 ods 文件 (Libreoffice 5.1.3) 存在问题,因为它只是一个带有两个列标题和两行数字的示例。编辑:我也尝试指定文件的完整路径名,但结果相同,odsfile.lua 第 71 行再次出现相同的错误
答案1
使用\includespread
括号[]
代替{}
keyval 参数:
\documentclass[]{report}
\usepackage{odsfile}
% Title Page
\title{odsfile Test}
\author{}
\begin{document}
\maketitle
\begin{tabular}{lr}
\includespread[file=simpleodsfile.ods]
\end{tabular}
\end{document}