TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to create a command to can insert the image in a line of text question? Since I have a lot of question types made True/False, Short Answer types, Multiple choice, etc. I want the command to be compatible or can be usable in each of the question types. How should i make it? here is an example output to pdf for multiple choice:

multiple choice

I am currently using my created class based from the exam.cls help please.. thank you..



\question This look like a \Image{/home/kayla/Desktop/activity/ddd} but it    
 actually a \Image{/home/kayla/Desktop/activity/nest}

I made to place the image where my .tex file is placed. It always provides me an error. the


is highlighted and it says

illegal parameter number in definition of \reserved@a 
share|improve this question
The solution below should work just as well with other classes -- nothing class specific in there. – Peter Grill Feb 15 '13 at 3:40
To use the solution below you also need to add \usepackage[export]{adjustbox} to the preamble. – Peter Grill Feb 15 '13 at 7:37

One way would be to use the adjustbox package to create a command the vertically aligns the image to middle of the line:

enter image description here



You can insert image here as
and your text can continue after it
and spill onto the next line as well, so you can see how this works.
share|improve this answer
I am using exam.cls as the document class. I will use image in a question so it should be inside the \begin{question} & \end{question} tags. I tried the solution indicated above but it doesn't work. I am working in Ubuntu. – Kayla Feb 15 '13 at 3:41
Saying "it does not work" does not relaly provide any information from which to diagnose the problem. It would be best if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem, and added it to you question. – Peter Grill Feb 15 '13 at 3:43
Please create a complete MWE and add it to the question. – Peter Grill Feb 15 '13 at 3:44
@Kayla: Perhaps your problem is that you are trying to go up the hierarchy. Try placing the image in the same place as the .tex file and see if that works. And, instead of describing the problem here in the comments, please see this link as to what a MWE is and add a MWE to the question. – Peter Grill Feb 15 '13 at 4:40
@Kayla: Well you could install the necessary packages and should work with 2009, but I do not have that version so can't test it. – Peter Grill Feb 15 '13 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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