# Building a Math Question bank and Web Application for reading them

Idea is to design a Question bank with answers and solutions for math and science subjects, for a web application (Designed in Laravel(php). Typesetting of questions is done in LaTeX.

\documentclass{memoir}

\usepackage{amsthm,amsfonts,amssymb,amsmath}
\usepackage{fourier}

\theoremstyle{definition}
\newtheorem{ex}{Exercise}

\Newassociation{sol}{Solution}{ans}

\begin{document}

\chapter{Exercises}

\Opensolutionfile{ans}[ans1]
\begin{ex}
This is a question.
\begin{sol}
\end{sol}
\end{ex}

\begin{ex}
This is second Question
\begin{sol}
\end{sol}
\end{ex}

\Closesolutionfile{ans}
\input{ans1}
\end{document}


Question 1. Now I am able to pull out questions with their answers wrapped in {ex} environment into mysql table. Laravel web application can call these questions and present them to a view. Is there any way to show them in HTML.

Question 2. Generally a big math Book typeset in LaTeX does contain so many style conventions and abbreviations stacked up in an .sty file. But how to enclose all of them when such {ex} snippets alone are sent to html view.

I tried pdf2htmlEX by coolwanglu, it was excellent in document translation from pdf to html. But my main requirement is randomly popping a question from mysql db, so this way is not useful.

Can somebody suggest me any workflow how to achieve this.

• I probably would not convert LaTeX code to HTML on the fly (takes too much time). Instead I would do this when pulling out the questions and save the HTML code into the database table (might needs some finetuning, e.g. for included images). To translate LaTeX to HTML task by task, there are several options - including the mentioned pdf2htmlEX utility. – epR8GaYuh Aug 17 '18 at 7:38
• So solution is write a big project (Collection) of ex environments. and individually convert them to html via pdf2htmlEX and push them into mysql table. Thanks for the solution. Any templates and scripts if somebody have, please support. – Rama Krishna Majety Aug 17 '18 at 13:37