1

I am trying to write exam questions for students. Just like any standard exam paper, each question needs to have its associated point (i.e. score) aligned at the right side of the page. I used the following codes to

\documentclass[12pt]{article}
\usepackage[top= .8in, bottom= .8in, left=.8in, right=.8in]{geometry}
\usepackage{amsmath}

\begin{document}

\begin{center}

\large{\textbf{ECO361: Environmental Economics}} \\
\vspace{.5cm}
\textbf{Midterm 2} \\
Total points: 
\vspace{1cm}
\end{center}

\begin{enumerate}
\item Suppose there are two sources of the same pollutant, Source 1 \& Source 2. State two possible reasons why blah blah? \hspace*{11.5cm} \textbf{4}
\item Define marginal abatement cost (MAC). Draw an MAC curve of a firm which has to make a substantial outlay blah blah. \hspace*{10.5cm} \textbf{3}                                                            
\end{enumerate}

\end{document}

It is very cumbersome to find the correct input for \hspace* for each different item by trial and error. Is there any way this could be done without specifying the measure like 11.5cm or 10.5? It seems that \hspace*{\hfill} does not work in an "itemize" environment. Any easy suggestions, please?

5
  • \hspace*{\fill} forces the numbers to be flush to the right margin, what position do you want that you considers "works" ? Nov 10, 2017 at 0:18
  • 1
    also note that \large does not take an argument so you do not need the brace after \large{ or the matching } Nov 10, 2017 at 0:20
  • If I use \hspace*{\fill} in an "itemize" environment, the code gives the following error: ! Illegal unit of measure (pt inserted). <to be read again> \hfill l.20 ...icient level of emission. \hspace*{\hfill}
    – TRa
    Nov 10, 2017 at 0:25
  • 1
    no you did something wrong if you use \hspace*{\fill} in your test file you get this If you want help with an error it's usually best to make the example show the error so it can be debugged oh that's what you did wrong, it is \fill not \hfill that should be the argument of \hspace Nov 10, 2017 at 0:30
  • @DavidCarlisle thank you so much for pointing out my mistake. I was using \hfill instead of \fill. Now, it's all good. Thanks for your time.
    – TRa
    Nov 10, 2017 at 0:39

1 Answer 1

1
\hspace*{\hfill}

does not work anywhere, \hfill is a comand to add a space, not a length, you intended

\hspace*{\fill}

using that form in your test file produces:

enter image description here

You must log in to answer this question.

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