.. index:: rnotes .. _rnotes: .. _rnotes_reporting: The properties =============== .. index:: rnotes.Title .. _rnotes.Title: Title ------ Title - Optional .. index:: rnotes.Author .. _rnotes.Author: Author ------- Author normalized to cell rows: {Name, Email, Institution} .. index:: rnotes.Date .. _rnotes.Date: Date ----- rnotes/Date is a property. .. index:: rnotes.Body .. _rnotes.Body: Body ----- Body - Ordered list of elements (structs/objs) .. index:: rnotes.Counters .. _rnotes.Counters: Counters --------- Counters - Running counters per type .. index:: rnotes.Labels .. _rnotes.Labels: Labels ------- Labels - Map label .. index:: rnotes.WorkDir .. _rnotes.WorkDir: WorkDir -------- WorkDir - Temp working directory .. index:: rnotes.figsDir .. _rnotes.figsDir: figsDir -------- figsDir - Temp working directory for figures .. index:: rnotes.filesToDelete .. _rnotes.filesToDelete: filesToDelete -------------- filesToDelete - Temp assets to clean (e.g., exported figs) The methods ============ .. index:: rnotes.addParameterTable .. _rnotes.addParameterTable: addParameterTable ------------------ ADDPARAMETERTABLE Add a parameterization table from a RISE model. obj.addParameterTable(m) Inputs: - obj : rnotes (report) object - m : rise_model instance Name-Value Options: - Precision (1,1) double = 4 Number of decimal places for parameter values. - Caption (1,:) char = 'Model Parameterization' Produces table: \| Symbol \| Description \| Regime 1 \| Regime 2 \| ... \| .. index:: rnotes.chapter .. _rnotes.chapter: chapter -------- CHAPTER Add a chapter (report/book only). .. index:: rnotes.checkLatexLiteralSafety .. _rnotes.checkLatexLiteralSafety: checkLatexLiteralSafety ------------------------ rnotes.checkLatexLiteralSafety is a function. warnings = rnotes.checkLatexLiteralSafety(str) .. index:: rnotes.cleardoublepage .. _rnotes.cleardoublepage: cleardoublepage ---------------- CLEARDOUBLEPAGE End the current page and start the next one on an odd-numbered page. Usage: obj.cleardoublepage() Notes: - Emits LaTeX \cleardoublepage. Like \clearpage but additionally inserts a blank verso page if necessary so the next content starts on a recto (odd-numbered) page. - Only visually distinct from \clearpage when the documentclass uses two-sided printing (e.g. report, book). .. index:: rnotes.clearpage .. _rnotes.clearpage: clearpage ---------- CLEARPAGE End the current page and flush pending floats before starting a new page. Usage: obj.clearpage() Notes: - Emits LaTeX \clearpage. - Stronger than \newpage: floats (figures, tables) that are still pending are flushed out before the new page starts. .. index:: rnotes.create_figure .. _rnotes.create_figure: create_figure -------------- CREATE_FIGURE Build a multi-panel figure from subplot specs and append it. Usage: r.create_figure(subplots) r.create_figure(subplots, Caption="My figure", DateFormat="yyyy") Inputs: - subplots: cell array. Each cell is itself a cell of the form:: {data, 'caption', '...', 'legend', {...}, 'plotfunc', @fn, ... 'highlighted_dates', {[d1 d2]}, 'style', {'linewidth',2}, ... 'xline', vals, 'yline', vals} Only `data` is required. Name-value options that apply to the whole figure: - DateFormat (string) : datetick format, e.g. "yyyy". - Range (1x2) : x-axis limits applied to every subplot. Plus any name-value option that `obj.figure(...)` accepts (Caption, Label, Width, Height, Scale, Angle, Placement, Numbered). Notes: - Each subplot draws into a horizontal slice of one figure. - The resulting figure handle is enrolled via `obj.figure(...)`. - The xlim trap from `@rprt/create_figure.m:223` (passing rise_dates.dates straight to fill() on a datetime axis) is handled identically here. .. index:: rnotes.description .. _rnotes.description: description ------------ DESCRIPTION Insert a LaTeX description list into the report. Usage: obj.description(items) Inputs: - items : a cell array of 1x2 entries, where each element is:: { label , text } Both label and text may be char, string, or convertible. Rules: - items must be an N×2 cell. - Each label/text is LaTeX-escaped. - This method behaves like:: \begin{description} \item[Label] explanation text \end{description} Example:: r.description({ {'Persistence', 'Determines propagation speed'} {'Uncertainty', 'Amplifies responses'} }); .. index:: rnotes.dsge .. _rnotes.dsge: dsge ----- DSGE Adds a RISE/DSGE model file to the report with syntax highlighting. Usage: obj.dsge("model.rs") obj.dsge("model.rsa", Lines=1:50, Footnote="Core equations") Description: Reads a RISE model file and renders it in LaTeX with syntax highlighting consistent with RISE's internal color scheme (keywords, directives, comments). Name-Value Options: - Syntax (logical) : Enable syntax highlighting (default = true) - LineNumbers (logical) : Show line numbers (default = true) - Lines : "all" \| "none" \| numeric vector (default = "all") - Footnote (string) : Optional footnote appended after the block - LatexAlias (logical) : Reserved for compatibility (default=false) Example: rnotes.dsge("model.rise", Lines=1:50, Footnote="Core equations") .. index:: rnotes.enumerate .. _rnotes.enumerate: enumerate ---------- ENUMERATE Add a numbered list (enumerated list) to the report. Usage: obj.enumerate({"Apple", "Banana", "Orange"}); Inputs: - items : Cell array of strings, each representing a list element. Notes: - Uses the LaTeX 'enumerate' environment. - Each item is escaped for LaTeX safety. Example: r.enumerate({"Step 1: Prepare", "Step 2: Execute", "Step 3: Review"}); .. index:: rnotes.equation .. _rnotes.equation: equation --------- === 1. Update counter only if numbered === .. index:: rnotes.figure .. _rnotes.figure: figure ------- FIGURE Add a figure to the report (PDF only). .. index:: rnotes.footnote .. _rnotes.footnote: footnote --------- FOOTNOTE Add a footnote to the report. .. index:: rnotes.getfieldWithDefault .. _rnotes.getfieldWithDefault: getfieldWithDefault -------------------- rnotes.getfieldWithDefault is a function. v = rnotes.getfieldWithDefault(s, f, def) .. index:: rnotes.input .. _rnotes.input: input ------ INPUT Insert a raw LaTeX \input{...} directive into the report. Usage: rpt.input("chapter1.tex"); Notes: - \*No escaping happens.\* The file is given verbatim to LaTeX. - Useful for including custom LaTeX, tables, equations, or text. - Does NOT check syntax of the external file. Optional: warn if file missing. .. index:: rnotes.itemize .. _rnotes.itemize: itemize -------- ITEMIZE Add a bullet list (itemized list) to the report. Usage: obj.itemize({"Item 1", "Item 2", "Item 3"}); Inputs: - items : Cell array of strings, each representing a bullet point. Notes: - Uses the LaTeX 'itemize' environment. - Each item is automatically escaped for LaTeX safety. Example: r.itemize({"First point", "Second point", "Third point"}); .. index:: rnotes.latexSafe .. _rnotes.latexSafe: latexSafe ---------- rnotes.latexSafe is a function. out = rnotes.latexSafe(str, doEscapeLatex) .. index:: rnotes.maketitle .. _rnotes.maketitle: maketitle ---------- MAKETITLE Add a title block or title page to the report. Usage: obj.maketitle() obj.maketitle(NewPage=false, Centered=false) Inputs (Name-Value arguments): - Title (optional) : Override report title (default = obj.Title) - Author (optional) : Override report authors (default = obj.Author) - Date (optional) : Override report date (default = current date) - Centered (logical) : Whether to center the title block (default=true) - NewPage (logical) : Whether to start the title on a new page (default=true) - TitleSize (string) : LaTeX font size command for the title (default="\\LARGE") - AuthorSize (string): LaTeX font size command for authors (default="\\large") - DateSize (string) : LaTeX font size command for date (default="\\normalsize") Notes: - If Title or Author is empty, the corresponding field is omitted. - This method writes LaTeX commands directly and does not require the built-in \maketitle, giving you full control over formatting. Example: r = rnotes(title="My Report", author="Junior Maih"); r.maketitle(); .. index:: rnotes.newpage .. _rnotes.newpage: newpage -------- NEWPAGE Insert a page break into the report. Usage: obj.newpage() Notes: - Inserts a LaTeX \newpage command. - No options or arguments. Example: r.newpage(); .. index:: rnotes.pagebreak .. _rnotes.pagebreak: pagebreak ---------- PAGEBREAK Insert a LaTeX pagebreak into the report. Usage: obj.pagebreak() obj.pagebreak(Level=2) Inputs: - Level : optional integer in [0,4] controlling break strength (default 0) Notes: - Inserts \pagebreak or \pagebreak[Level] depending on input. - LaTeX-only (PDF export). Example: r.pagebreak(Level=2); .. index:: rnotes.paragraph .. _rnotes.paragraph: paragraph ---------- PARAGRAPH Add a paragraph of text to the report. Usage: obj.paragraph("This is a paragraph of text."); Inputs: - text : Paragraph content (string or char) Notes: - Text is escaped for LaTeX safety. - Paragraphs are written as plain text with a blank line after. - No numbering or label. Example: r.paragraph("This paper studies the impact of fuel subsidy removal."); .. index:: rnotes.publish .. _rnotes.publish: publish -------- PUBLISH Compile the report to a PDF file under the NEW ARCHITECTURE. savefile: "report.pdf" (NO PATHS ALLOWED) Formatting options are \*all\* passed inside args. Examples: r.publish("out.pdf", DocumentClass="report", PointSize="12pt") All figures are inside obj.WorkDir. TeX + PDF are written into pwd. .. index:: rnotes.quotation .. _rnotes.quotation: quotation ---------- QUOTATION Add a quotation block to the report. Usage: obj.quotation("Lorem ipsum dolor sit amet."); obj.quotation("Lorem ipsum dolor sit amet.", Author="John Doe"); Inputs: - text : Quotation text (string or char) - Author : Optional author of the quotation (string, default "") Notes: - Uses the LaTeX 'quotation' environment (suitable for multi-paragraph quotes) - Automatically escapes LaTeX special characters - Author attribution is right-aligned and prefixed with an em-dash Example: r.quotation("Courage is resistance to fear, mastery of fear—not absence of fear.", ... Author="Mark Twain"); .. index:: rnotes.quote .. _rnotes.quote: quote ------ QUOTE Add a block quotation to the report. Usage: obj.quote("Lorem ipsum dolor sit amet."); obj.quote("Lorem ipsum dolor sit amet.", Author="John Doe"); Inputs: - text : The quoted text (string or char) - Author : Optional author or attribution (string, default "") Notes: - LaTeX-only (PDF export) - Text and author are automatically escaped for LaTeX - Formats as a centered quote with optional right-aligned author Example: r.quote("Wisdom begins in wonder.", Author="Socrates"); .. index:: rnotes.rnotes .. _rnotes.rnotes: rnotes ------- Lightweight constructor: content only. Usage: r = rnotes(); r = rnotes(title="My Report"); r = rnotes(title="My Report", author="Junior Maih"); .. index:: rnotes.section .. _rnotes.section: section -------- SECTION Add a section to the report. .. index:: rnotes.subparagraph .. _rnotes.subparagraph: subparagraph ------------- SUBPARAGRAPH Add a sub-paragraph heading to the report. Usage: obj.subparagraph("Title") obj.subparagraph("Title", Numbered=false) obj.subparagraph("Title", Label="sub:foo") Notes: - Emits a LaTeX \subparagraph{...} (numbered) or \subparagraph\*{...} (un-numbered, no entry in the TOC). - The numbering rule mirrors paragraph()/section(): subparagraphs don't have their own counter, so Numbered=true just keeps the command form un-starred and lets LaTeX handle it; the report's internal counters are untouched. .. index:: rnotes.subsection .. _rnotes.subsection: subsection ----------- SUBSECTION Add a subsection to the report. .. index:: rnotes.subsubsection .. _rnotes.subsubsection: subsubsection -------------- SUBSUBSECTION Add a subsubsection to the report. .. index:: rnotes.table .. _rnotes.table: table ------ TABLE Add a (LaTeX) table to the report. Usage: obj.table(data) obj.table(data, Caption="Sample Table", Headers=headers, RowNames=rows) Inputs: - data : numeric, cell, or MATLAB table - Caption : string caption for the table (default "") - Label : LaTeX label for cross-referencing (default "") - Headers : cellstr of column headers - RowNames : cellstr of row names - MaxRows : max number of rows before using longtable (default 10) - Numbered : logical, whether to number table (default true) - Precision : integer, number of decimal places (default 4) - FormatFuncs : structure or array of structs with fields .test (function handle) and .action (cellstr of actions) Notes: - Supports 'bold', 'italics', 'underline', and LaTeX colors ('red','blue',...). - Converts MATLAB tables automatically. - Escapes all text for LaTeX safety. - Writes \begin{table} or \begin{longtable} depending on MaxRows. Example: data = rand(3); hdrs = {'A','B','C'}; rows = {'Row1','Row2','Row3'}; f = struct('test',@(x)x>0.5,'action',{'bold','red'}); r.table(data, Headers=hdrs, RowNames=rows, Caption="Sample Table", FormatFuncs=f); .. index:: rnotes.text .. _rnotes.text: text ----- TEXT Add a text of theText to the report. Usage: obj.text("This is a text of theText."); Inputs: - theText : Paragraph content (string or char) Notes: - Text is escaped for LaTeX safety. - Paragraphs are written as plain text with a blank line after. - No numbering or label. Example: r.text("This paper studies the impact of fuel subsidy removal."); .. index:: rnotes.toc .. _rnotes.toc: toc ---- TOC Add a table of contents to the report. Usage: obj.toc() obj.toc(Depth=2) Inputs: - Depth (optional) : Number of section levels to include (1–3, default=2). - Title (optional) : Custom title for the TOC (default="Contents"). - NewPage (optional) : Logical, whether to force a page break before TOC (default=true). Notes: - In LaTeX, this inserts \tableofcontents and optionally limits the depth. - Automatically generates bookmarks when compiled to PDF (requires hyperref). Example: r.toc(Depth=3, Title="Table of Contents", NewPage=false); .. index:: rnotes.url .. _rnotes.url: url ---- URL Add a hyperlink or URL to the report (LaTeX only). Usage: obj.url("OpenAI", "https://openai.com") obj.url("OpenAI", "https://openai.com", MaskedText="Visit site") Inputs: - text : The visible label or fallback text. - link : The URL to link to. - MaskedText : Optional text to display instead of the raw URL (default: ""). Notes: - Uses the LaTeX \href{}{} command (requires hyperref package). - Automatically escapes special LaTeX characters in both text and link. Example: r.url("GitHub", "https://github.com/jmaih", MaskedText="RISE Toolbox"); .. index:: rnotes.verbatim .. _rnotes.verbatim: verbatim --------- VERBATIM Add verbatim (unformatted) text to the report. Usage: obj.verbatim("Some raw code or text"); Inputs: - text : string or char (printed exactly as given) Notes: - Text is written inside a LaTeX \begin{verbatim}...\end{verbatim} block. - No escaping or formatting is applied. - Intended for code listings, snippets, or raw text blocks. Example: r.verbatim("for i=1:10, disp(i), end");