Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#24 PDF Styling #32

Merged
merged 4 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Planecards
The wonderful world of plane cards.
# Planecards
The wonderful world of plane cards.

## Technical documentation
1) [Techincal Design Document](https://docs.google.com/document/d/18ebXWaUiy-wSAZHtXMSESnIHMjJoV-GeW0W9i-uhlDo/edit#heading=h.n2dkl2j6xzna)
Expand All @@ -14,7 +14,9 @@ It's time to setup your environment!
## Playing with jupyter notebooks
If you are enthused about using the `.ipynb` files you can set the environment to `planecards` and you should be off to the races!

## PDF Rendering
If you want to render PDFs, and let's be honest who doesn't, you must do the following:
## PDF Rendering
If you want to render PDFs, and let's be honest who doesn't, you must do the following:
1. Install MacTex `brew install --cask mactex`
2.
2. If you have to interrupt the build or it crashes, you'll have to rerun the following in order to build again:
1. `conda env update --file environment.yml`
2. `conda activate planecards`
17 changes: 14 additions & 3 deletions planecards/templates/card.tpl.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
\usepackage[breakable]{tcolorbox}
\usepackage{float}
\usepackage{enumitem}
\usepackage{etoolbox}

% Define a custom command for conditional rendering
\newcommand{\conditionalRender}[2]{%
\ifstrempty{#1}{}{\item \textbf{#1#2}}%
}

\title{\VAR{pc.metadata.name}: Model Card}
\author{planecards}
Expand Down Expand Up @@ -56,9 +62,14 @@
\item Metrics 1....
\end{mcsection}

\begin{mcsection}{Environmenal}
\item \textbf{\VAR{pc.upstream.environmental.tco2e} : Carbon Emitted(tCO2eq)}
\end{mcsection}
% Begin the conditional statement to check if the variable is empty
\ifstrempty{\VAR{pc.upstream.environmental.tco2e}}%
{}% if empty, do nothing
{% if not empty, render the mcsection environment
\begin{mcsection}{Environmental}
\conditionalRender{\VAR{pc.upstream.environmental.tco2e}}{ : Carbon Emitted(tCO2eq)}
\end{mcsection}
}

\begin{mcsection}{Evaluation Data}
\item Evaluation data 1...
Expand Down