Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. documentclass{article}
  2.  
  3. usepackage{color}
  4.  
  5. usepackage{listings}
  6. usepackage[justification=centering]{caption}
  7.  
  8. lstdefinestyle{SC}{
  9. language=erlang,
  10. xleftmargin=.2textwidth,
  11. xrightmargin=.2textwidth
  12. }
  13.  
  14. lstset{
  15. numbers=left,
  16. numberstyle=tiny,
  17. basicstyle=scriptsize,
  18. showstringspaces=false,
  19. showspaces=false,
  20. commentstyle=color{blue},
  21. keywordstyle=bfseriescolor{purple},
  22. captionpos=t,
  23. frame=lines
  24. }
  25.  
  26. begin{document}
  27.  
  28. begin{lstlisting}[style=SC, caption={test}]
  29. % Stop all containers
  30. docker stop $(docker ps -a -q)
  31. % Delete all containers
  32. docker rm $(docker ps -a -q)
  33. % Delete all images
  34. docker rmi $(docker images -q)
  35. end{lstlisting}
  36.  
  37. end{document}
  38.  
  39. documentclass{article}
  40.  
  41. usepackage{color}
  42.  
  43. usepackage{listings}
  44.  
  45.  
  46. usepackage[justification=centering,singlelinecheck=false]{caption}
  47. makeatletter
  48.  
  49. deflst@MakeCaption#1{% #1 is `t' or `b'
  50. begingroup
  51. caption@setposition{#1}%
  52. caption@iftop{%
  53. ifdimhsize>linewidth
  54. hsizelinewidth
  55. fi
  56. @tempdimabelowcaptionskip
  57. belowcaptionskipabovecaptionskip
  58. abovecaptionskip@tempdima}
  59. {ifdimhsize>dimexpr linewidth + lst@xleftmargin + lst@xrightmarginrelax
  60. hsizedimexpr linewidth + lst@xleftmargin + lst@xrightmarginrelax
  61. fi}%
  62. caption@setup{rule=0}%
  63. caption@setoptions{lstlisting}%
  64. caption@setautoposition{#1}%
  65. caption@begin{lstlisting}%
  66. caption@ORI@lst@MakeCaption{#1}%
  67. caption@end
  68. endgroup}%
  69. makeatother
  70.  
  71. lstdefinestyle{SC}{
  72. language=erlang,
  73. xleftmargin=.2textwidth,
  74. xrightmargin=.2textwidth
  75. }
  76.  
  77. lstset{
  78. numbers=left,
  79. numberstyle=tiny,
  80. basicstyle=scriptsize,
  81. showstringspaces=false,
  82. showspaces=false,
  83. commentstyle=color{blue},
  84. keywordstyle=bfseriescolor{purple},
  85. captionpos=t,
  86. frame=lines
  87. }
  88.  
  89. begin{document}
  90.  
  91. begin{lstlisting}[style=SC, caption={test},captionpos=t]
  92. xxxxxxxxxxxxxxxxxxxxx\
  93. xxxxxxxxxxxxxxxxxxxxxxxx
  94. end{lstlisting}
  95.  
  96. begin{lstlisting}[style=SC, caption={test},captionpos=b]
  97. % Stop all containers
  98. docker stop $(docker ps -a -q)
  99. % Delete all containers
  100. docker rm $(docker ps -a -q)
  101. % Delete all images
  102. docker rmi $(docker images -q)
  103. end{lstlisting}
  104.  
  105. end{document}
  106.  
  107. listfiles
  108. documentclass{article}
  109.  
  110. usepackage{color}
  111.  
  112. usepackage{listings}
  113.  
  114. lstdefinestyle{SC}{
  115. language=erlang,
  116. xleftmargin=.2textwidth,
  117. xrightmargin=.2textwidth
  118. }
  119.  
  120. lstset{
  121. numbers=left,
  122. numberstyle=tiny,
  123. basicstyle=scriptsize,
  124. showstringspaces=false,
  125. showspaces=false,
  126. commentstyle=color{blue},
  127. keywordstyle=bfseriescolor{purple},
  128. captionpos=b,
  129. frame=lines
  130. }
  131.  
  132. begin{document}
  133.  
  134. begin{lstlisting}[style=SC, caption={test}]
  135. % Stop all containers
  136. docker stop $(docker ps -a -q)
  137. % Delete all containers
  138. docker rm $(docker ps -a -q)
  139. % Delete all images
  140. docker rmi $(docker images -q)
  141. end{lstlisting}
  142.  
  143. end{document}
  144.  
  145. *File List*
  146. article.cls 2014/09/29 v1.4h Standard LaTeX document class
  147. size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
  148. color.sty 2016/07/10 v1.1e Standard LaTeX Color (DPC)
  149. color.cfg 2016/01/02 v1.6 sample color configuration
  150. pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
  151. infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
  152. ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
  153. listings.sty 2015/06/04 1.6 (Carsten Heinz)
  154. keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
  155. lstmisc.sty 2015/06/04 1.6 (Carsten Heinz)
  156. listings.cfg 2015/06/04 1.6 listings configuration
  157. supp-pdf.mkii
  158. lstlang1.sty 2015/06/04 1.6 listings language file
  159. lstlang2.sty 2015/06/04 1.6 listings language file
  160. lstlang3.sty 2015/06/04 1.6 listings language file
  161. ***********
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement