Skip to content

Commit

Permalink
fix: escapeinside header was hard-coded
Browse files Browse the repository at this point in the history
  • Loading branch information
TomLebeda committed Nov 4, 2023
1 parent 14004d0 commit 62dcc7c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ pub fn generate_latex_verbatim(
highlighted_text_pieces: Vec<HighlightedText>,
conf: &CliArgs,
) -> String {
let header = r"\begin{lstlisting}[
let header = format!("\\begin{{lstlisting}}[
% there are many more options of styling, see the official documentation, these are just the defaults I like
frame=single, % make single-line frame around the verbatim
framesep=2mm, % put some more spacing between the frame and text
aboveskip=5mm, % put some more space above the box
basicstyle={\linespread{0.9}\small\ttfamily}, % use typewriter (monospace) font
caption={CHANGE ME}, % set the caption text
basicstyle={{\\linespread{{0.9}}\\small\\ttfamily}}, % use typewriter (monospace) font
caption={{CHANGE ME}}, % set the caption text
captionpos=b, % put the caption at the bottom (b) or top (t) or both (bt)
label={lst:CHANGE ME}, % label to be referenced via \ref{}
label={{lst:CHANGE ME}}, % label to be referenced via \\ref{{}}
numbers=left, % line numbers on the left
numberstyle={\scriptsize\ttfamily\color{black!60}}, % the style for line numbers
escapeinside={<@}{@>} % between those sequences are command evaluated
]";
numberstyle={{\\scriptsize\\ttfamily\\color{{black!60}}}}, % the style for line numbers
escapeinside={{{}}}{{{}}} % between those sequences are command evaluated
]", conf.escape_start, conf.escape_end);
let footer = r"\end{lstlisting}";
let mut buffer = "".to_string();
if !conf.raw {
buffer += header;
buffer += &header;
buffer += "\n";
}
for text_piece in highlighted_text_pieces {
Expand Down

0 comments on commit 62dcc7c

Please sign in to comment.