0

I would like to set up an environment for multiple choice questions, such that the list of the questions and answers as in figure, and some lines of comments like "End", "Thank you very much", will be typeset at the end of the last page. How can I write that?

Something like this:

\documentclass[12pt]{examdesign}
\usepackage{fourier}
\usepackage{xcolor}
\usepackage{amsmath,amsxtra,latexsym, amssymb, amscd}
\usepackage{tikz, pgfplots}
\usetikzlibrary{arrows}
\usepackage[mathletters]{ucs}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage[utf8x]{inputenc}
\usepackage{color}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{times}
\usepackage{dethi} 
\usepackage{booktabs}
\usepackage{multirow,bigstrut}
\usepackage{tabu}
\usepackage{pgfplots,caption}

\usepackage[a4paper,tmargin=1.0cm, bmargin=1.5cm, lmargin=1.5cm, rmargin=1.5cm]{geometry}

\pgfplotsset{
    dirac/.style={
        mark=triangle*,
        mark options={scale=2},
        ycomb,
        scatter,
        visualization depends on={y/abs(y)-1 \as \sign},
        scatter/@pre marker code/.code={\scope[rotate=90*\sign,yshift=-2pt]}
    }
}

\ContinuousNumbering 
\ShortKey
\NumberOfVersions{1} % 
\SectionPrefix{\relax }


\codeexam{821}

\tieudequestion
\tieudeanswer
\tieudeend
\ngoac{}{.}
\chuquestion{Question} 
\mautext{black}
\pagenumber{6}
\renewcommand{\baselinestretch}{1.125}
\NoRearrange
}

and I have an exam.sty file

\ProvidesPackage{exams}
\RequirePackage{ifthen}
\ProcessOptions\relax
\parskip=0pt
\parindent=0pt
\makeatletter


\newcommand{\@Name}{\ }
\newcommand{\@Note}{\ }
\newcommand\@sques{\ }
\newcommand{\@examend}{\ }

\newcounter{codeexam}
\newcommand{\code}[1]{\setcounter{madetracnghiem}{#1}
\addtocounter{codeexam}{-1}}

\newcommand{\Name}[1]{\renewcommand{\@Name}{\makebox[10cm]{{\bf #1:}\dotfill} }}

\newcommand{\Note}[1]{\renewcommand{\@note}{\makebox[10cm]{{\bf #1:}\dotfill} }}
\newcommand{\numberofquestion}[1]{\renewcommand{\@sques}{ #1}}


\makeatother

\renewcommand{\Fullpages}{\setlength{\topmargin}{0pc}
                        \setlength{\oddsidemargin}{0pc}
                        \setlength{\evensidemargin}{0pc}
                        \setlength{\headheight}{0pt}
                        \setlength{\headsep}{0pt}
                        \setlength{\textwidth}{17truecm}
                        \setlength{\textheight}{25truecm}
%\setlength{\hoffset}{-0.5cm}
\setlength{\voffset}{-1cm}
}

\makeatletter
\def\headerofexam{
\begin{examtop}

%-----------------------------

and the figure that I need to doenter image description here

  • ... \begin{center} END \\ \textit{Thank you very much}\end{center}\end{document} ? – Zarko Oct 2 '18 at 7:59
  • @Zarko No, can not make like that.As your suggested, the title is going to up of the page. Because in our multi-choice questions, I mix all of my questions, after 1 run the number of question is change. Do you have any ideas? Thanks – user3727281 Oct 2 '18 at 8:12
  • Please provide a MWE because I tried to help and even an empty document gives errors. I think you shouldn't use this documentclass. The error I get is "You have used a \\ or \newline command where LaTeX was not expecting one." – koleygr Oct 2 '18 at 8:15
  • @koleygr I added more information, please give me your ideas. Thanks a lot – user3727281 Oct 2 '18 at 9:45
  • Use in your preamble: \AtEndDocument{\vfill\begin{center}END\\\textit{Thank you very much}\end{center}}. – Skillmon Oct 2 '18 at 10:03
3

Minimal example showing that our solutions do work:

\documentclass[]{article}

\usepackage{duckuments}
\AtEndDocument
  {\vfill\begin{center}END\\\textit{Thank you very much}\end{center}}

\begin{document}
\duckument
\end{document}

Last page of generated document:

enter image description here

  • \vfill seems to be the key to putting something at the bottom of a page – Robin Oct 2 '18 at 10:14
  • 2
    +1 for duckuments ! – Zarko Oct 2 '18 at 10:16
  • 2
    @Robin yes \vfill inserts one vertical fill glue that moves the contents after it to the bottom of the page. There are different kinds of glue in TeX. If you use \vspace{0pt plus 5pt} that is a stretchable glue worth 5pt (the stretch is applied proportionally). Compared to such stretches a \vfil is infinitely larger and compared to that a \vfill is again infinitely larger. In fact TeX has three levels of infinity when it comes to glue: \vspace{0pt plus 1fil}, \vspace{0pt plus 1fill} and \vspace{0pt plus 1filll}. – Skillmon Oct 2 '18 at 10:34
  • 1
    @user3727281 that might be hard to do right automatically. I think the easiest solution would be to hook into the shipout routine and check which page is to be output. If the next page will be page number 5 then we'd have to change the dimensions of that page and include the contents "End" and "Thank you very much" in the page footer for that one page. And at the next shipout of that page revert those changes. So to make it more clear: I think a manual solution would be easier here. – Skillmon Oct 2 '18 at 12:56
  • 1
    @user3727281, this is no asked in your question. i this also not provide nice Skilmon answer. it is not clear what you like to achieve. probably your question will be closed as unclear what you asking for – Zarko Oct 2 '18 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.