3

I can't use \uppercase or \MakeUppercase on data imported using the datatool package.

I have a .csv file with all of the author names, abstracts and titles of talks for a conference and I'm creating an abstract book. I've used datatool to import the data into my tex file. The titles should appear in all upper case, but using \MakeUppercase{<imported data>} or {\uppercase <imported data>} gives me an Undefined control sequence and a Too many }'s error.

How can I fix this?

\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}

The data file abstractslist.csv looks like this:

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."

And the error:

! 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}}

Here's what it looks like without trying to make anything upper case.

enter image description here

  • Although \MakeUppercase{<imported data>} doesn't work, \textsc{<imported data>} does! What's the difference? But the conference organizers really want the titles to appear in all uppercase, not smallcaps. – luftbahnfahrer Jun 6 '15 at 19:58
  • 2
    \textsc is a font change, so does not require replacing tokens in the input stream. MakeUppercase has to replace every a by A so the timing with respect to other macros and datatool's macros in particular is harder. – David Carlisle Jun 6 '15 at 20:19
5

enter image description here

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.