|
7 | 7 | \usepackage{courier} |
8 | 8 | \usepackage{hyperref} % For clickable links in PDF |
9 | 9 | \usepackage{listings} |
| 10 | +\usepackage{xcolor} |
| 11 | + |
| 12 | +% \lstset{ |
| 13 | +% % Other useful options |
| 14 | +% breaklines=true, % Automatic line breaking for long lines |
| 15 | +% breakatwhitespace=true, % Break lines only at whitespace |
| 16 | +% tabsize=2, % Number of spaces a tab represents |
| 17 | +% captionpos=b, % Caption position: b (bottom) or t (top) |
| 18 | +% showspaces=false, % Do not show dots for spaces |
| 19 | +% showtabs=false, % Do not show markers for tabs |
| 20 | +% showstringspaces=false, % Do not show dots for spaces within strings |
| 21 | +% extendedchars=true, % Allow extended ASCII characters |
| 22 | +% inputencoding=utf8, % Specify input encoding |
| 23 | +% literate={_}{_}1 {~}{~}1 {^}{^}1 {\textless}{<}1 {\textgreater}{>}1, % Handle special characters |
| 24 | +% } |
10 | 25 |
|
11 | 26 | \lstset{ |
| 27 | + % Colors (requires xcolor package) |
| 28 | + backgroundcolor=\color[rgb]{0.95,0.95,0.95}, % Light gray background (adjust RGB as needed) |
| 29 | + commentstyle=\color[rgb]{0.2,0.4,0.2}\ttfamily\small, % Dark green comments |
| 30 | + keywordstyle=\color[rgb]{0.6,0.0,0.0}\bfseries, % Dark red bold keywords |
| 31 | + stringstyle=\color[rgb]{0.0,0.0,0.8}, % Blue strings |
| 32 | + numberstyle=\small\color{gray}, % Small gray line numbers |
| 33 | + % Frame and numbering |
| 34 | + frame=single, % Draws a single frame around the listing |
| 35 | + framesep=5pt, % Space between the frame and the code |
| 36 | + rulecolor=\color{black}, % Color of the frame |
| 37 | + numbers=left, % Display line numbers on the left |
| 38 | + stepnumber=1, % Increment line numbers by 1 |
| 39 | + firstnumber=auto, % Start numbering from 1 for each new listing |
| 40 | + % Language settings |
12 | 41 | basicstyle=\ttfamily\small, |
13 | 42 | language=C++, |
14 | 43 | columns=fullflexible, |
15 | 44 | keepspaces=true, |
| 45 | + % Other useful options |
| 46 | + breaklines=true, % Automatic line breaking for long lines |
| 47 | + breakatwhitespace=true, % Break lines only at whitespace |
| 48 | + tabsize=2, % Number of spaces a tab represents |
| 49 | + captionpos=b, % Caption position: b (bottom) or t (top) |
| 50 | + showspaces=false, % Do not show dots for spaces |
| 51 | + showtabs=false, % Do not show markers for tabs |
| 52 | + showstringspaces=false, % Do not show dots for spaces within strings |
| 53 | + extendedchars=true, % Allow extended ASCII characters |
| 54 | + inputencoding=utf8, % Specify input encoding |
16 | 55 | % Map Unicode “·” and “⊙” to LaTeX-safe output: |
17 | 56 | literate= |
18 | 57 | {·}{{$\cdot$}}1 |
|
0 commit comments