rendercv/docs/user_guide/index.md

241 lines
9.1 KiB
Markdown
Raw Normal View History

2024-05-18 22:00:14 +00:00
# User Guide
2024-05-18 21:02:14 +00:00
This document provides everything you need to know about the usage of RenderCV.
## Installation
> RenderCV doesn't require a $\LaTeX$ installation; it comes with it!
1. Install [Python](https://www.python.org/downloads/) (3.10 or newer).
2. Run the command below to install RenderCV.
```bash
pip install rendercv
```
## Getting started with the `new` command
To get started, navigate to the directory where you want to create your CV and run the command below to create the input files.
```bash
rendercv new "Your Full Name"
```
This command will create the following files:
- A YAML input file called `Your_Name_CV.yaml`.
This file will contain all the content and design options of your CV.
2024-05-19 10:10:41 +00:00
- A directory called `classic`.
2024-05-18 21:02:14 +00:00
2024-05-18 22:17:11 +00:00
This directory contains the $\LaTeX$ source code of RenderCV's default built-in theme, `classic`. You can update its contents to tweak the appearance of the output PDF file.
2024-05-18 21:02:14 +00:00
2024-05-19 10:10:41 +00:00
- A directory called `markdown`.
2024-05-18 21:02:14 +00:00
2024-06-17 18:57:50 +00:00
This directory contains the Markdown source code of RenderCV's default Markdown template. You can update its contents to tweak the Markdown and HTML output of the CV.
2024-05-18 21:02:14 +00:00
### Options of the `new` command
The `new` command has some options:
- `#!bash --theme "THEME_NAME"`: Generates files for a specific built-in theme, instead of the default `classic` theme. Currently, the available themes are: {{available_themes}}.
```bash
rendercv new "Your Full Name" --theme "THEME_NAME"
```
- `#!bash --dont-create-theme-source-files`: Prevents the creation of the theme source files. By default, the theme source files are created.
```bash
rendercv new "Your Full Name" --dont-create-theme-source-files
```
- `#!bash --dont-create-markdown-source-files`: Prevents the creation of the Markdown source files. By default, the Markdown source files are created.
```bash
rendercv new "Your Full Name" --dont-create-markdown-source-files
```
## Structure of the YAML input file
2024-05-19 10:10:41 +00:00
The YAML input file contains all the content and design options of your CV. A detailed explanation of the structure of the YAML input file is provided [here](structure_of_the_yaml_input_file.md).
2024-05-18 21:02:14 +00:00
## Rendering the CV with the `render` command
To render a YAML input file, run the command below.
```bash
rendercv render "Your_Name_CV.yaml"
```
This command will generate a directory called `rendercv_output`, which contains the following files:
- The CV in PDF format, `Your_Name_CV.pdf`.
2024-05-18 22:17:11 +00:00
- $\LaTeX$ source code of the PDF file, `Your_Name_CV.tex`.
2024-06-17 18:57:50 +00:00
- Images of each page of the PDF file in PNG format, `Your_Name_CV_1.png`, `Your_Name_CV_page_2.png`, etc.
2024-05-18 21:02:14 +00:00
- The CV in Markdown format, `Your_Name_CV.md`.
2024-06-17 18:57:50 +00:00
- The CV in HTML format, `Your_Name_CV.html`.
2024-05-18 22:17:11 +00:00
- Some log and auxiliary files related to the $\LaTeX$ compilation process.
2024-05-18 21:02:14 +00:00
If the theme and Markdown source files are found in the directory, they will override the default built-in theme and Markdown template. You don't need to provide all the source files; you can just provide the ones you want to override.
### Options of the `render` command
The `render` command has some options:
2024-05-18 22:17:11 +00:00
- `#!bash --use-local-latex-command "LATEX_COMMAND"`: Generates the CV with the local $\LaTeX$ installation, i.e., runs `LATEX_COMMAND`. By default, RenderCV uses its own TinyTeX distribution.
2024-05-18 21:02:14 +00:00
```bash
rendercv render "Your_Name_CV.yaml" --use-local-latex-command "pdflatex"
```
- `#!bash --output-folder-name "OUTPUT_FOLDER_NAME"`: Generates the output files in a folder with the given name. By default, the output folder name is `rendercv_output`. The output folder will be created in the current working directory.
```bash
rendercv render "Your_Name_CV.yaml" --output-folder-name "OUTPUT_FOLDER_NAME"
```
2024-05-18 22:17:11 +00:00
- `#!bash --latex-path LATEX_PATH`: Copies the generated $\LaTeX$ source code from the output folder and pastes it to the specified path.
2024-05-18 21:02:14 +00:00
```bash
rendercv render "Your_Name_CV.yaml" --latex-path "PATH"
```
- `#!bash --pdf-path PDF_PATH`: Copies the generated PDF file from the output folder and pastes it to the specified path.
```bash
rendercv render "Your_Name_CV.yaml" --pdf-path "PATH"
```
- `#!bash --markdown-path MARKDOWN_PATH`: Copies the generated Markdown file from the output folder and pastes it to the specified path.
```bash
rendercv render "Your_Name_CV.yaml" --markdown-path "PATH"
```
- `#!bash --html-path HTML_PATH`: Copies the generated HTML file from the output folder and pastes it to the specified path.
```bash
rendercv render "Your_Name_CV.yaml" --html-path "PATH"
```
- `#!bash --png-path PNG_PATH`: Copies the generated PNG files from the output folder and pastes them to the specified path.
```bash
rendercv render "Your_Name_CV.yaml" --png-path "PATH"
```
- `#!bash --dont-generate-markdown`: Prevents the generation of the Markdown file.
```bash
rendercv render "Your_Name_CV.yaml" --dont-generate-markdown
```
- `#!bash --dont-generate-html`: Prevents the generation of the HTML file.
```bash
rendercv render "Your_Name_CV.yaml" --dont-generate-html
```
- `#!bash --dont-generate-png`: Prevents the generation of the PNG files.
```bash
rendercv render "Your_Name_CV.yaml" --dont-generate-png
```
- `#!bash --ANY.LOCATION.IN.THE.YAML.FILE "VALUE"`: Overrides the value of `ANY.LOCATION.IN.THE.YAML.FILE` with `VALUE`. This option can be used to avoid storing sensitive information in the YAML file. Sensitive information, like phone numbers, can be passed as a command-line argument with environment variables. This method is also beneficial for creating multiple CVs using the same YAML file by changing only a few values. Here are a few examples:
```bash
rendercv render "Your_Name_CV.yaml" --cv.phone "+905555555555"
```
```bash
rendercv render "Your_Name_CV.yaml" --cv.sections.education.1.institution "Your University"
```
Multiple `#!bash --ANY.LOCATION.IN.THE.YAML.FILE "VALUE"` options can be used in the same command.
## Creating custom themes with the `create-theme` command
2024-05-18 22:17:11 +00:00
RenderCV is a general $\LaTeX$ CV framework. It allows you to use any $\LaTeX$ code to generate your CVs. To begin developing a custom theme, run the command below.
2024-05-18 21:02:14 +00:00
```bash
rendercv create-theme "mycustomtheme"
```
This command will create a directory called `mycustomtheme`, which contains the following files:
``` { .sh .no-copy }
├── mycustomtheme
│ ├── __init__.py
│ ├── Preamble.j2.tex
│ ├── Header.j2.tex
│ ├── EducationEntry.j2.tex
│ ├── ExperienceEntry.j2.tex
│ ├── NormalEntry.j2.tex
│ ├── OneLineEntry.j2.tex
│ ├── PublicationEntry.j2.tex
│ ├── TextEntry.j2.tex
│ ├── SectionBeginning.j2.tex
│ └── SectionEnding.j2.tex
└── Your_Full_Name_CV.yaml
```
The files are copied from the `classic` theme. You can update the contents of these files to create your custom theme.
Each of these `*.j2.tex` files is $\LaTeX$ code with some Python in it. These files allow RenderCV to create your CV out of the YAML input.
The best way to understand how they work is to look at the source code of built-in themes:
2024-06-17 18:57:50 +00:00
- [templates of the `classic` theme](../reference/themes/classic.md)
- [templates of the `engineeringresumes` theme](../reference/themes/engineeringresumes.md)
- [templates of the `sb2nov` theme](../reference/themes/sb2nov.md)
- [templates of the `moderncv` theme](../reference/themes/moderncv.md)
2024-05-18 21:02:14 +00:00
For example, the content of `ExperienceEntry.j2.tex` for the `moderncv` theme is shown below:
```latex
\cventry{
((* if design.show_only_years *))
<<entry.date_string_only_years>>
((* else *))
<<entry.date_string>>
((* endif *))
}{
<<entry.position>>
}{
<<entry.company>>
}{
<<entry.location>>
}{}{}
((* for item in entry.highlights *))
\cvline{}{\small <<item>>}
((* endfor *))
```
2024-05-19 10:10:41 +00:00
The values between `<<` and `>>` are the names of Python variables, allowing you to write a $\\LaTeX$ CV without writing any content. They will be replaced with the values found in the YAML input. Also, the values between `((*` and `*))` are Python blocks, allowing you to use loops and conditional statements.
2024-05-18 21:02:14 +00:00
The process of generating $\\LaTeX$ files like this is called "templating," and it's achieved with a Python package called [Jinja](https://jinja.palletsprojects.com/en/3.1.x/).
Also, the `__init__.py` file found in the theme directory is used to define the design options of the custom theme. You can define your custom design options in this file.
For example, an `__init__.py` file is shown below:
```python
from typing import Literal
import pydantic
class YourcustomthemeThemeOptions(pydantic.BaseModel):
theme: Literal["yourcustomtheme"]
option1: str
option2: str
option3: int
option4: bool
```
Then, RenderCV will parse your custom design options from the YAML input, and you can use these variables inside your `*.j2.tex` files as shown below:
```latex
<<design.option1>>
<<design.option2>>
((* if design.option4 *))
<<design.option3>>
((* endif *))
```
### Options of the `create-theme` command
The `create-theme` command has some options:
- `#!bash --based-on "THEME_NAME"`: Generates a custom theme based on the specified built-in theme, instead of the default `classic` theme. Currently, the available themes are: {{available_themes}}.
```bash
rendercv create-theme "mycustomtheme" --based-on "THEME_NAME"
```