LaTeX forum ⇒ Text FormattingNeed to write the options horizontally rather vertically

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Need to write the options horizontally rather vertically

Postby sachinrajsharma » Tue Aug 12, 2014 7:27 pm

Hi,
Good Day!
Request you to please suggest how can I have the multiple options horizontally rather getting it vertically as these are consuming too much space while I am writing questions in hundred or so.

Files are attached for your reference.


Thanks,
Sachin
Attachments
Test File.pdf
(31.11 KiB) Downloaded 152 times
Test File.tex
(605 Bytes) Downloaded 82 times

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3551
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Aug 12, 2014 11:12 pm

There are special classes and packages around to do this stuff.

See the code below, use the answers option and you are in for a surprise ;-)

  1. \documentclass[
  2. %answers
  3. ]{exam}
  4. \usepackage[utf8]{inputenc}
  5. \everymath{\displaystyle}
  6. \usepackage{mathtools}
  7. \usepackage{showframe}
  8. \begin{document}\small
  9.  
  10. \begin{questions}
  11.  
  12.  
  13. \question $5+7=$
  14. \begin{oneparchoices}
  15. \choice $1$
  16. \CorrectChoice $42$
  17. \choice $12$
  18. \choice $\sqrt{2}$
  19. \end{oneparchoices}
  20. \newcommand{\JBQ}{%
  21. \question $(\sin x-\cos x)^2$ is equal to
  22. \begin{oneparchoices}
  23. \choice $1$ \choice $1-2\sin x \cos x$ \choice $-1$ \choice
  24. $1+2\sin x\cos x$
  25. \end{oneparchoices}
  26. }
  27.  
  28. \JBQ
  29. \JBQ
  30. \JBQ
  31. \JBQ
  32. \JBQ
  33.  
  34. \question What does
  35. $\sum\limits_{n=1}^{k\rightarrow\infty}1+\frac{1}{n}$ give you?
  36. \begin{oneparchoices}
  37. \choice something
  38. \choice something else
  39. \CorrectChoice Odd spacing
  40. \end{oneparchoices}
  41.  
  42.  
  43. \JBQ
  44. \JBQ
  45. \JBQ
  46. \JBQ
  47. \JBQ
  48. \JBQ
  49. \end{questions}
  50. \end{document}


If you don't want to use tis class, you can do it using package enumitem.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
cgnieder
Site Moderator
Posts: 1974
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Wed Aug 13, 2014 6:02 pm

Here's another proposal:
  1. \documentclass[10pt,a4paper]{article}
  2.  
  3. % \everymath{\displaystyle}% this is a /BAD/ idea!
  4.  
  5. \usepackage{amsmath}
  6. \usepackage{exsheets}% also loads the `tasks' package
  7.  
  8. \begin{document}% \small % if the while document should by set in smaller
  9. % fontsize then use a different fontsize as class option
  10.  
  11. \begin{question}
  12. $(\sin x-\cos x)^2$ is equal to
  13. \begin{tasks}(4)
  14. \task $1$
  15. \task $1-2\sin x\cos x$
  16. \task $-1$
  17. \task $1+2\sin x\cos x$
  18. \end{tasks}
  19. \end{question}
  20.  
  21. \end{document}


exsheets.png
exsheets.png (7.57 KiB) Viewed 2003 times


Please use math mode for all mathematical expressions, even if they're just a number. Especially if they're a negative number. Even more important when you use math operators like sine or cosine.

I am a bit puzzled by your example: it sets \everymath{\displaystyle} (a bad decision IMHO) when not everybody knows \everymath but then you don't use such basics as \sin or \cos.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 9 guests