Repository navigation
Document Layout
Arios Jentu edited this page Aug 9, 2021
·
11 revisions
There is some information about documents and it's pages layouts.
This project containing next classes to work with documents:
-
PageStyle— class to work with document's page style. Containing formattable string for task, exercise and test elements. -
DocumentLayout— class which containing information about document layout file and pages style. -
Document— class with possibility to generate documents. Containing layout of the document and information about pages with entries.
Document classes can be obtained with importing Imports module from Modules:
import Modules.Imports as ImportsThis classes contained in Imports.Documents module.
Class with style information about page of document. Contains next arguments:
-
test_format_string— format-type string with content of test option of the page. Must containing{excercises}element in string to replace them with excercises of the test, and some other text{arg1},{arg2}from executingEntrieselements. Also, there is two parameters can be placed —{control_event}for name of the control event, and{event_number}— for number of the control event. -
excercise_format_string— Format-type string for test. Must containing{title}and{tasks}elements in string. -
tasks_format_string— Format-type string for tasks. Must containing{task}element in string. Usage:
test_format = "\t\\generatepage{{{control_event} \\#{event_number}}}{{{student}}}{{{group}}}{{\n{excercises}\n\t}}\n"
excercise_format = "\t\t\\item {title}\n{tasks}"
tasks_format = "\n\t\t\t{task}"
page_style = Imports.Documents.PageStyle(test_format, excercise_format, tasks_format)This example generates special page style formatting for tests, exercises, and tasks. Also, check tests branch for examples.
Class to work with document layout information. Contains next arguments:
-
layout_path— path of the layout file. This file will be used to generate new file with content with this layout. Must containcontent_stringword, and also can contain somemodule_path_string's to replace content and module paths respectively. Example of layout file can be found in tests branch. -
page_style— object ofPageStyleclass, contain information about style of the pages in document. -
content_string— string which will be replaced with content. By default it's#CONTENT#. -
module_path_string— string which will be replaced with module path, if layout file contain some relative imports. By default it's#MODULE#. (for example,\usepackage{#MODULE#/Styles/style.sty}). Usage:
layout_path = "Layouts/layout.tex"
Imports.Documents.DocumentLayout(layout_path, page_style)With custom content strings and module path strings it can be used in next form:
layout_path = "Layouts/layout.tex"
Imports.Documents.DocumentLayout(layout_path, page_style, "#CONTENTSTR#", "#MODULEPATH#")This example generates document layout from Layouts/layout.tex file with generated below page style.