我无法使用该包\uppercase
或\MakeUppercase
使用该datatool
包导入的数据。
我有一个.csv
文件,里面有会议的所有作者姓名、摘要和演讲标题,我正在创建一本摘要书。我曾经datatool
将数据导入我的 tex 文件。标题应该全部大写,但使用\MakeUppercase{<imported data>}
或{\uppercase <imported data>}
会给出Undefined control sequence
错误Too many }'s
。
我怎样才能解决这个问题?
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{datatool}
\title{Book of Abstracts for Conference}
\author{Albert Einstein}
\DTLnewdb{abstacts}
\DTLloaddb{abstracts}{abstractslist.csv}
\begin{document}
\maketitle
\noindent
textbf{\Large{\MakeUppercase{\DTLfetch{abstracts}{authorkey}{Smith}{title}}}}\\
{\large\DTLfetch{abstracts}{authorkey}{Smith}{name}}\\
\DTLfetch{abstracts}{authorkey}{Smith}{abstract}\\
\noindent
\textbf{\Large{\MakeUppercase{\DTLfetch{abstracts}{authorkey}{Newton}{title}}}}\\
{\large\DTLfetch{abstracts}{authorkey}{Newton}{name}}\\
\DTLfetch{abstracts}{authorkey}{Newton}{abstract}
\end{document}
数据文件 abstractslist.csv 如下所示:
authorkey,name,institute,title,abstract
Newton,Isaac Newton,University of Cambridge,The Mathematical Principles of Natural Philosophy,"Since the ancients (as we are told by Pappus), made great account of the science of mechanics in the investigation of natural things; and the moderns, laying aside substantial forms and occult qualities, have endeavoured to subject the phænomena of nature to the laws of mathematics, I have in this treatise cultivated mathematics so far as it regards philosophy. The ancients considered mechanics in a twofold respect; as rational, which proceeds accurately by demonstration: and practical. To practical mechanics all the manual arts belong, from which mechanics took its name. But as artificers do not work with perfect accuracy, it comes to pass that mechanics is so distinguished from geometry, that what is perfectly accurate is called geometrical, what is less so, is called mechanical. But the errors are not in the art, but in the artificers. He that works with less accuracy is an imperfect mechanic; and if any could work with perfect accuracy, he would be the most perfect mechanic of all; for the description if right lines and circles, upon which geometry is founded, belongs to mechanics."
Smith,Adam Smith,University of Glasgow,The Wealth of Nations,"The annual labour of every nation is the fund which originally supplies it with all the necessaries and conveniencies of life which it annually consumes, and which consist always either in the immediate produce of that labour, or in what is purchased with that produce from other nations. According, therefore, as this produce, or what is purchased with it, bears a greater or smaller proportion to the number of those who are to consume it, the nation will be better or worse supplied with all the necessaries and conveniencies for which it has occasion."
错误如下:
! Undefined control sequence.
\dtlgetrowforvalue ... {\the \toks@ }{\dtl@rowidx
}}\@dtl@dogetrow \fi
l.15 ...fetch{abstracts}{authorkey}{Smith}{title}}
! Too many }'s.
\MakeUppercase ... {\uppercase {#1}}\reserved@a }
l.15 ...fetch{abstracts}{authorkey}{Smith}{title}}
这是不尝试将任何内容大写时的样子。
答案1
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{datatool}
\title{Book of Abstracts for Conference}
\author{Albert Einstein}
\DTLnewdb{abstacts}
\DTLloaddb{abstracts}{abstractslist.csv}
\begin{document}
\maketitle
\noindent
\DTLassignfirstmatch{abstracts}{authorkey}{Smith}{\inst=institute,\nm=name,\ttl=title,\ab=abstract}
\noindent{\large\textbf{\MakeUppercase{\ttl}}\\
\nm\par}
\noindent\ab
\end{document}