A strange output of book class
up vote
0
down vote
favorite
I am writing an mcq book using book class. The main.tex is as under.
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
usepackage[english]{babel}
usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,kantlipsum}
usepackage[dvips]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
usepackage{syntonly}
newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a skew- symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=newmatrix{ccc}{0 & 1 & 0\0 & 0 & 1\1 & 0 & 0}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectnewmatrix{ccc}{1 & 1 & 1\1 & 1 & 1\1 & 1 & 1}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
end{document}
When I run this code in overleaf the following strange output has been obtained.
Chapter two has different output than chapter one.
Please help me.
Many thanks in advance.
books
add a comment |
up vote
0
down vote
favorite
I am writing an mcq book using book class. The main.tex is as under.
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
usepackage[english]{babel}
usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,kantlipsum}
usepackage[dvips]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
usepackage{syntonly}
newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a skew- symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=newmatrix{ccc}{0 & 1 & 0\0 & 0 & 1\1 & 0 & 0}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectnewmatrix{ccc}{1 & 1 & 1\1 & 1 & 1\1 & 1 & 1}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
end{document}
When I run this code in overleaf the following strange output has been obtained.
Chapter two has different output than chapter one.
Please help me.
Many thanks in advance.
books
1
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?
– David Carlisle
2 days ago
2
size commands do not take an argument soHuge{Hint/Explanation of Selected Problems:}
makes the rest of the documentHuge
but normally avoid explicit fonts and spacing,section*{Hint/Explanation of Selected Problems:}
?
– David Carlisle
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am writing an mcq book using book class. The main.tex is as under.
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
usepackage[english]{babel}
usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,kantlipsum}
usepackage[dvips]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
usepackage{syntonly}
newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a skew- symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=newmatrix{ccc}{0 & 1 & 0\0 & 0 & 1\1 & 0 & 0}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectnewmatrix{ccc}{1 & 1 & 1\1 & 1 & 1\1 & 1 & 1}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
end{document}
When I run this code in overleaf the following strange output has been obtained.
Chapter two has different output than chapter one.
Please help me.
Many thanks in advance.
books
I am writing an mcq book using book class. The main.tex is as under.
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
usepackage[english]{babel}
usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,kantlipsum}
usepackage[dvips]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
usepackage{syntonly}
newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a skew- symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=newmatrix{ccc}{0 & 1 & 0\0 & 0 & 1\1 & 0 & 0}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectnewmatrix{ccc}{1 & 1 & 1\1 & 1 & 1\1 & 1 & 1}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
bigskip
Huge{Answer Key:}
bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
bigskip
Huge{Hint/Explanation of Selected Problems:}
bigskipbigskip
showallanswers
end{document}
When I run this code in overleaf the following strange output has been obtained.
Chapter two has different output than chapter one.
Please help me.
Many thanks in advance.
books
books
asked 2 days ago
Arindam Bandyopadhyay
274
274
1
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?
– David Carlisle
2 days ago
2
size commands do not take an argument soHuge{Hint/Explanation of Selected Problems:}
makes the rest of the documentHuge
but normally avoid explicit fonts and spacing,section*{Hint/Explanation of Selected Problems:}
?
– David Carlisle
2 days ago
add a comment |
1
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?
– David Carlisle
2 days ago
2
size commands do not take an argument soHuge{Hint/Explanation of Selected Problems:}
makes the rest of the documentHuge
but normally avoid explicit fonts and spacing,section*{Hint/Explanation of Selected Problems:}
?
– David Carlisle
2 days ago
1
1
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?– David Carlisle
2 days ago
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?– David Carlisle
2 days ago
2
2
size commands do not take an argument so
Huge{Hint/Explanation of Selected Problems:}
makes the rest of the document Huge
but normally avoid explicit fonts and spacing, section*{Hint/Explanation of Selected Problems:}
?– David Carlisle
2 days ago
size commands do not take an argument so
Huge{Hint/Explanation of Selected Problems:}
makes the rest of the document Huge
but normally avoid explicit fonts and spacing, section*{Hint/Explanation of Selected Problems:}
?– David Carlisle
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
%%NO!!! two documentclass documentclass[12pt,a4paper]{book}
%% NO already loaded usepackage{amsmath,amsthm}
%% NO already loaded usepackage{ifthen,amsfonts,amssymb,dsfont}
%% NO already loaded usepackage{etoolbox,multicol}
usepackage[english]{babel}
% not in areal document usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,
% not in a real documentkantlipsum
}
usepackage[
% NO dvips
]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
%NO! This disables almost all of latex if you use it usepackage{syntonly}
% No use pmatrix from amsmath newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
% OK but this is not colour safe, don't use colour in this environment
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a
% no space in skew- symmetric
skew-symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=begin{pmatrix}0 & 1 & 0\0 & 0 & 1\1 & 0 & 0end{pmatrix}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectbegin{pmatrix}1 & 1 & 1\1 & 1 & 1\1 & 1 & 1protectend{pmatrix}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
% NO (this makes entire document Huge Huge{Answer Key:}
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
%Huge
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
end{document}
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
%%NO!!! two documentclass documentclass[12pt,a4paper]{book}
%% NO already loaded usepackage{amsmath,amsthm}
%% NO already loaded usepackage{ifthen,amsfonts,amssymb,dsfont}
%% NO already loaded usepackage{etoolbox,multicol}
usepackage[english]{babel}
% not in areal document usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,
% not in a real documentkantlipsum
}
usepackage[
% NO dvips
]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
%NO! This disables almost all of latex if you use it usepackage{syntonly}
% No use pmatrix from amsmath newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
% OK but this is not colour safe, don't use colour in this environment
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a
% no space in skew- symmetric
skew-symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=begin{pmatrix}0 & 1 & 0\0 & 0 & 1\1 & 0 & 0end{pmatrix}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectbegin{pmatrix}1 & 1 & 1\1 & 1 & 1\1 & 1 & 1protectend{pmatrix}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
% NO (this makes entire document Huge Huge{Answer Key:}
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
%Huge
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
end{document}
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
add a comment |
up vote
2
down vote
accepted
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
%%NO!!! two documentclass documentclass[12pt,a4paper]{book}
%% NO already loaded usepackage{amsmath,amsthm}
%% NO already loaded usepackage{ifthen,amsfonts,amssymb,dsfont}
%% NO already loaded usepackage{etoolbox,multicol}
usepackage[english]{babel}
% not in areal document usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,
% not in a real documentkantlipsum
}
usepackage[
% NO dvips
]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
%NO! This disables almost all of latex if you use it usepackage{syntonly}
% No use pmatrix from amsmath newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
% OK but this is not colour safe, don't use colour in this environment
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a
% no space in skew- symmetric
skew-symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=begin{pmatrix}0 & 1 & 0\0 & 0 & 1\1 & 0 & 0end{pmatrix}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectbegin{pmatrix}1 & 1 & 1\1 & 1 & 1\1 & 1 & 1protectend{pmatrix}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
% NO (this makes entire document Huge Huge{Answer Key:}
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
%Huge
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
end{document}
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
%%NO!!! two documentclass documentclass[12pt,a4paper]{book}
%% NO already loaded usepackage{amsmath,amsthm}
%% NO already loaded usepackage{ifthen,amsfonts,amssymb,dsfont}
%% NO already loaded usepackage{etoolbox,multicol}
usepackage[english]{babel}
% not in areal document usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,
% not in a real documentkantlipsum
}
usepackage[
% NO dvips
]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
%NO! This disables almost all of latex if you use it usepackage{syntonly}
% No use pmatrix from amsmath newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
% OK but this is not colour safe, don't use colour in this environment
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a
% no space in skew- symmetric
skew-symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=begin{pmatrix}0 & 1 & 0\0 & 0 & 1\1 & 0 & 0end{pmatrix}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectbegin{pmatrix}1 & 1 & 1\1 & 1 & 1\1 & 1 & 1protectend{pmatrix}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
% NO (this makes entire document Huge Huge{Answer Key:}
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
%Huge
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
end{document}
documentclass[12pt,a4paper]{book}
usepackage{amsmath,amsthm}
usepackage{ifthen,amsfonts,amssymb,dsfont}
usepackage{etoolbox,multicol}
%%NO!!! two documentclass documentclass[12pt,a4paper]{book}
%% NO already loaded usepackage{amsmath,amsthm}
%% NO already loaded usepackage{ifthen,amsfonts,amssymb,dsfont}
%% NO already loaded usepackage{etoolbox,multicol}
usepackage[english]{babel}
% not in areal document usepackage{blindtext}
usepackage{geometry}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{enumitem,
% not in a real documentkantlipsum
}
usepackage[
% NO dvips
]{graphicx,color}
usepackage{verbatim, pstricks,ulem}
%NO! This disables almost all of latex if you use it usepackage{syntonly}
% No use pmatrix from amsmath newcommand{newmatrix}[2]{left(begin{array}{#1} #2end{array}right)}
newboxallanswerkeys
setboxallanswerkeys=vbox{}
newenvironment{answerkey}{%
globalsetboxallanswerkeys=vboxbgroup
unvboxallanswerkeys
}%
{%
bigbreak
egroup
}
newcommand{showallanswerkeys}{parunvboxallanswerkeys}
newcommand*{getanswerkeys}[6]{%
item[theenumi.]begin{answerkey}(#5)end{answerkey}
}
newboxallanswers
setboxallanswers=vbox{}
newenvironment{answer}{%
% OK but this is not colour safe, don't use colour in this environment
globalsetboxallanswers=vboxbgroup
unvboxallanswers
}%
{%
bigbreak
egroup
}
newcommand{showallanswers}{parunvboxallanswers}
newcommand*{getanswer}[6]{%
ifthenelse{equal{#6}{}}{}{
item[theenumi.]begin{answer}(#5)~#6end{answer}
}}
setlengthparindent{0pt}
newcommand{fourch}[6]{
par
begin{tabular}{*{4}{@{}p{0.23textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{twoch}[6]{
par
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(a)~#1 & (b)~#2
end{tabular}
par%vspace{4pt}
begin{tabular}{*{2}{@{}p{0.46textwidth}}}
(c)~#3 & (d)~#4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newcommand{onech}[6]{
%par
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(a) & #1
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(b) & #2
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(c) & #3
end{tabular}vspace{2pt}
begin{tabular}{@{}p{0.04textwidth}@{}p{0.91textwidth}}
(d) & #4
end{tabular}
getanswer{#1}{#2}{#3}{#4}{#5}{#6}
getanswerkeys{#1}{#2}{#3}{#4}{#5}{#6}
}
newlengthwidthcha
newlengthwidthchb
newlengthwidthchc
newlengthwidthchd
newlengthwidthch
newlengthtabmaxwidth
setlengthtabmaxwidth{0.96textwidth}
newlengthfourthtabwidth
setlengthfourthtabwidth{0.25textwidth}
newlengthhalftabwidth
setlengthhalftabwidth{0.5textwidth}
newcommand{choice}[6]{%
settowidthwidthcha{AM.#1}setlength{widthch}{widthcha}%
settowidthwidthchb{BM.#2}%
ifdimwidthch<widthchbrelaxsetlength{widthch}{widthchb}fi%
settowidthwidthchb{CM.#3}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
settowidthwidthchb{DM.#4}%
ifdimwidthch<widthchbrelaxsetlength{widthch} {widthchb}fi%
ifdimwidthch>halftabwidth
onech{#1}{#2}{#3}{#4}{#5}{#6}
elseifdimwidthch<halftabwidth
ifdimwidthch>fourthtabwidth
twoch{#1}{#2}{#3}{#4}{#5}{#6}
else
fourch{#1}{#2}{#3}{#4}{#5}{#6}
fififi}
newcommand{mcq}[8]{
item #2
choice{#3}{#4}{#5}{#6}{#7}{#8}
}
defdatabaseone{
mcq{245}{Let $A$ be a symmetric matrix of order $n$ and $B$ be a
% no space in skew- symmetric
skew-symmetric matrix of order $n$. Then which one of the following is a skew-symmetric matrix?}{$A^{2}$}{$B^{2}$}{$AB+BA$}{$AB-BA$}{c}{}{}
mcq{248}{A square matrix is a diagonal matrix if and only if it is}{upper triangular}{lower triangular}{both upper triangular and lower triangular}{none of these}{c}{}{}
mcq{249}{Let $A$ be a non-singular matrix of order $3$. Then the rank of matrix $A^{2018}$ is}{$1$}{$2$}{$3$}{$9$}{c}{Note that $A^{2018}$ is a non-singular matrix of order $3$. Hence rank $(A^{2018})=3$.}{}
mcq{250}{If $A=begin{pmatrix}0 & 1 & 0\0 & 0 & 1\1 & 0 & 0end{pmatrix}$, then rank of the matrix $A+A^{2}+A^{3}$ is}{$1$}{$2$}{$3$}{none of these}{a}{Note that $A+A^{2}+A^{3}=protectbegin{pmatrix}1 & 1 & 1\1 & 1 & 1\1 & 1 & 1protectend{pmatrix}$. Hence rank $(A+A^{2}+A^{3})=1$}{}
}
begin{document}
chapter{One}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
% NO (this makes entire document Huge Huge{Answer Key:}
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
chapter{Two}
begin{enumerate}
databaseone
end{enumerate}
%bigskip
%Huge
section*{Answer Key:}
%bigskip
begin{center}
begin{multicols}{6}
showallanswerkeys
end{multicols}
end{center}
%bigskip
%Huge
section*{Hint/Explanation of Selected Problems:}
%bigskipbigskip
showallanswers
end{document}
answered 2 days ago
David Carlisle
477k3811061840
477k3811061840
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
add a comment |
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
Thank you for your quick and intelligent reply. This works excellently. But if I change usepackage{geometry} by usepackage[ top=1cm, bottom=1cm, left=2cm, right=2cm, headheight=17pt, includehead,includefoot, heightrounded]{geometry} , then there is an error in question 2 in chapter 1 and 2 both. How can I overcome this situation?
– Arindam Bandyopadhyay
2 days ago
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
@ArindamBandyopadhyay it's not an error it's just an overfull box saying that something is a bit wider than the specified space, but if it looks Ok for this type of document you may just let that go
– David Carlisle
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460494%2fa-strange-output-of-book-class%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
usepackage[dvips]{graphicx,color}
is overleaf really using latex+dvips and not pdflatex?– David Carlisle
2 days ago
2
size commands do not take an argument so
Huge{Hint/Explanation of Selected Problems:}
makes the rest of the documentHuge
but normally avoid explicit fonts and spacing,section*{Hint/Explanation of Selected Problems:}
?– David Carlisle
2 days ago