def generate_header(self, output="Exam", instructor="Vaccaro", section="English", test_name="Final Exam", version=1): header = PageStyle("header") with header.create(Head("C")): header.append(instructor) header.append(LineBreak()) with header.create(Head("L")): header.append(section) header.append(LineBreak()) header.append(test_name + str(version) if output != 'key' else test_name) with header.create(Head("R")): if (output == "exam"): header.append("Student: _____________") elif (output == "answers"): header.append("Answers v" + str(version)) else: header.append("Key") with header.create(Foot("R")): header.append(simple_page_number()) return header
def _add_overview(self, doc: Document, title: str = 'Overview') -> None: """Add overview section to document. :param doc: :param title: :return: """ with doc.create(Section(title)): doc.append('Overview of kernel search results.') doc.append("\n") doc.append(VerticalSpace("10pt")) doc.append(LineBreak()) best_kern_short = str(self.best_gp_model) best_kern_long = self.best_gp_model.covariance.infix_full with doc.create(MiniPage()): doc.append(bold("Best Kernel:")) doc.append("\n") doc.append(VerticalSpace("1pt")) doc.append(LineBreak()) doc.append(italic("Short Form:")) doc.append("\n") doc.append(best_kern_short) doc.append("\n") doc.append(VerticalSpace("2.5pt")) doc.append(LineBreak()) doc.append(italic("Long Form:")) doc.append("\n") doc.append(best_kern_long)
def create_pdf(self) -> Document: questions = functools.reduce( lambda a, b: a + b, map(lambda x: x.get_questions(), self.questions), []) doc = Document() doc.preamble.append(Package('titling')) for i in range(1, self.count + 1): random.shuffle(questions) with doc.create(Center()): doc.append(HugeText(self.header)) doc.append(bold('Nombre:')) doc.append(LineBreak()) doc.append(bold('ID:')) doc.append(LineBreak()) with doc.create(FlushRight()): doc.append(LargeText(f'Examen tipo {i}')) enum = Enumerate() for question in questions: question.append_to_document(doc, enum) doc.append(NewPage()) doc.append('Guía de respuestas') doc.append(enum) doc.append(NewPage()) doc.append(Command('setcounter', ['section', '0'])) return doc
def print_workout(doc, lift, one_rm, no, accessorys): """Print one workout routine. Arguments: lift one_rm no accessorys Returns: One workout """ doc.append(VerticalSpace("20pt")) doc.append(LineBreak()) main_lift = gen_main_lift(lift, one_rm, no) access = gen_accessory_table(accessorys) with doc.create(MiniPage(width=r"0.5\textwidth")): doc.append(bold('Main Lift\n\n')) doc.append(main_lift) doc.append(VerticalSpace("20pt")) doc.append(LineBreak()) doc.append(bold('Accessory Exercises\n\n')) doc.append(access) # doc.append(main_lift) doc.append(VerticalSpace("20pt")) doc.append(LineBreak()) return doc
def _generate_document(self): legend = self.create_unit_legend() node_legend, node_legend2 = self.create_platform_unit_legend() self.doc.append(legend) self.doc.append(VerticalSpace("10pt")) self.doc.append(LineBreak()) self.doc.append(node_legend) self.doc.append(VerticalSpace("10pt")) self.doc.append(LineBreak()) self.doc.append(node_legend2) for section in self.sections.values(): self.doc.append(section)
def _create_header(self, info): style_name = NoEscape('header{}'.format(info['run'])) header = PageStyle(style_name) with header.create(Head('L')): header.append(info['name']) header.append(LineBreak()) header.append('Date: {}'.format(self._date())) with header.create(Head('R')): header.append('Seed: {}'.format(info['seed'])) header.append(LineBreak()) header.append('Run: {}'.format(info['run'])) self._doc.preamble.append(header) self._doc.change_document_style(style_name)
def add_alignment(self): if len(self.report[self.analysis.alignment_title][ self.analysis.contig_alignment_title]) > 0: alignments = self.report[self.analysis.alignment_title][ self.analysis.contig_alignment_title] else: return self.doc.append(NewPage()) with self.doc.create( Section(self.analysis.alignment_title, numbering=False)): with self.doc.create( Subsection(self.analysis.snp_indel_title, numbering=False)): with self.doc.create(Tabular('ll', width=2)) as table: table.add_row( ('SNPs', '{:,}'.format(self.analysis.quast_mismatches))) table.add_row(('Small indels', '{:,}'.format(self.analysis.quast_indels))) self.doc.append(LineBreak()) if len(self.report[self.analysis.alignment_title][ self.analysis.alignment_notes_title]) > 0: with self.doc.create( Subsection(self.analysis.alignment_notes_title, numbering=False)): left = FlushLeft() for note in self.report[self.analysis.alignment_title][ self.analysis.alignment_notes_title]: left.append(note) left.append(LineBreak()) self.doc.append(left) for contig in alignments.index.tolist(): contig_title = 'Alignment to ' + contig self.doc.append( Command('graphicspath{{../circos/' + contig + '/}}')) image_png = os.path.basename(alignments[contig]) with self.doc.create(Subsection(contig_title, numbering=False)): with self.doc.create(Figure(position='H')) as figure: figure.add_image(image_png, width='5in')
def add_alignment(self): if len(self.analysis.contig_alignment) > 0: alignments = self.analysis.contig_alignment else: return self.doc.append(NewPage()) with self.doc.create(Section(self.alignment_title, numbering=False)): with self.doc.create( Subsection(self.snp_indel_title, numbering=False)): with self.doc.create(Tabular('ll', width=2)) as table: table.add_row( ('SNPs', '{:,}'.format(self.analysis.quast_mismatches))) table.add_row(('Small indels', '{:,}'.format(self.analysis.quast_indels))) self.doc.append(LineBreak()) if len(self.analysis.alignment_notes) > 0: with self.doc.create( Subsection(self.alignment_notes_title, numbering=False)): left = FlushLeft() for note in self.analysis.alignment_notes: left.append(note) left.append(LineBreak()) self.doc.append(left) for contig in alignments.index.tolist(): contig_title = 'Alignment to ' + contig self.doc.append( Command('graphicspath{{../circos/' + contig + '/}}')) image_png = os.path.basename(alignments[contig]) with self.doc.create(Subsection(contig_title, numbering=False)): with self.doc.create(Figure(position='H')) as figure: figure.add_image(image_png, width='5in') method = 'The genome assembly was aligned against the reference sequencing using dnadiff (v ' \ + self.analysis.versions['dnadiff'] + ').' self.methods[self.reference_methods_title] = self.methods[ self.reference_methods_title].append(pd.Series(method))
def addFig2Doc(self, figpath): """Add a figure by name to the end of the latex document, if it exists in the folder, by referencing the configurations of the figure as described in the self.figures dictionary. Arguments: figpath {str} -- file path of the figure to be added to the document. """ fig = os.path.basename(figpath) inPath = os.path.join(self.fpath, 'figures', fig) outPath = os.path.join('../figures', fig) if not os.path.exists(figpath): print('Error: File does not exist!') else: # self.doc.append(NoEscape(r'\input{' + outPath + r'}')) with self.doc.create(Figure(position='ht')) as fig_: ## To adjust image size given specified options: if fig in self.figures: # added via saveFigure(): if 'option' in self.figures[fig]: fig_.append(NoEscape(r'\centering')) fig_.append( Command('includegraphics', options=NoEscape( self.figures[fig]['option']), arguments=outPath)) else: fig_.add_image(outPath) # default uses 0.8\textwidth if 'caption' in self.figures[fig]: fig_.append(LineBreak()) fig_.add_caption(self.figures[fig]['caption']) else: fig_.add_image(outPath) print(f'Added {fig} to the tex doc obj') return
def add_contig_info(self): if self.analysis.contig_info is None: return for method in ['ONT', 'Illumina']: if not method in self.analysis.contig_info.index: continue with self.doc.create( Subsection('Assembly coverage by ' + method, numbering=False)): table_format = 'l' * self.analysis.contig_info[method].shape[1] self.doc.append('') with self.doc.create(Tabular(table_format)) as table: table.add_row(('Contig', 'Length (bp)', 'Coverage (X)')) table.add_hline() formatted = self.analysis.contig_info[method].copy() formatted.iloc[:, 1] = formatted.iloc[:, 1].apply( lambda x: '{:,}'.format(x)) for i in range(self.analysis.contig_info[method].shape[0]): table.add_row(formatted.iloc[i, :].values.tolist()) self.doc.append(LineBreak()) self.doc.append(VerticalSpace("10pt"))
def generate_eva_report(): geometry_options = { "head": "40pt", "margin": "0.5in", "bottom": "0.6in", "includeheadfoot": True } doc = Document(geometry_options=geometry_options) reportStyle = PageStyle("reportStyle") with reportStyle.create(Head("R")) as left_header: with left_header.create( MiniPage(width=NoEscape(r"0.49\textwidth"), pos='c', align='l')) as title_wrapper: title_wrapper.append(LargeText(bold("RiMEA-Projekt"))) title_wrapper.append(LineBreak()) title_wrapper.append(MediumText(bold("Anlyse"))) doc.preamble.append(reportStyle) doc.change_document_style("reportStyle") with doc.create(LongTabu("X[c] X[c]", row_height=1.5)) as report_table: report_table.add_row(["Test", "evacuation time(s)"], mapper=bold) report_table.add_hline() for i in range(1, 4): report_table.add_row(i, get_evac_time(i)[0]) doc.append(NewPage()) doc.generate_pdf("RiMEA-Projekt-Evacution-Analyse", clean_tex=False)
def compile_document_week(no): "produce a pdf of the weeks workout" # input accessory lifts for main lifts bench = [('Decline DB Press (4 x 12)'), ('Face pull (4 x 12)'), ('Low/High flyes ss/w press (4 x 12)'), ('Press ups (4 x Max)')] # squat = [('Leg press (4 x 15)'), ('Leg extension (4 x 12)'), # ('Leg curl (4 x 12)'), ('Roll out (4 x Max)')] squat = [('Smith Front/Back (4 x 12)'), ('Calf Raises (4 x 12)'), ('Walking Lunges (4 x 12)'), ('Roll out (4 x Max)')] dead = [('Pendlay Row (4 x 8-12)'), ('Hip thrust (4 x 8-12)'), ('Pull up (4 x Max)'), ('Leg raise (4 x 8-12)')] press = [('Landmine press (4 x 8-12)'), ('Lateral/Rear raises (4 x 8-12)'), ('DB Curls (4 x 8-12)'), ('Roll outs (4 x Max)')] acc = [bench, squat, press, dead] # input main lifts and one rep maxes # last updated 21/03/2017 main_lifts = [('Bench', 90), ('Squat', 128), ('Military Press', 63), ('Deadlift', 143)] date = t.strftime("%d/%m/%Y") doc = Document() doc.packages.append(Package('geometry', options=['margin=2cm'])) doc.packages.append(Package('times')) doc.packages.append(Package('float')) doc.packages.append(Package('graphicx')) header = generate_header() doc.preamble.append(header) doc.change_document_style("header") # Add title doc.append(LineBreak()) doc.append(LargeText(bold("8/6/3 Workout Routine"))) doc.append(LineBreak()) doc.append(MediumText(bold("As of: " + date))) doc.append(LineBreak()) # Add workout for a week gen_week(doc, main_lifts, no, acc) date_1 = t.strftime("%Y%m%d") directory = "/home/thomas/Documents/workout_print/workouts" filename = (directory + "/workout_routine_week_" + str(no) + "_" + date_1) doc.generate_pdf(filename, clean_tex=True)
def addAppendix(self, apdx): """Adds mapping tables as an appendix to the report. For the specified (apdx) csv file in the appendix folder, it will create a table with either 2/3-columns specifying the mapping values. Note that this might not work well with extremely long mapping tables. """ mappingTable = pd.read_csv(apdx, header=None) colNum = len(mappingTable.columns) apdx_name = os.path.basename(apdx) # for printing if colNum == 2: hdr_format = 'l X[l]' col_names = ['Original', 'Category'] mappingTable.columns = col_names mappingTable = mappingTable.groupby('Category')['Original'].apply( list).reset_index() tbl_type = LongTabularx(hdr_format, width_argument=NoEscape(r'0.9\textwidth')) elif colNum == 3: hdr_format = 'l l l' col_names = ['Lower', 'Upper', 'Category'] tbl_type = Tabular(hdr_format) self.doc.append(Subsection('{}'.format(apdx_name.replace('_', ' ')))) with self.doc.create(tbl_type) as appendix: appendix.add_hline() appendix.add_row(col_names) appendix.add_hline() if colNum == 2: appendix.end_table_header() appendix.add_hline() appendix.add_row( (MultiColumn(colNum, align='r', data='Continued on Next Page'), )) appendix.end_table_footer() appendix.add_hline() appendix.add_row( (MultiColumn(colNum, align='r', data='Not Continued on Next Page'), )) appendix.end_table_last_footer() # Iterate through each row in the csv. for i, rw in mappingTable.iterrows(): row = [rw[j] for j in range(colNum)] appendix.add_row(row) appendix.add_hline() self.doc.append(LineBreak()) return
def dumps(self): # Clear the old data self.clear() assessment = self.assessment if hasattr(self.assessment, 'course'): course = self.assessment.course else: course = None if course: # Create left header with self.create(Head('L')): self.append(course.name) self.append(LineBreak()) self.append(SmallText(course.kind)) self.append(self.padding) # Create center header with self.create(Head('C')): self.append(NoEscape(r'\ifbool{instructorKey}{')) self.append(SmallText(bold('FOR INSTRUCTORS ONLY'))) self.append(LineBreak()) self.append(SmallText(bold(f'(Max. of {assessment.maxpoints} points)'))) self.append(NoEscape(r'}{}')) self.append(self.padding) # Create right header with self.create(Head('R')): self.append(f'{assessment.kind} {assessment.number}.{assessment.version} - {assessment.fullpoints} Points') self.append(LineBreak()) self.append(SmallText(f'Assessing Period: {assessment.period}')) self.append(self.padding) if course: # Create left footer with self.create(Foot('L')): self.append(course.term) # Create center footer with self.create(Foot('C')): now = datetime.now().strftime('%Y%m%d%H%M') self.append(FootnoteText(now)) # Create right footer with self.create(Foot('R')): self.append(simple_page_number()) return super().dumps()
def append_to_document(self, doc: Document, doc_answers: Enumerate) -> None: variable_dict = {} for variable in self.variables: variable_dict[variable.symbol] = variable.value parsed_text = QuestionParser(**variable_dict).parse(self.text) with doc.create(Section(parsed_text)): doc.append('Respuesta: ') doc.append(LineBreak()) doc_answers.add_item('Respuesta de pregunta abierta')
def PCAfigures(doc, pca, nb): doc.append( 'The representation of the projections of the data along the three axes is then performed as represented in the Figure 1.' ) with doc.create(Figure(position='H')) as pca_pic: for i in range(nb): if (i % 3 == 0 and i > 0): pca_pic.append(LineBreak()) pca_pic.add_image(pca[i], width='150px') pca_pic.add_caption( 'representation of PC scores of the body variables')
def gen_week(doc, main_lifts, no, accessorys): """ Function to generate a weeks workout""" with doc.create(Section('Week ' + str(no))): for i in range(len(main_lifts)): title = main_lifts[i][0] with doc.create(Subsection(title)): doc.append('Date: ') doc.append(LineBreak()) doc.append('Weight: ') print_workout(doc, main_lifts[i][0], main_lifts[i][1], no, accessorys[i]) return doc
def gera_cabecalho(self, json_ppra): header = PageStyle("header") # Create left header with header.create(Head("L")) as header_left: logo_file = os.path.join(os.path.dirname(__file__), 'logo.png') header_left.append( StandAloneGraphic(image_options="width=3cm", filename=logo_file)) # Create center header with header.create(Head("C")) as header_center: header_center.append("PPRA 2018") header_center.append(LineBreak()) header_center.append(json_ppra['nomeEmpresa']) header_center.append(LineBreak()) header_center.append(json_ppra['nomeFilial']) # Create right header with header.create(Head("R")) as header_right: header_right.append(simple_page_number()) header_right.append(LineBreak()) header_right.append("Novembro/2018") self.preamble.append(header)
def add_features(self): if len(self.analysis.feature_hits) == 0: return self.doc.append(NewPage()) with self.doc.create(Section(self.feature_title, numbering=False)): for feature_name in self.analysis.feature_hits.index.tolist(): features = self.analysis.feature_hits[feature_name].copy() if features.shape[0] == 0: continue features.iloc[:, 1] = features.iloc[:, 1].apply( lambda x: '{:,}'.format(x)) features.iloc[:, 2] = features.iloc[:, 2].apply( lambda x: '{:,}'.format(x)) table_format = 'l' * (features.shape[1] - 1) with self.doc.create(Subsection(feature_name, numbering=False)): if (features.shape[0] == 0): self.doc.append('None') continue for contig in pd.unique(features.iloc[:, 0]): self.doc.append(contig) contig_features = features.loc[( features.iloc[:, 0] == contig), :] with self.doc.create(Tabular(table_format)) as table: table.add_row(('Start', 'Stop', 'Feature', 'Identity (%)', 'Strand')) table.add_hline() for i in range(contig_features.shape[0]): feature = contig_features.iloc[i, :].copy( deep=True) feature[4] = '{:.3f}'.format(feature[4]) table.add_row(feature[1:].values.tolist()) self.doc.append(LineBreak()) self.doc.append(VerticalSpace("10pt")) method = 'The genome assembly was queried for features using blastn (v ' + self.analysis.versions['blastn'] + '). ' + \ 'Feature hits were clustered using bedtools (v ' + self.analysis.versions['bedtools'] + ') ' + \ 'and the highest scoring hit for each cluster was reported.' self.methods[self.feature_methods_title] = self.methods[ self.feature_methods_title].append(pd.Series(method))
def fillBestWorst(doc, data, nb, nbPca): with doc.create(Subsection('PC scores of the players\' groups')): doc.append( 'The PC scores of the groups formed by the K-means method were then plotted next to the PC scores of the kickers shown previously.' ) with doc.create(Figure(position='H')) as bestWorst_pic: for i in range(nb * nbPca): if (i % 3 == 0 and i > 0): bestWorst_pic.append(LineBreak()) bestWorst_pic.add_image(data[i], width='150px') bestWorst_pic.add_caption( 'PC scores of the body variables for the different PCs. the sportsmen with the best (respectively the worst) performance followed dashed green lines (respectively dased red lines).' )
def _write_questions(self, info): self._doc.append(NoEscape(r'\flushleft')) i = 1 for question, answers, options in info['questions']: self._doc.append('{}. {}'.format(i, question)) self._doc.append(LineBreak()) for image in options['images']: with self._doc.create(Figure(position='h!')) as fig: fig.add_image(image['src'], width='{}px'.format(image.get('width', 100))) if image.get('description'): fig.add_caption(image.get('description')) i += 1 if len(answers) == 0: for _ in range(options['hints'].get('max_lines', 1)): self._doc.append(NewLine()) else: l = options['hints'].get('max_cols', 1) table_data = [answers[j:j+l] for j in range(0, len(answers), l)] with self._doc.create(Tabular('l'*l)) as table: for row in table_data: table.add_row(row, mapper = lambda x: NoEscape(r'$\Box~~$') + x, strict=False) self._doc.append(LineBreak())
def add_assembly_notes(self): if len(self.analysis.assembly_notes) == 0: return with self.doc.create( Subsection(self.assembly_notes_title, numbering=False)): left = FlushLeft() for _, note in self.analysis.assembly_notes.iteritems(): left.append(note) left.append(LineBreak()) self.doc.append(left) self.doc.append(VerticalSpace("10pt"))
def makeReport(self, reportName='report', tex_only=False): '''Automated generation of report structure''' # For section inside the folder, add sections sectPath = os.path.join(self.fpath, 'sections') # for sect in os.listdir(sectPath): for sect in self.sections: sectFile = os.path.join('../sections', sect) self.addText2Doc(r'\input{' + sectFile + r'}') self.doc.append(NewLine()) self.doc.append(LineBreak()) # For figures inside the folder, add figures figPath = os.path.join(self.fpath, 'figures') self.doc.create(Section('Figures')) for fig in os.listdir(figPath): self.addFig2Doc(fig) self.doc.append(NewLine()) self.doc.append(LineBreak()) # For tables inside the folder, add tables tblPath = os.path.join(self.fpath, 'tables') self.doc.create(Section('Tables')) for tbl in os.listdir(tblPath): self.addTbl2Doc(tbl) self.doc.append(NewLine()) self.doc.append(LineBreak()) # For apx inside the folder, add apx self.addAppendix() ## generate tex/pdf if tex_only: self.doc.generate_tex(os.path.join(self.outputPath, self.name)) else: self.doc.generate_pdf(os.path.join(self.outputPath, self.name), clean_tex=False) return
def append_text(doc, text): lines = text.splitlines() line_broken = True with doc.create(FlushLeft()): for i, line in enumerate(lines): last = i == len(lines) - 1 if not line_broken and not line.strip() and not last: doc.append(LineBreak()) line_broken = True continue if not line.strip(): continue doc.append(line + ('' if last else '\n')) line_broken = False
def add_header(self): header_text = 'Analysis of ' + self.analysis.analysis_name header = PageStyle('header') with header.create(Head('L')): header.append(header_text) header.append(LineBreak()) with header.create(Foot('R')): header.append(simple_page_number()) self.doc.preamble.append(header) self.doc.change_document_style('header')
def generate_header(): geometry_options = {"margin": "0.7in"} doc = Document(geometry_options=geometry_options) # Add document header header = PageStyle("header") # Create left header with header.create(Head("L")): header.append("__") header.append(LineBreak()) header.append("_") # Create center header with header.create(Head("C")): header.append("____") # Create right header with header.create(Head("R")): header.append(simple_page_number()) # Create left footer with header.create(Foot("L")): header.append("Left Footer") # Create center footer with header.create(Foot("C")): header.append("Center Footer") # Create right footer with header.create(Foot("R")): header.append("Right Footer") doc.preamble.append(header) doc.change_document_style("header") # Add Heading with doc.create(MiniPage(align='l')): doc.append(LargeText(bold("INVESTMENT PROPERTY - BUY & HOLD"))) doc.append(LineBreak()) doc.append(MediumText(bold(" "))) doc.generate_pdf("header", clean_tex=False) return print('nice')
def discover_experiment_data(self, experiment_name, experiment_type, tasks, task_counts, nodes: List[Node], description, start_time): if experiment_name not in self.sections.keys(): self.sections[experiment_name] = Section(experiment_name) self.sections[experiment_name].append(description) self.sections[experiment_name].append( '\nExperiment start time: {}'.format( datetime.fromtimestamp(start_time))) if experiment_type not in self.experiment_types: self.experiment_types.append(experiment_type) workloads_results = Subsection('') # create table with results table = self.create_table() for task in tasks: task_name = self._strip_task_name(task) task_count = task_counts[task_name] average_latency, average_throughput, q09_latency, q09_throughput,\ numa_nodes, mbw_local, mbw_remote = self.get_metrics(tasks[task]) table.add_row( (tasks[task].name.replace('default/', ''), average_latency, average_throughput, q09_latency, q09_throughput, numa_nodes[0], numa_nodes[1], numa_nodes[2], numa_nodes[3], mbw_local, mbw_remote)) table.add_hline() self._keep_task_results(task, task_name, task_count, experiment_type, average_latency, average_throughput, q09_latency, q09_throughput) # create table with node metrics node_table = self.create_nodes_table() for node in nodes: for socket in [0, 1]: row = [node.name, socket] for metric in metrics.platform_metrics: row.append( self.round_metric( float( node.performance_metrics[socket][metric.name]) / float(metrics.MetricLegends[metric]['helper']))) node_table.add_row(row) node_table.add_hline() workloads_results.append(table) workloads_results.append(VerticalSpace("10pt")) workloads_results.append(LineBreak()) workloads_results.append(node_table) self.sections[experiment_name].append(workloads_results)
def generate_header(): # Add document header header = PageStyle("header") # Create left header with header.create(Head("L")): header.append("Weights updated: 24/02/16") header.append(LineBreak()) # Create center header with header.create(Head("C")): header.append("8/6/3 Workout with BB Accessories") # Create right header # with header.create(Head("R")): # header.append(simple_page_number()) return header
def generate_header(): geometry_options = {"margin": "0.7in"} doc = Document(geometry_options=geometry_options) # Add document header header = PageStyle("header") # Create left header with header.create(Head("L")): header.append("Page date: ") header.append(LineBreak()) header.append("R3") # Create center header with header.create(Head("C")): header.append("Company") # Create right header with header.create(Head("R")): header.append(simple_page_number()) # Create left footer with header.create(Foot("L")): header.append("Left Footer") # Create center footer with header.create(Foot("C")): header.append("Center Footer") # Create right footer with header.create(Foot("R")): header.append("Right Footer") doc.preamble.append(header) doc.change_document_style("header") # Add Heading with doc.create(MiniPage(align='c')): doc.append(LargeText(bold("Title"))) doc.append(LineBreak()) doc.append(MediumText(bold("As at:"))) doc.generate_pdf("header", clean_tex=False)
def mdframed_plano_trabalho(doc, objs): doc.append(LineBreak()) mdframed_options_plano = 'innertopmargin=5pt, innerleftmargin=3pt, innerrightmargin=3pt, topline=false' with doc.create(MdFramed(options=mdframed_options_plano)): doc.append(bold('PLANO DE TRABALHO: ')) planos = [] for obj in objs: planos.append(obj.plano_trabalho) for plano in planos: doc.append(escape_latex(plano)) doc.append(NewLine())