3

I would like to create this sheet which was made it by adobe indesign

Could someone create it with latex ?

enter image description here

Here's my code:

\documentclass[12pt,a4paper,twocolumn]{report}
\usepackage[margin=0.5in]{geometry}
\usepackage[french]{babel}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{amsthm,amssymb,amsfonts,mathtools}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{array}
\usepackage{graphicx}
\setlength{\columnseprule}{0.5pt}
\thispagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%head%%%%%%%%%%%%%%%%%%%%%%%
\twocolumn[ 
  \begin{@twocolumnfalse}
 \begin{center}
 \fbox{\Large Exercise Sheets}
\end{center}
    \hrulefill
\end{@twocolumnfalse}
  ]
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \fbox{ Exercise $1$:}\\
 Compute the following limits
\begin{multicols}{2}
\begin{enumerate}
\item $\lim_{x\to 2}\dfrac{4x^{3}-5x-22}{x^{2}-x-2}$
\item $\lim_{x\to 0^{+}}\dfrac{x-\sqrt{x}}{x+\sqrt{x}}$
\item $\lim_{x\to 1}\dfrac{\sqrt{x+3}+\sqrt{x}-3}{x-1}$
\item $\lim_{x\to 2}\dfrac{x^{2}\sqrt{x+2}-8}{4-x^{2}}$
\end{enumerate}
\end{multicols}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fbox{ Exercise $2$:}\\
Let $n\in\mathbb{N}^{*}$
\begin{enumerate}
    \item calculate : ${\displaystyle \lim_{x\to 0}\dfrac{1-\cos(x)\cos(2x)\ldots+\cos(nx)}{x^2} }$
    \item b
    \item c
    \item d
    \item e
    \item f
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
  • 2
    You could do that with tcolorbox which is really well documented (especially have a look at the options for attached and detached titles). Maybe you do some first steps on your own and then ask for more support. – TeXnician Feb 21 '17 at 20:47
  • 2
    @TeXnician: That was my first idea too, perhaps with a raster, but that isn't breakable (if I remember correctly) – user31729 Feb 23 '17 at 21:43
  • Is the distracting stuff in the background part of the design? – cfr Feb 23 '17 at 22:32
  • Don't load packages more than once as it is a recipe for confusions. – cfr Feb 23 '17 at 22:36
  • Please do not edit questions in a way that invalidates existing answers or which incorporates answers into the question, eliminating the original question. This makes it very hard for people to understand the question the answers address, especially if you've chosen one answer, so that the other now bears no obvious relation to the question at all. If you edit, remember that your edit should not distort the original, especially once ther are answers. If necessary, you can always ask a follow-up as a new question, linking to the original. – cfr Feb 25 '17 at 1:35
3

I have revised my answer considerably. The following is the result. There are some comments in the code to help out.

Using tikz.sty and eso-pic.sty you can achieve something like this, without the need for manually breaking the text. This is a proof-of-concept and I will add to it later when I get a chance. Still, this might be a beginning.

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX


\documentclass{article}

\usepackage{tikz}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{tikzpagenodes}
\usepackage{eso-pic}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage[margin=1in]{geometry}

\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\setsansfont{Helvetica Neue}[Scale=0.9]

\usetikzlibrary{calc}
\usetikzlibrary{shapes.multipart}

\newcounter{exrc}

\newcommand{\exstep}{%
    \stepcounter{exrc}%
    \tikz[baseline]\node[anchor=base,%
        rectangle split,
        rectangle split parts=2,
        draw=gray,
        thick,
        rectangle split horizontal,
        rectangle split part fill={gray,white},
        inner sep=3pt] (exx) at (0,0)
        {\textcolor{white}{\bfseries \extype}\nodepart{two}\theexrc};
}

\AddToShipoutPictureBG{%
    \begin{tikzpicture}[remember picture,overlay]
        \draw[thick,rounded corners]
            ($(current page text area.south west)+(-12pt,-12pt)$)
                rectangle 
                ($(current page text area.north east)+(12pt,12pt)$);
        \node[white,fill=gray,rounded corners]
                at ($(current page text area.north)+(0,12pt)$) 
                %% Change `Exercises' to suit
                {\bfseries\sffamily\hspace*{1em}Exercises\hspace*{1em}};
    \end{tikzpicture}
}

%% There are two environments, `exci` for exercises using `enumerate`,
%% and `exct` for text exercises that do not use `enumerate`.
%% Both have an optional argument to change the name of the
%% exercise on the fly. See the included examples.

\newenvironment{exci}[2][Exercise]{%
    \def\extype{#1}%
    \leavevmode\exstep\par
    \smallskip
    #2
    \begin{enumerate}[leftmargin=*,noitemsep,nosep]
}{%
    \end{enumerate}
    \bigskip
    \def\extype{Exercise}%
}

\newenvironment{exct}[1][Exercise]{%
    \def\extype{#1}%
    \leavevmode\exstep\par
    \smallskip
    }{%
        \bigskip
        \def\extype{Exercise}%
}

\setlength{\columnseprule}{0.4pt}
\parindent0pt

\begin{document}

\begin{multicols*}{2}

\begin{exci}{Calculate the following limits:}
\item $\lim\displaylimits_{x \to2}\frac{4x^3-5x-22}{x^2-x-2}$
\item $\lim\displaylimits_{\substack{x \to 0\\x > 0}}\frac{x-\sqrt{x}}{x+\sqrt{x}}$
\item $\lim\displaylimits_{x \to 0}\frac{\sqrt{x+3}+\sqrt{x}-3}{x-1}$
\item $\lim\displaylimits_{x \to 2}\frac{x^2\sqrt{x+2}-8}{4-x^2}$
\end{exci}

\begin{exci}{Let $n \in \mathbb{N}^*$}
\item Calculate: $\lim_{x \to 0}\frac{1-\cos(x)\cos(2x)\cdots+\cos(nx)}{x^2}$
\item Calculating as a function of n the following limit: $\lim_{x \to 1}\frac{1+x+x^2+\cdots+x^n-n}{(2-x)^n-1}$
\end{exci}

\begin{exct}
Let $f$ be the continuous function on $[0,+\infty]$ having a finite limit at $+\infty$. 

Show that $f$ is bounded.
\end{exct}

\begin{exci}{This is a $E=mc^2$ test of this environment}
\item True
\item False
\end{exci}

\begin{exci}[Extra credit]{This is a $E=mc^2$ test of this environment}
\item True
\item False
\end{exci}

\begin{exct}[Exercise*]
This is yet another one without an enumerate.
\end{exct}

\end{multicols*}

\end{document}

Improvements are no doubt possible and welcome. Note that I have used STIX 2.0 with XeLaTeX and unicode-math.sty.

More accurate implementation

I corrected a problem with my implementation of the format.

  • +1 your way is great but still need to test it by adding some exercises waiting for ur improvements thanks again – Educ Feb 24 '17 at 15:01
  • 2
    This format won't adjust the border on last page. – Ignasi Feb 24 '17 at 15:11
  • 2
    @Educ When you say "I would like to create this sheet which was made it by adobe indesign" I trust that you do not want to replicate the execrable math typesetting as well. – sgmoye Feb 24 '17 at 15:23
  • 1
    @Niko Z Quite so. You would need to have the fonts available in the way that Overleaf requires -- I'm not familiar with it so can't help you there. If you comment-out the font calls, you should also comment-out \usepackage{unicode-math} as well. My original goal was to replicate the original example which used a Times-like typeface -- I chose STIX. For the sans typeface I used Helvetica Neue. Neither is essential to the TeX file. – sgmoye Feb 27 '17 at 14:05
  • 1
    @Niko Z. I note that the STIX fonts are available on Overleaf, but these are very likely version 1.x which is now deprecated. As a user, you should submit a request that they update their STIX fonts to version 2, which was released late last year. For Helvetica, try Numbus Sans L, which is available to Overleaf. – sgmoye Feb 27 '17 at 14:14
7

I think that the main problem for this format is that you want a two columns format inside a decorated bounding box.

Combination of tcolorbox and multiple columns is possible but under certain conditions. A breakable tcolorbox can be used inside a multicolumn, but the box is applied to each column. You could also use a multicol environment inside a tcolorbox but only if the box is unbreakable. So, I think that there is no easy solution.

But if you don't mind to have a non automatic solution, tcolorbox can be used. Following code shows this partial and non automatic solution based in magazine and raster libraries.

magazine library allows to break and store a text in several boxes than can be used later on. With this tool, it's possible to break the text into "onecolumn wide x fixed height" fragments.

\begin{tcolorbox}[blanker, 
width=.4\textwidth,      %<-------- column width
breakable,
break at=.93\textheight,       %<----- column height
height fixed for=first and middle,
watermark text=\arabic{tcbbreakpart},
reset box array,
store to box array,]
\lipsum[1-7]              %<---- Here is the text
\end{tcolorbox}

Once you have all the text in fragment, it's possible to manually compose it into a breakable raster which can be decorated like any other tcolorbox. In this case a boxed tcbitemize environment can do the work.

\begin{tcboxeditemize}[
     blanker, raster columns=2, sharp corners, 
     halign=center, raster valign=top]   %<--- inner boxes format and distribution
     {breakable, colback=yellow!10, 
      fonttitle=\bfseries, 
      attach boxed title to top center={yshift*=-\tcboxedtitleheight/2},      
      title=Exercicies, 
      overlay={\draw [shorten >=4mm, shorten <=4mm] 
           (frame.north)--(frame.south);}}  %<--- Format for outer box
  %--- Raster contents ---%
  \tcbitem\consumeboxarray{1}   %<---- First column
  \tcbitem\consumeboxarray{2}   %<---- Second column
  \tcbitem\consumeboxarray{3}   % ...
  \tcbitem\consumeboxarray{4}
\end{tcboxeditemize}

Unfortunately I don't know how to use a foreach inside a tcbraster so we have to manually insert as many \tcbitem\consumebnoxarray{...} lines as fragments on our text.

The final result looks like:

enter image description here

If you know how many fragments you have, the second last one could be shorter and you'll get a better balanced last page, but this is out of this solution.

Also the inner format of exercises has been left out of the code. This one just try to show a possible starting point.

The complete code to get previous image is:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{multicol}
\usepackage{lipsum}

\begin{document}
\begin{tcolorbox}[blanker, 
width=.4\textwidth,
breakable,
break at=.93\textheight,
height fixed for=first and middle,
watermark text=\arabic{tcbbreakpart},
reset box array,
store to box array,]
\lipsum[1-7]
\end{tcolorbox}

\begin{tcboxeditemize}[blanker, raster columns=2, sharp corners, halign=center, raster valign=top]{breakable, colback=yellow!10, fonttitle=\bfseries, attach boxed title to top center={yshift*=-\tcboxedtitleheight/2},  title=Exercicies, overlay={\draw [shorten >=4mm, shorten <=4mm] (frame.north)--(frame.south);}}
\tcbitem\consumeboxarray{1}
\tcbitem\consumeboxarray{2}
\tcbitem\consumeboxarray{3}
\tcbitem\consumeboxarray{4}
\end{tcboxeditemize}
\end{document}
  • Thank you but could you add my mathematical exercise as example to see how they gonna looks because i don't know where i have to put them in the code thank you again – Educ Feb 24 '17 at 10:59
  • 1
    @Educ Replace the line \lipsum[1-7] with all the exercices you want to insert. – Ignasi Feb 24 '17 at 11:06
  • Thank you for your efforts but this is not working good sorry – Educ Feb 24 '17 at 11:30
  • @Educ As I told you the solution is not automatic. I suppose you are entering only one or two exercises for testing it. You need to enter more in order to fill at least one column to work or fix a shorter \break at value. – Ignasi Feb 24 '17 at 11:39
  • yes i just add two exercise for testing it could you remove the mark 1 2 3 4 please – Educ Feb 24 '17 at 11:44

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.