diff --git a/flows/jinja-yaml.yml b/flows/jinja-yaml.yml index 1d7011b..6d370ce 100644 --- a/flows/jinja-yaml.yml +++ b/flows/jinja-yaml.yml @@ -38,6 +38,87 @@ pages: - (?:linear\s+)?\s*map - (?:operator\s+)?\s*map +- + type: ChoiceQuestion + id: latex_image + title: Latex 2 image + value: 2 + prompt: | + + # Choice + + What format is the following image? From + [TEXexample.net](http://www.texample.net/tikz/examples/complete-graph/) + + {% set preamble %} + % Author: Quintin Jean-Noël + % + \documentclass{article} + \usepackage[fontsize=14px]{scrextend} % render with font size 14px + \usepackage{tikz} + %%%< + \usepackage{verbatim} + % The following three lines must be commented. + %\usepackage[active,tightpage]{preview} + %\PreviewEnvironment{tikzpicture} + %\setlength\PreviewBorder{5pt}% + %%%> + \begin{comment} + :Title: A complete graph + :Tags: Foreach;Graphs;To paths + :Author: Jean-Noël Quintin + :Slug: complete-graph + \end{comment} + \usetikzlibrary[topaths] + % A counter, since TikZ is not clever enough (yet) to handle + % arbitrary angle systems. + \newcount\mycount + {% endset %} + +

+ {% call latex(compiler="latex", tex_preamble=preamble, image_format="png") %} + + \begin{document} + \begin{tikzpicture}[transform shape] + %the multiplication with floats is not possible. Thus I split the loop in two. + \foreach \number in {1,...,8}{ + % Computer angle: + \mycount=\number + \advance\mycount by -1 + \multiply\mycount by 45 + \advance\mycount by 0 + \node[draw,circle,inner sep=0.25cm] (N-\number) at (\the\mycount:5.4cm) {}; + } + \foreach \number in {9,...,16}{ + % Computer angle: + \mycount=\number + \advance\mycount by -1 + \multiply\mycount by 45 + \advance\mycount by 22.5 + \node[draw,circle,inner sep=0.25cm] (N-\number) at (\the\mycount:5.4cm) {}; + } + \foreach \number in {1,...,15}{ + \mycount=\number + \advance\mycount by 1 + \foreach \numbera in {\the\mycount,...,16}{ + \path (N-\number) edge[->,bend right=3] (N-\numbera) edge[<-,bend + left=3] (N-\numbera); + } + } + \end{tikzpicture} + \end{document} + {% endcall %} +

+ + Hints: You can use Jinja ``set`` block to set variable ``foo``, then use ``foo`` as keyword argument for the ``latex`` macro. + + choices: + - png + - jpg + - ~CORRECT~ svg + - bmp + - gif + completion_text: |