2

I don't know a thing about LaTex, but I grab this bash script from the internet to convert .c and .h file to PDF. I would like to change the font, or at least make it bigger.

Here's the code :

#!/usr/bin/env bash

tex_file=$(mktemp) ## Random temp file name

cat<<EOF >$tex_file   ## Print the tex file header
\documentclass{article}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color}  %% Allow color names
\usepackage{courier}
\lstdefinestyle{customasm}{
  belowcaptionskip=1\baselineskip,
  xleftmargin=\parindent,
  language=C,   %% Change this to whatever you write in
  breaklines=true, %% Wrap long lines
  basicstyle=\footnotesize\ttfamily,
  commentstyle=\itshape\color{Gray},
  stringstyle=\color{Black},
  keywordstyle=\bfseries\color{OliveGreen},
  identifierstyle=\color{blue},
  numbersep=100pt,
  showspaces=false,
  showstringspaces=false,
  xleftmargin=-8em,
}
\lstset{
   basicstyle=\fontsize{25}{13}\selectfont\ttfamily
}

\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\begin{document}
\tableofcontents

EOF

find . -name "*\.c" -o -name "\.h" | sed 's/^\..//' |
sed 's/^\..//' |                 ## Change ./foo/bar.src to foo/bar.src

while read  i; do                ## Loop through each file

  echo "\newpage" >> $tex_file   ## start each section on a new page
  echo "\section{$i}" >> $tex_file  ## Create a section for each file

  ## This command will include the file in the PDF
  echo "\lstinputlisting[style=customasm]{$i}" >>$tex_file
done &&
echo "\end{document}" >> $tex_file &&
pdflatex $tex_file -output-directory . &&
pdflatex $tex_file -output-directory .  ## This needs to be run twice
                                           ## for the TOC to be generated

I've tried to add the line

\lstset{
   basicstyle=\fontsize{25}{13}\selectfont\ttfamily
}

and add :

numbersep=100pt,

to change the font size, but nothing happened. Any help would be greatly appreciated!

  • 4
    Try basicstyle=\ttfamily, instead of basicstyle=\footnotesize\ttfamily,. Other sizes are basicstyle=\small\ttfamily,, basicstyle=\normalsize\ttfamily,, basicstyle=\large\ttfamily,. See a list of normally available sizes here. (You need to remove the \lstset{basicstyle=\fontsize{25}{13}\selectfont\ttfamily} of course. Also numbersep=100pt, does not change the font size.) – moewe May 28 '17 at 21:54
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder May 29 '17 at 05:33

0 Answers0