The repository includes a great configuration for shown listings in LaTeX with the option to show only a specific range of line numbers.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Gerardo Marx Chávez-Campos 1adb6dc93b initial commit 4 years ago
Readme.md initial commit 4 years ago
code.txt initial commit 4 years ago
example.png initial commit 4 years ago
lst-config.tex initial commit 4 years ago
main.tex initial commit 4 years ago

Readme.md

The repository includes a great configuration for shown listings in LaTeX with the option to show only a specific range of line numbers.

This is the code in LaTeX, do not forget to include the 'lst-config.tex' file in your folder:

\documentclass{book}
\input{lst-config}
\begin{document}
Here is a code example with showing only specific ranges:

\lstinputlisting[label=ls:figure, caption=Using the configuration., linerange={1-5, 18-23, 39},matchrangestart=t]{code.txt}
\end{document}

This is the source called in LaTeX exmaple:

\documentclass{article}
\usepackage{blindtext}
\usepackage{graphicx}

\begin{document}
\section{Introduction}
\label{sec:intro}
Now I'm using label command to create cross-references, e.g. in section \ref{sec:review} a literature review is presented, in section \ref{sec:method} the methodology is presented, and so on...

\section{Literature review}
\label{sec:review}
\blindtext[1]

\section{Methodology}
\label{sec:method}
In the Fig. \ref{fig:image-a} the methodology is presented.

\begin{figure}[!h]
	\centering
	\includegraphics[width=3in]{example-image-a}
	\caption{The caption of the figure}
	\label{fig:image-a}
\end{figure}



\section{Preliminary data}
\label{sec:pre}
\blindtext[1]

\section{Statement of limitations}
\label{sec:limitations}
\blindtext[1]

\section{Conclusions}
\label{sec:conclusions}
\blindtext[1]

\end{document}

This is the output in the PDF file: