Exam Class: how to avoid question going beyond margin

I'm able to create question paper using LaTeX code mentioned below:

\documentclass{exam}
\usepackage{multicol}
\usepackage{amsmath}
\setlength\columnsep{46pt}
\begin{document}
\begin{multicols}{2}
\begin{questions}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question The points with position vectors\ $\displaystyle \boldsymbol{61i + 2j,\,10i-9j,\,ai-12j }$ \ are collinear, if\ $\displaystyle \boldsymbol{a = }$
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\end{questions}
\end{multicols}
\end{document}


It generates output as mentioned below:

If you notice Question 9, it's going out of the page margin. This happens very frequently when i add maths symbols, is there any way to avoid this error ?

-
Use a displayed equation. – kiss my armpit Nov 23 '13 at 5:27
Try separating one displaystyle into two displaystyles as what follows $\displaystyle \boldsymbol{61i + 2j}$,\ $\displaystyle \boldsymbol{10i-9j,\,ai-12j }$ \ – Jesse Nov 23 '13 at 5:31
Use \bm from the bm package instead of \boldsymbol – karlkoeller Nov 23 '13 at 5:33
I recommend you read the TeXbook. Knuth more than once says that you should not do: $1, 2, 3, \ldots, n$, but use $1$,~$2$, $3$, \dots,~$n$ instead since the commas do not belong to the actual math content. One of the disadvantages of writing everything inside $ is the one you see. Note also that commas produce less space inside math mode. – Bakuriu Nov 23 '13 at 10:56 Thank You Bakuriu for recommendation. I'm learning for your comments. Please do point me , if I'm making any mistake. – Pawan Mude Nov 30 '13 at 9:43 4 Answers Don't use \boldsymbol but \bm from the bm package. \documentclass{exam} \usepackage[margin=0.7in,headheight=3.5\baselineskip,headsep=1\baselineskip,includehead]{geometry} \usepackage{multicol} \usepackage{amsmath} \usepackage{bm} \setlength\columnsep{46pt} \begin{document} \begin{multicols*}{2} \begin{questions} \question The points with position vectors$\bm{61i + 2j}$,$\bm{10i-9j}$,$\bm{ai-12j}$are collinear, if$\bm{a =  }$\begin{choices} \choice 1 \choice 2 \choice 3 \choice 4 \end{choices} \end{questions} \end{multicols*} \end{document}  BTW: why do you want all that equation in bold? I will suggest to put only i and j in bold and leave the rest in normal math font (unless you want it this way for something else), like that $61\bm{i} + 2\bm{j}$ - Making numbers bold is not usual. :-) – kiss my armpit Nov 23 '13 at 5:47 @DonutE.Knot that's what I think, too... – karlkoeller Nov 23 '13 at 5:49 I'm making symbols bold to ensure, it comes proper while printing (sometimes with normal text, while making copies of question paper, symbol becomes un-readable) ; I can understand it does not usual... – Pawan Mude Nov 23 '13 at 5:51 The three vectors should be in distinct formulas, because they are three distinct formulas. And making numbers bold doesn't make sense: $61\bm{i}+2\bm{j}$ is the correct input. – egreg Nov 23 '13 at 11:10 @egreg I know, but the OP wanted this in this way. – karlkoeller Nov 23 '13 at 11:15 Code (only the problem code in question are provided) \question The points with position vectors\$\displaystyle \boldsymbol{61i + 2j}$,$\displaystyle \boldsymbol{10i-9j,\,ai-12j }$\ are collinear, if\$\displaystyle \boldsymbol{a =  }$\begin{choices} \choice 1 \choice 2 \choice 3 \choice 4 \end{choices}  - Why \displaystyle and “backslash-space” after the commas? – egreg Nov 23 '13 at 11:10 Oh, no need for that. I cut and paste when I run the case and did not notice that. Thanks for the observation. – Jesse Nov 23 '13 at 11:31 @Jesse I'm working on generating automated question paper , I've very less manual control to split formulas , is there any way to control it at document level? – Pawan Mude Nov 30 '13 at 9:45 @PawanMude -- This is an inline break of a math mode. Usually one can not foresee it to happen until it happens, but for a two-column format, the chance is high, continuation of long math should be avoided by breaking it up into readable pieces (comma is a good sign for breaking) while typing. As to control it at document level, I will provide this link tex.stackexchange.com/q/67440/34618 for your reference. Hope it helps. – Jesse Nov 30 '13 at 10:09 Making the numbers bold does not make sense here. Usually only the vectors (including unit vectors) need bold faces. Instead of making a vector bold, we can also use \vec for vectors in general or \hat for unit vectors. Without bold \documentclass{exam} \usepackage[margin=0.7in,headheight=3.5\baselineskip,headsep=1\baselineskip,includehead]{geometry} \usepackage{multicol} \usepackage{amsmath} \def\ihat{\hat{\imath}} \def\jhat{\hat{\jmath}} \def\khat{\hat{k}} \setlength\columnsep{46pt} \begin{document} \begin{multicols}{2} \begin{questions} \question The points with position vectors $61\ihat + 2\jhat,\,10\ihat-9\jhat,\,a\ihat-12\jhat$ are collinear, if$a=\cdots$. \begin{choices} \choice 1 \choice 2 \choice 3 \choice 4 \end{choices} \end{questions} \end{multicols} \end{document}  With bold \documentclass{exam} \usepackage[margin=0.7in,headheight=3.5\baselineskip,headsep=1\baselineskip,includehead]{geometry} \usepackage{multicol} \usepackage{amsmath} \usepackage{bm} \def\ihat{\,\bm{i}} \def\jhat{\,\bm{j}} \def\khat{\,\bm{k}} \setlength\columnsep{46pt} \begin{document} \begin{multicols}{2} \begin{questions} \question The points with position vectors $61\ihat + 2\jhat,\, 10\ihat-9\jhat,\, a\ihat-12\jhat$ are collinear, if$a=\cdots. \begin{choices} \choice 1 \choice 2 \choice 3 \choice 4 \end{choices} \end{questions} \end{multicols} \end{document}  Suggestion \documentclass{exam} \usepackage[margin=0.7in,headheight=3.5\baselineskip,headsep=1\baselineskip,includehead]{geometry} \usepackage{multicol} \usepackage{amsmath} \usepackage{bm} \def\ihat{\,\bm{i}} \def\jhat{\,\bm{j}} \def\khat{\,\bm{k}} \setlength\columnsep{46pt} \begin{document} \begin{multicols}{2} \begin{questions} \question The points with position vectors \begin{align*} \bm a &= 61\ihat + 2\jhat\\ % \bm b &= 10\ihat-9\jhat\\ % \bm c &= x\ihat-12\jhat % \end{align*} are collinear, ifx=\cdots. \begin{choices} \choice 1 \choice 2 \choice 3 \choice 4 \end{choices} \question The points with position vectors \begin{align*} \bm a &= \begin{pmatrix} 61\\ 2\end{pmatrix} \\ \bm b &=\begin{pmatrix} 10\\ -9\end{pmatrix}\\ \bm c &=\begin{pmatrix} x\\ -12\end{pmatrix} \end{align*} are collinear, ifx=\cdots\$.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\end{questions}
\end{multicols}
\end{document}


-
I'm making symbols bold to ensure, it comes proper while printing (sometimes with normal text, while making copies of question paper, symbol becomes un-readable) ; I can understand it does not usual.. – Pawan Mude Nov 23 '13 at 5:52
@PawanMude: only unit vectors (in this case) need bold, not the numbers. :-) – kiss my armpit Nov 23 '13 at 5:57
I'm working on generating automated question paper , I've very less manual control to split formulas , is there any way to control it at document level? – Pawan Mude Nov 30 '13 at 9:45

As you say in comments that you want all your mathematics bold for printing clarity then I suggest you switch to \mathversion{bold}.

As the others have said, the three vectors are separate entities so should be written $$a$$, $$b$$, $$c$$ rather than $$a,b,c$$. Note if you introduce grouping {...} in mathematics you create entities that do not break across lines:

\documentclass{exam}

\usepackage{multicol}
\usepackage{amsmath}

\mathversion{bold}

\begin{document}
\begin{multicols}{2}
\begin{questions}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question. Let This be the test question.Let This be the test question. Let This be the test question.
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\question The points with position vectors $$61i + 2j$$, $${10i-9j}$$, $$ai-12j$$ are collinear, if $$a =$$
\begin{choices}
\choice 1
\choice 2
\choice 3
\choice 4
\end{choices}
\end{questions}
\end{multicols}
\end{document}

-