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.

61 lines
1.4 KiB

4 years ago
  1. The repository includes a great configuration for shown listings in LaTeX with the option to show only a specific range of line numbers.
  2. This is the code in LaTeX, do not forget to include the 'lst-config.tex' file in your folder:
  3. ```
  4. \documentclass{book}
  5. \input{lst-config}
  6. \begin{document}
  7. Here is a code example with showing only specific ranges:
  8. \lstinputlisting[label=ls:figure, caption=Using the configuration., linerange={1-5, 18-23, 39},matchrangestart=t]{code.txt}
  9. \end{document}
  10. ```
  11. This is the source called in LaTeX exmaple:
  12. ```
  13. \documentclass{article}
  14. \usepackage{blindtext}
  15. \usepackage{graphicx}
  16. \begin{document}
  17. \section{Introduction}
  18. \label{sec:intro}
  19. 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...
  20. \section{Literature review}
  21. \label{sec:review}
  22. \blindtext[1]
  23. \section{Methodology}
  24. \label{sec:method}
  25. In the Fig. \ref{fig:image-a} the methodology is presented.
  26. \begin{figure}[!h]
  27. \centering
  28. \includegraphics[width=3in]{example-image-a}
  29. \caption{The caption of the figure}
  30. \label{fig:image-a}
  31. \end{figure}
  32. \section{Preliminary data}
  33. \label{sec:pre}
  34. \blindtext[1]
  35. \section{Statement of limitations}
  36. \label{sec:limitations}
  37. \blindtext[1]
  38. \section{Conclusions}
  39. \label{sec:conclusions}
  40. \blindtext[1]
  41. \end{document}
  42. ```
  43. This is the output in the PDF file:
  44. ![](example.png)