I want to create a worksheets which is similar to the first example.
The below code meets three problems.
- It can not be breakable
- Two examples are not top align
- The command create dot lines, sometimes generate error.
Please suggest me another method or correct the below codes. Thank you very much!
\documentclass[12pt]{book}
\usepackage[paperwidth=21cm,paperheight=29.7cm,top=2.5cm,bottom=2cm,left=2cm,right=1.5cm]{geometry}
\setlength{\parindent}{0.6cm}
\setlength{\parskip}{6pt}
\linespread{1.1}
\usepackage{tikz}
\usepackage{adjustbox}
\newlength\myheight
\newlength{\myheightn}
\usepackage{multido}
\newcommand{\twocols}[2]{
\par\noindent
\begin{adjustbox}{minipage=[t]{0.5\linewidth},gstore totalheight=\myheight,margin=\fboxsep+\fboxrule}
\vspace*{0pt}
{\bfseries\fontfamily{qag}\selectfont Example 1}. #1
\end{adjustbox}
\hspace*{\fboxsep}
\begin{adjustbox}{minipage=[t][\myheight]{0.5\linewidth}}
\vspace*{0pt}
\begin{adjustbox}{minipage=[t]{0.95\linewidth},gstore totalheight=\myheightn,margin=\fboxsep+\fboxrule}
{\bfseries\fontfamily{qag}\selectfont Example 2}. #2
\end{adjustbox}
\edef\sodongt{\the\numexpr\dimexpr (\myheight-\myheightn)/(\dimexpr 1.1\baselineskip\relax) \relax\relax}
\pgfmathsetmacro{\sodong}{int(\sodongt-1)}
\par
\noindent \makebox[0.975\linewidth]{{\bfseries\fontfamily{qag}\selectfont\color{blue}Solution}:\dotfill}
\multido{}{\sodong}{\vspace*{2pt}\noindent\makebox[0.975\linewidth]{\dotfill}\newline}
\end{adjustbox}
}
\usepackage{lipsum}
\begin{document}
\twocols{\lipsum[12]}{a}
\end{document}


