2

I am writing some True and False for examination. There is a minor issue with the code that I am using. The issue is when the number of questions exceeds 9, the alignment of question statement changes. I need that all of the questions are in same alignment level. The code I used is from someone's solution that I don't remember. Perhaps may be one of them, solution 1, solution 2, and solution 3

A short working example is

\documentclass[10pt,a4paper]{exam}
%%%%%%%%%%% TRUE or FALSE %%%%%%%%%%%%%
\newcommand*\TrueFalse{TRUE\hspace*{8pt} FALSE\hspace*{8pt}}
\newlength\mylena
\newlength\mylenb
\settowidth\mylena{\TrueFalse}
\newcommand\TF[1]{%
    \setlength\mylenb{\linewidth}
    \addtolength\mylenb{-\mylena}
    \parbox[t]{\mylena}{\TrueFalse}\parbox[t]{\mylenb}{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{questions}
\question\TF{The types of statistical inferences are estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}
\end{questions}
\end{document}
4
  • Everything seems to be perfectly aligned, if i make your example compilable. What exactly do you want? Please clarify.
    – Johannes_B
    May 3, 2018 at 5:09
  • Do you want the numbers left aligned?
    – CarLaTeX
    May 3, 2018 at 5:09
  • @Johannes_B : Yes everything works fine, I want to change the alignment of numbers such as left align. I also want any possible improvement (regarding the enhancement of the final compiled content.) in that I could not address in above question. May 3, 2018 at 6:39
  • @CarLaTeX: Yes. I want numbers to left aligned. May 3, 2018 at 6:49

1 Answer 1

3

Fortunately, exam uses \questionlabel to format the question number. One could probably use \makebox instead of \hbox. I just tried this one first.

\documentclass[10pt,a4paper]{exam}
%%%%%%%%%%% TRUE or FALSE %%%%%%%%%%%%%
\newcommand*\TrueFalse{TRUE\hspace*{8pt} FALSE\hspace*{8pt}}
\newlength\mylena
\newlength\mylenb
\settowidth\mylena{\TrueFalse}
\newcommand\TF[1]{%
    \setlength\mylenb{\linewidth}
    \addtolength\mylenb{-\mylena}
    \parbox[t]{\mylena}{\TrueFalse}\parbox[t]{\mylenb}{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\questionlabel}{\hbox to 1.3em{\thequestion.\hfill}}

\begin{document}
\begin{questions}
\question\TF{The types of statistical inferences are estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}

\question\TF{The types of statistical inferences are an estimation of parameters and testing of hypotheses.}

\question\TF{The types of statistical estimation of parameters are point estimation and interval estimation.}

\question\TF{Point estimators may be more useful than interval estimators because probability statements are attached to point estimates.}
\end{questions}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .