3

I want to establish lists of exam questions using probsoln. To keep things neatly arranged I want to keep the lists separated from the exams as I use a dedicated folder for each term and for each subject. Subjects might share questions.

To include the files in the LaTeX main document I need import to drag the files with proper subdirectory calls.

As a minimal demonstration example I isolated the following structure:

.
|-test_exam
|     +-main.tex
|-examquestions
      |-sampleFigures
      |    +erdbeeren.jpg
      +-q.tex
      +-mainlocal.tex

main.tex:

\documentclass{article}
\usepackage{import}
\usepackage{probsoln}
\RequirePackage{graphicx}


\begin{document}
    \subimport*{../examquestions/}{q}
    \useproblem{1}
\end{document}

q.tex:

\begin{defproblem}{1}%
    \includegraphics[keepaspectratio,width=3cm]{sampleFigures/erdbeeren.jpg}
\end{defproblem}

mainlocal.tex:

\documentclass{article}
\usepackage{import}
\usepackage{probsoln}
\RequirePackage{graphicx}


\begin{document}
    \input{q}
    \useproblem{1}
\end{document}

with main.tex compiled in pdflatex I get:

LaTeX Warning: File `sampleFigures/erdbeeren.jpg' not found on input line 9.

If I use mainlocal.tex, everything is OK. Therefore, the general structure in q.tex must be OK. I guess, probsoln fetches the problem code (from defproblem) from a kind of variable and substitutes it at the place of useproblem. This would undermine the attempt of import to provide the proper directories. I haven't found anything about that problem while searching the web.

Background: I have quite some experience in writing LaTeX documents, but do not mess with internals.

Edit (Fre Feb 14 19:06:29 CET 2014):

I found an ugly workaround:

main.tex:

\documentclass{article}
\usepackage{import}
\usepackage{probsoln}
\RequirePackage{graphicx}

\newcommand{\examquestionspath}{../examquestions/}

\begin{document}
    \input{\examquestionspath q}
    \useproblem{1}
\end{document}

q.tex:

\begin{defproblem}{1}%
    \includegraphics[keepaspectratio,width=3cm]{\examquestionspath  sampleFigures/erdbeeren.jpg}
\end{defproblem}

This is by far not satisfacory, but will serve me for the time being until a real solution might appear magically from somewhere.

Your Answer

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

Browse other questions tagged or ask your own question.