2

I apologize in advance if these questions have been asked and answered before. I am trying to decorate the word exercice in the \newenvironment{exo} with tikz package for example like this. I use the pgfornament and psvectorian packages available in this web sites: pgfornament psvectorian.

I follow this question, already asked before.

To be able to do so, I had to imite the below script:

\documentclass[12pt,francais]{standalone}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[object=vectorian]{pgfornament}
\usepackage{tikz}
\usetikzlibrary{calc,babel}
\tikzset{pgfornamentstyle/.style={draw=NavyBlue, fill = blue}}

\begin{document}

\fontfamily{pzc} \selectfont

\begin{tikzpicture}
  [every node/.style={inner sep=0pt}]

  \node[text width= \linewidth-1cm, anchor=center](Text){% ~ \centerline{\LARGE \normalfont Université Paris Sud  }
  \bigskip

  {\LARGE Département de Mathématiques}  \hfill {\large Première année Master} \\ {\LARGE Module:  Probabilité approfondie}
  \hfill {\large 2013-2014 } ~ \bigskip \\  \centerline{\LARGE \normalfont TD: Chaînes de Markov  } } ;
  \node[shift={(-1cm,0.2cm)},anchor=north west](CNW)  at (Text.north west) {\pgfornament[width=1cm]{61}};
  \node[shift={(1cm,0.2cm)},anchor=north east](CNE)   at (Text.north east) {\pgfornament[width=1cm,symmetry=v]{61}};
  \node[shift={(-1cm,-0.5cm)},anchor=south west](CSW) at  (Text.south west) {\pgfornament[width=1cm,symmetry=h]{61}};
  \node[shift={(1cm,-0.5cm)},anchor=south east](CSE)  at (Text.south east) {\pgfornament[width=1cm,symmetry=c]{61}};    \node[shift={(0cm,0cm)}](CS) at (Text.south) {\pgfornament[width=4.5cm,ydelta=+3cm]{75}};
  \pgfornamenthline{CNW}{CNE}{north}{89}
  \pgfornamentvline{CNW}{CSW}{west}{87}
  \pgfornamentvline{CNE}{CSE}{east}{87}

\end{tikzpicture}

    \begin{document}
\begin{exo}
Soient  $(X_n)_{n \geq 1}$ une suite de v.a.r indépendantes et identiquement distribuées  et soit $\mathscr F_n =\sigma(X_1, \cdots , X_n)$.
Posons \[S_0=0 \quad \text{et pour tout} \, \, n \geq 1 \quad S_n= \displaystyle\sum_{k=0}^n X_k.\]
\begin{enumerate}
  \item (1pt)  Montrer que si $(S_n)_{n\in \N}$ est une $\mathscr F_n$-martingale alors $\mathbb E(X_k X_l)=0$ pour tout $k\neq l.$
  \item (1.5pt)  On suppose que,  $X_1 \hookrightarrow \mathscr N(0, \sigma^2)(\sigma > 0).$ Déterminer en fonction de $\alpha$ et $\sigma$, la valeur du nombre réel $a$ pour que
\[
(M_n=\exp(\alpha S_n - a n), n \geq 0)
\]
soit une $\mathscr F_n$-martingale.
  \item (1.5pt) On suppose, $X_1 \hookrightarrow \mathscr P(\lambda)(\lambda    > 0).$
   Déterminer en fonction de $\alpha$ et $\lambda$, 
   la valeur du nombre réel             $a$ pour que
\[
(M_n=\exp(\alpha S_n - (\alpha \lambda +a )n), n \geq 0)
\]
soit une $\mathscr F_n$-martingale.
\end{enumerate}
\end{exo}
\end{document}

When I enter this into winedt console i receive an error message:

! Package auto-pst-pdf Error: 
    "shell escape" (or "write18") is not enabled:
    auto-pst-pdf will not work!
.

See the auto-pst-pdf package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.134         Or turn off auto-pst-pdf.}
                                        %

I tried to solve the problem but I haven't been able to resolve it so far.

I apologise in advance if the question isn't that clear.

Any help would be immensely apreciated!!!

Zbigniew
  • 2,292
  • See this answer by Joseph Wright about shell escaping. – sodd Nov 26 '16 at 14:09
  • You need to use --shell-escape or equivalent when you compile if you want to convert postscript automatically when using pdfTeX. It might also be called something different. – cfr Nov 26 '16 at 14:09
  • \fontfamily{pzc} \selectfont isn't a great idea, but I assume it is only for this throw away example. What's the point of \centerline{} when the node is aligned center anyway? – cfr Nov 26 '16 at 14:13
  • But the main question is how to decorate the word exercice by utilising the tikz package in \newenvironment{exo}. – Zbigniew Nov 26 '16 at 14:34

1 Answers1

2

Here is an attempt at providing a solution. I tried to preserve as much of the existing code as possible rather than starting again.

I made these key changes to your code:

  1. \mathscr requires the addition of \usepackage{unicode-math} and compilation with XeLaTeX. It is not necessary to use shell-escape.
  2. I defined a theorem environment for exo, which your code omitted.
  3. I then just "topped" and "tailed" the theorem with the pgfornaments you nominated, minus ornament 87 which I could not work out how to fit on the sides without rewriting how all the ornaments were placed.
  4. I had quite a lot of difficulty with the code in the enumerate environment so I rewrote chunks of it to define what needed to be in math environment. This could probably be tidied up a lot relative to my clumsy effort.

The result, and the code, are as follows.

enter image description here

\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{unicode-math}
\usepackage[object=vectorian]{pgfornament}
\usepackage{tikz}
\usetikzlibrary{calc,babel}
\tikzset{pgfornamentstyle/.style={draw=NavyBlue, fill = blue}}
%\usepackage[left=1.00cm, right=1.00cm, top=1.00cm, bottom=1.00cm]{geometry}
\usepackage{theorem}

\theoremstyle{break}
\newtheorem{exo}{Theorem}[section]
\setlength{\parindent}{0pt}

    \begin{document}
        \begin{tikzpicture}
        [every node/.style={inner sep=0pt}]

        \node[text width= \linewidth, anchor=center](Text){ ~ \centerline{\LARGE \normalfont Université Paris Sud  }
            \bigskip
            {\Large Département de Mathématiques}  \hfill {\large Première année Master} \\ {\LARGE Module:  Probabilité approfondie}
            \hfill {\large 2013-2014 } ~ \bigskip \\  \centerline{\LARGE \normalfont TD: Chaînes de Markov  } } ;
        \node[xshift={-1cm},yshift={0.2cm},anchor=north west] (CNW)  at  (Text.north west) {\pgfornament[width=1cm,height=1cm]{61}};
        \node[xshift={1cm},yshift={0.2cm},anchor=north east]  (CNE)  at  (Text.north east) {\pgfornament[width=1cm,symmetry=v]{61}};
        \pgfornamenthline{CNW}{CNE}{north}{89}
    %    \pgfornamentvline{CNE}{CSE}{east}{87}
    %    \pgfornamentvline{CNW}{CSW}{west}{87}
        \end{tikzpicture}

        \begin{exo}
            \begin{enumerate}
                \item  Montrer que si %$(S_n)_{n\in \N}$ est une $\mathscr F_n$-martingale alors $\mathbb E(X_k X_l)=0$ pour tout $k\neq l.$

                \item  On suppose que,  $X_1 \hookrightarrow \mathscr N(0, \sigma^2)(\sigma > 0).$ Déterminer en fonction de $\alpha$ et $\sigma$, la valeur du nombre réel $a$ pour que

                \[ (M_n = \exp(\alpha S_n - a n), n \geq 0) \]

                \item soit une $\mathscr F_n$-martingale.

                \item  (1.5pt) On suppose, $X_1 \hookrightarrow \mathscr P(\lambda)(\lambda    > 0).$

                \item Déterminer en fonction de $\alpha$ et $\lambda$, 

                \item la valeur du nombre réel $a$ pour que

                \[ (M_n = \exp(\alpha S_n - (\alpha \lambda +a )n), n \geq 0) \]

                soit une $\mathscr F_n$-martingale.
            \end{enumerate}
        \end{exo}
    \begin{tikzpicture}
        \node[shift={(-1cm,-0.5cm)},anchor=south west](CSW)  at  (Text.south west) {\pgfornament[width=1cm,height=1cm,symmetry=h]{61}};
        \node[shift={(1cm,-0.5cm)},anchor=south east] (CSE)  at  (Text.south east) {\pgfornament[width=1cm,symmetry=c]{61}};
        \node[shift={(0cm,0cm)}]                      (CS)   at  (Text.south)      {\pgfornament[width=4.5cm]{75}};
    \end{tikzpicture}
    \end{document}
Ross
  • 5,656
  • 2
  • 14
  • 38