如何使考试题目的标记右对齐?

如何使考试题目的标记右对齐?

我想用 latex 准备一份试卷,其中问题的依据点应右对齐。我尝试使用 article 文档类,但没有成功。

梅威瑟:

\documentclass[11pt,a4paper]{article}
\usepackage{amssymb,amsmath,fullpage}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\chead{(\thepage)}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}     
\newcommand{\marksA}[1]{\hfill\makebox[0pt][l]{~#1}}
\begin{document}
\thispagestyle{empty}
\pagenumbering{roman}       
\begin{flushright}
\it\small   H(I)-Mathematics-H-I(Module-I)
\end{flushright}

    \begin{center}
        \textbf{\Large 2017}\\[2ex]
        \textbf{MATHEMATICS - HONOURS}\\
        \textbf{\small First Paper}\\
        \textbf{(Module-I)}\\
        \textbf{\small  Full Marks - 50}\\[2ex]
        {   \it The figures in the margin indicate full marks.}\\ 
        {\it    Candidates are requested to  give their answer in their own words as far as practicable}
    \end{center}            

    % FRONT Matter 

    \pagenumbering{arabic}

    \begin{center}
    \bf     Group - A\\
    (Marks - 35)
    \end{center}
    \begin{center}
        Answer \textit{any seven} questions
    \end{center}
    \begin{enumerate}

        \item  State the ``First Principle of Mathematical Induction". Using this principle show htat $10^{n+1}+10^n+1$ is divisible by $3$ for all positive integers $n$.  \marksA{$1+4$}
    \item   
        \begin{enumerate}
            \item Prove that $\phi(3n)=3\phi(n)$ if and only if $3$ is a divisor of $n$.   \marksA{$3$}

            \begin{multicols}{2}
                \begin{enumerate}[(i)]
                    \item $\{x^2:x\in [0,1]\}$
                    \item $\{ 5+\sqrt{7}t:t\in \mathbb{Q} \}$
                    \item $(0,1])\cap (\mathbb{R}\setminus \mathbb{Q})$
                    \item $\{\frac{1}{x}:x\in(0,\infty) \}$
                \end{enumerate}
            \end{multicols}     


            \item item 
        \end{enumerate}
  \end{enumerate}
 \end{document}. 

输出:
在此处输入图片描述

答案1

这是“布尔巴基诡计”,另外测量宽度并将最大值存储在辅助文件中。

这需要两次运行 LaTeX 才能稳定下来。

\documentclass[11pt,a4paper]{article}
\usepackage{amssymb,amsmath,fullpage}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\chead{(\thepage)}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\newlength{\finalwidth}
\newlength{\tempwidthA}
\newlength{\tempwidthB}
\makeatletter
\AtEndDocument{\write\@auxout{\global\finalwidth=\the\tempwidthB}}
\makeatother
\newcommand{\marksA}[1]{% the Bourbaki trick
  \settowidth{\tempwidthA}{\quad#1}%
  \ifdim\tempwidthA>\tempwidthB \global\tempwidthB=\tempwidthA\fi
  \unskip
  {\nobreak\hfill\penalty50\hskip1em\null\nobreak
   \hfill \makebox[0pt][l]{\makebox[\finalwidth][r]{\normalfont\quad#1}}%
   \parfillskip=0pt \finalhyphendemerits=0 \par}%
}

\begin{document}
\thispagestyle{empty}
\pagenumbering{roman}

\begin{flushright}
\itshape H(I)-Mathematics-H-I(Module-I)
\end{flushright}

\begin{center}
  \textbf{\Large 2017}\\[2ex]
  \textbf{MATHEMATICS -- HONOURS}\\
  \textbf{First Paper}\\
  \textbf{(Module-I)}\\
  \textbf{Full Marks -- 50}\\[2ex]
  {\itshape The figures in the margin indicate full marks.}\\
  {\itshape Candidates are requested to give their answer in their
            own words as far as practicable}
\end{center}

% FRONT Matter

\pagenumbering{arabic}

\begin{center}
\textbf{Group -- A}\\
(Marks - 35)
\end{center}
\begin{center}
Answer \textit{any seven} questions
\end{center}
\begin{enumerate}

\item State the ``First Principle of Mathematical Induction''. 
      Using this principle show that $10^{n+1}+10^n+1$ is divisible 
      by $3$ for all positive integers $n$.  \marksA{$1+4$}
\item
  \begin{enumerate}
  \item Prove that $\phi(3n)=3\phi(n)$ if and only if $3$ is a divisor of $n$.\marksA{$3$}

  \begin{multicols}{2}
  \begin{enumerate}[(i)]
  \item $\{x^2:x\in [0,1]\}$
  \item $\{ 5+\sqrt{7}t:t\in \mathbb{Q} \}$
  \item $(0,1])\cap (\mathbb{R}\setminus \mathbb{Q})$
  \item $\{\frac{1}{x}:x\in(0,\infty) \}$
  \end{enumerate}
  \end{multicols}

\item item
\end{enumerate}
\end{enumerate}
\end{document}

我做了一些更改:我发现这\small并没有增加什么,只是字体大小发生了奇怪的变化。也不\it应该在新文档中使用:它已经过时并被弃用了 25 年多。结束引号应该输入为''(两个撇号) 而不是"

在此处输入图片描述

相关内容