Skip to content

Commit

Permalink
Updates to work with exams2pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmarva committed Jun 23, 2017
1 parent 0f87791 commit c28f141
Show file tree
Hide file tree
Showing 199 changed files with 1,605 additions and 808 deletions.
569 changes: 503 additions & 66 deletions .Rhistory

Large diffs are not rendered by default.

34 changes: 6 additions & 28 deletions 000001.Rnw
Original file line number Diff line number Diff line change
@@ -1,68 +1,46 @@
<<echo=FALSE, results=hide>>=
################################################################################
# PostData Statistics:
# Fernando San Segundo, Marcos Marva
# Web: www.postdata-statistics.com
# Mail: postdatastatistics@gmail.com (secondary: marcos.marva@gmail.es)
################################################################################
## DATA GENERATION
## working with significant figures. Round numbers between 0 and 10 with between 3 up to 5 digits
## DATA GENERATION
library(MASS)
signifDig = 4
# Set value to be rounded
# Set a number to be rounded
n.dig <- sample(6:10, size = 1)
n.sigf <- sample(3:5, size = 1)
options(digits=n.dig)
n = runif(n = 1, min = 0, max = 10)
## QUESTION/ANSWER GENERATION
sol = signif(x = n, digits = n.sigf)
## QUESTION STATEMENT GENERATION
if(language=='en'){
question=paste0("Round the number
\\[
",n,"
\\]
to ",n.sigf," significant figures.")
question=paste0("Round the number \\[ ",n," \\] to ",n.sigf," significant figures.")
answer=paste0("The answer is ", sol)
}else if(language=='es'){
question=paste0("Redondea el n\\'umero
\\[
",n,"
\\]
a ",n.sigf," cifras significativas.")
question=paste0("Redondea el n\\'umero \\[ ",n," \\] a ",n.sigf," cifras significativas.")
answer=paste0("La respuesta es ", sol)
}
cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}


%% META-INFORMATION
%% \extype{num}
%% \exsolution{\Sexpr{sol}}
Expand Down
4 changes: 2 additions & 2 deletions 000002.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 000003.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 000004.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ if(language=='en'){


\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@


\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
32 changes: 8 additions & 24 deletions 01010101.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,37 @@
# Web: www.postdata-statistics.com
# Mail: postdatastatistics@gmail.com (secondary: marcos.marva@gmail.es)
################################################################################
# calculate the mean value
## DATA GENERATION
## QUESTION/ANSWER GENERATION
signifDig <- 4
(n <- sample(8:13, 1))
(data <- c(sample(0:12, n)))
(dataString = paste(data, collapse=", "))
(sol <- signif(mean(data), digits = signifDig))
## QUESTION/ANSWER GENERATION
if(language=='en'){
question=paste0(
"Find the mean of this set of numbers:\\begin{center}",
dataString,
".\\end{center} Round the result to ", signifDig, " significant digits."
)
answer=paste0("The answer is ",
sol
"Find the mean of this set of numbers:\\begin{center}", dataString, ".\\end{center} Round the result to ", signifDig, " significant digits."
)
answer=paste0("The answer is ", sol )
}else if(language=='es'){
question=paste0(
"Calcula la media de este conjunto de n\\'umeros:\\begin{center}",
dataString,
".\\end{center}Redondea el resultado con ",
"Calcula la media de este conjunto de n\\'umeros:\\begin{center}", dataString, ".\\end{center}Redondea el resultado con ",
signifDig, " cifras significativas."
)
answer=paste0("La respuesta es ",
sol
)
answer=paste0("La respuesta es ", sol )
}
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 01010301.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ if(language=='en'){
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 01020101.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ if(language=='en'){
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 01020201.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ if(language=='en'){
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
6 changes: 3 additions & 3 deletions 01020301.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ signifDig <- 4
(data <- c(sample(0:12, n, replace=TRUE)))
## QUESTION/ANSWER GENERATION
(sol <- signif(var(data)), digits = signifDig))
(sol <- signif(var(data), digits = signifDig))
(dataString = paste(data, collapse=", "))
Expand Down Expand Up @@ -46,13 +46,13 @@ if(language=='en'){
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
4 changes: 2 additions & 2 deletions 01020401.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ if(language=='en'){
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@
\end{solution}
Expand Down
6 changes: 3 additions & 3 deletions 01030401.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if(language=='en'){
questions[2]= " Muestra 2"
questions[3]= " Muestra 3"
question=paste0("El histograma describe lo datos que representa uno de los diagramas de caja y bigotes,
\\textquestiondown con cu\\'al? ")
\\textquestiondown cu\\'al es? ")
}
cat(question)
Expand All @@ -54,12 +54,12 @@ cat(question)
@
\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@
\begin{figure}[h!]
\begin{center}
<<fig=TRUE, height=7, width=7, echo=FALSE, eps=FALSE, results=hide>>=
<<fig=TRUE, height=5, width=5, echo=FALSE, eps=FALSE, results=hide>>=
par(mfrow=c(2,2))
hist(unlist(lista[sol]), main = "", xlab = "", xlim=c(min(solData), max(solData)))
boxplot(sample1, xlab = "", main="Sample 1", horizontal = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions 01030402.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ if(language=='en'){
questions[2]= " Muestra 2"
questions[3]= " Muestra 3"
question=paste0("El diagrama de caja y bigotes describe los datos que representan uno de los histogramas,
\\textquestiondown con cu\\'al?")
\\textquestiondown cu\\'al es?")
}
cat(question)
@
\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@

Expand Down
10 changes: 6 additions & 4 deletions 020001.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ Calculate $P(A\\cup B)$ with ",signifDig," significant digits.
}else if(language=='es'){
question=paste0("Los sucesos $A$ y $B$, cumplen:
\\[
$$
P(A)=\\left(\\frac{",numPA,"}{",denPA,"}\\right) \\qquad
P(B)=\\left(\\frac{",numPB,"}{",denPB,"}\\right) \\qquad
P(A\\cap B)=\\left(\\frac{",numPAB,"}{",denPAB,"}\\right)
\\]
$$
Calcula el valor de $P(A\\cup B)$. Utiliza ",signifDig," cifras significativas en tu respuesta.
")
Expand All @@ -74,15 +74,17 @@ cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@

\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@

\end{solution}


Expand Down
6 changes: 4 additions & 2 deletions 020002.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@

\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@

\end{solution}


Expand Down
6 changes: 4 additions & 2 deletions 020003.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ cat(question)
@

\begin{question}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(question,collapse=""))
@

\end{question}

\begin{solution}
<<echo=False, results=tex>>=
<<echo=False, results=tex,strip.white=false,strip.white=false,strip.white=false>>=
cat(paste(answer,collapse=""))
@

\end{solution}


Expand Down
Loading

0 comments on commit c28f141

Please sign in to comment.