GeneralMaking graphicx and texdbi work together

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Making graphicx and texdbi work together

Post by batonac »

I've been working on using LaTeX and texdbi to create a simple product catalog from a MySQL database. I've figured everything out except for how to include graphics from a path specified in a database field.

I've tried

Code: Select all

\includegraphics[height=7cm]{\texdbivalue{imagepath}}
and then I run

Code: Select all

pdflatex --shell-escape Catalog.tex
but I get

Code: Select all

! Use of \Gin@ii doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.8 ...c}{\includegraphics{\texdbivalue{imagepath}}}
I know that my connection with the database is good, because all of the other database data shows up fine.

Please advise!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Making graphicx and texdbi work together

Post by localghost »

The error message indicates that there is something wrong with the contents in the mandatory argument of the \includegraphics command. Make sure that it has a path of a file including its name. Since the mentioned package is not listed on CTAN, it will not be easy to comprehend the problem.


Best regards and welcome to the board
Thorsten
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Making graphicx and texdbi work together

Post by batonac »

localghost wrote:The error message indicates that there is something wrong with the contents in the mandatory argument of the \includegraphics command. Make sure that it has a path of a file including its name. Since the mentioned package is not listed on CTAN, it will not be easy to comprehend the problem.


Best regards and welcome to the board
Thorsten
hmm... very sad. It seems as if the software I'm using (texdbi) isn't being maintained or used very much anymore. Everything works perfectly until I try to insert graphics. :(

Here is the background info:
  • The package i'm using is called texdbi. It can be found here http://sarovar.org/projects/texdbi/
  • Additional documentation for texdbi can be found here http://www.tug.org/TUGboat/Articles/tb2 ... lkumar.pdf
  • I have successfully created all of the necessary configuration files to allow texdbi to communicate with my database.
  • Every documented function of texdbi works for me.
  • When I try to insert data, I use \texdbivalue{*mydatabasefield*}
  • I do have the complete graphics path included in the database field.
If there is a more modern database connector that I should be using instead I would love to know.

Finally, thanks for the warm welcome and speedy response.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Making graphicx and texdbi work together

Post by localghost »

Hm. It's only an idea. But did you insert the path in the right notation? Remember that (La)TeX needs slashes instead of backslashes in the path to a file.

An alternative interface may be latexdb. It also handles MySQL databases.
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Making graphicx and texdbi work together

Post by batonac »

localghost wrote:Hm. It's only an idea. But did you insert the path in the right notation? Remember that (La)TeX needs slashes instead of backslashes in the path to a file.

An alternative interface may be latexdb. It also handles MySQL databases.
My paths are correct. I also already tried latexdb, but ran into more problems during initial setup. Maybe I should return to that project and see if those bugs are less detrimental.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Making graphicx and texdbi work together

Post by localghost »

I'm afraid I will not be of great help because my experience with databases in general and in conjunction with LaTeX in particular is very limited (actually not present). Perhaps somebody else is better in this field.
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Re: Making graphicx and texdbi work together

Post by batonac »

hmm... latexdb does not seem to be compatible at all with my needs. It runs only as a preprocessor, not as an integral part of the latex engine. In other words, it creates a .tex file with the database fields that you requested included in the file, but you cant use other latex packages to digest the database info. I require other latex packages to process the database input. (special latex loops and mathematical calculations)

Any ideas would be immensely appreciated!
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Making graphicx and texdbi work together

Post by nlct »

It may be that \texdbivalue{imagepath} doesn't simply expand to the path name. (For example, it may perform a check to determine if the key exists.) A new package called ratexdb has just been announced. Maybe that might suit your purposes.

Regards
Nicola Talbot
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Making graphicx and texdbi work together

Post by batonac »

nlct wrote:It may be that \texdbivalue{imagepath} doesn't simply expand to the path name. (For example, it may perform a check to determine if the key exists.)
I'm kinda confused. It may check if what key exists? This code works perfectly if it's not included as an \includegraphics argument. In other words, if i put \texdbivalue{imagepath} anywhere else in the document, it inflates perfectly with the image path.
nlct wrote:A new package called ratexdb has just been announced. Maybe that might suit your purposes.
Thanks, I'm checking this out. I see that it is a preprocessor which works completely seperately from latex, producing only a second latex file which is complete with all of the requested database fields.

One problem is that it does not seem to support the \input command to include other files in your document. This is kinda essential as my entire document is spread out across multiple folders in many files. Discarding this multi-file structure would be quite counterproductive for me, as many of the files are inputed several times into the document.

Does anyone know of a preprocessor that will combine all of my files into one tex document right before it is processed by ratexdb?

In other words, something that would work like this:

Code: Select all

preprocessor catalog.tex > catalogcompiled.tex
ratexdb catalogcompiled.tex > catalogfinished.tex
pdflatex catalogfinished.tex > catalogfinished.pdf
batonac
Posts: 12
Joined: Fri Feb 26, 2010 5:41 pm

Making graphicx and texdbi work together

Post by batonac »

batonac wrote:Does anyone know of a preprocessor that will combine all of my files into one tex document right before it is processed by ratexdb?

In other words, something that would work like this:

Code: Select all

preprocessor catalog.tex > catalogcompiled.tex
ratexdb catalogcompiled.tex > catalogfinished.tex
pdflatex catalogfinished.tex > catalogfinished.pdf
Since this question was off topic, I submitted a second forum topic [1]. In this thread I received a useful answer.

[1] View topic: LaTeX preprocessor (combining input files)
Post Reply