Text FormattingNeed to write the options horizontally rather vertically

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

Need to write the options horizontally rather vertically

Post by sachinrajsharma »

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 376 times
Test File.tex
(605 Bytes) Downloaded 368 times

Recommended reading 2024:

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

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Need to write the options horizontally rather vertically

Post by Johannes_B »

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 ;-)

Code: Select all

\documentclass[
%answers
]{exam}
\usepackage[utf8]{inputenc}
\everymath{\displaystyle}
\usepackage{mathtools}
\usepackage{showframe}
\begin{document}\small

\begin{questions}


	\question $5+7=$
\begin{oneparchoices}
	\choice $1$
	\CorrectChoice $42$
	\choice $12$
	\choice $\sqrt{2}$
\end{oneparchoices}
\newcommand{\JBQ}{%
\question  $(\sin x-\cos x)^2$ is equal to 
\begin{oneparchoices}
\choice  $1$  \choice  $1-2\sin x \cos x$ \choice  $-1$  \choice
$1+2\sin x\cos x$
\end{oneparchoices}
}

\JBQ
\JBQ
\JBQ
\JBQ
\JBQ

\question What does
$\sum\limits_{n=1}^{k\rightarrow\infty}1+\frac{1}{n}$ give you?
\begin{oneparchoices}
	\choice something 
	\choice something else
	\CorrectChoice Odd spacing
\end{oneparchoices}


\JBQ
\JBQ
\JBQ
\JBQ
\JBQ
\JBQ
\end{questions}
\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: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Need to write the options horizontally rather vertically

Post by cgnieder »

Here's another proposal:

Code: Select all

\documentclass[10pt,a4paper]{article}

% \everymath{\displaystyle}%  this is a /BAD/ idea!

\usepackage{amsmath}
\usepackage{exsheets}% also loads the `tasks' package

\begin{document}% \small % if the while document should by set in smaller
                % fontsize then use a different fontsize as class option

\begin{question}
  $(\sin x-\cos x)^2$ is equal to
  \begin{tasks}(4)
    \task $1$
    \task $1-2\sin x\cos x$
    \task $-1$
    \task $1+2\sin x\cos x$
  \end{tasks}
\end{question}

\end{document}
exsheets.png
exsheets.png (7.57 KiB) Viewed 6058 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
site moderator & package author
Post Reply