Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{color}
- usepackage{listings}
- usepackage[justification=centering]{caption}
- lstdefinestyle{SC}{
- language=erlang,
- xleftmargin=.2textwidth,
- xrightmargin=.2textwidth
- }
- lstset{
- numbers=left,
- numberstyle=tiny,
- basicstyle=scriptsize,
- showstringspaces=false,
- showspaces=false,
- commentstyle=color{blue},
- keywordstyle=bfseriescolor{purple},
- captionpos=t,
- frame=lines
- }
- begin{document}
- begin{lstlisting}[style=SC, caption={test}]
- % Stop all containers
- docker stop $(docker ps -a -q)
- % Delete all containers
- docker rm $(docker ps -a -q)
- % Delete all images
- docker rmi $(docker images -q)
- end{lstlisting}
- end{document}
- documentclass{article}
- usepackage{color}
- usepackage{listings}
- usepackage[justification=centering,singlelinecheck=false]{caption}
- makeatletter
- deflst@MakeCaption#1{% #1 is `t' or `b'
- begingroup
- caption@setposition{#1}%
- caption@iftop{%
- ifdimhsize>linewidth
- hsizelinewidth
- fi
- @tempdimabelowcaptionskip
- belowcaptionskipabovecaptionskip
- abovecaptionskip@tempdima}
- {ifdimhsize>dimexpr linewidth + lst@xleftmargin + lst@xrightmarginrelax
- hsizedimexpr linewidth + lst@xleftmargin + lst@xrightmarginrelax
- fi}%
- caption@setup{rule=0}%
- caption@setoptions{lstlisting}%
- caption@setautoposition{#1}%
- caption@begin{lstlisting}%
- caption@ORI@lst@MakeCaption{#1}%
- caption@end
- endgroup}%
- makeatother
- lstdefinestyle{SC}{
- language=erlang,
- xleftmargin=.2textwidth,
- xrightmargin=.2textwidth
- }
- lstset{
- numbers=left,
- numberstyle=tiny,
- basicstyle=scriptsize,
- showstringspaces=false,
- showspaces=false,
- commentstyle=color{blue},
- keywordstyle=bfseriescolor{purple},
- captionpos=t,
- frame=lines
- }
- begin{document}
- begin{lstlisting}[style=SC, caption={test},captionpos=t]
- xxxxxxxxxxxxxxxxxxxxx\
- xxxxxxxxxxxxxxxxxxxxxxxx
- end{lstlisting}
- begin{lstlisting}[style=SC, caption={test},captionpos=b]
- % Stop all containers
- docker stop $(docker ps -a -q)
- % Delete all containers
- docker rm $(docker ps -a -q)
- % Delete all images
- docker rmi $(docker images -q)
- end{lstlisting}
- end{document}
- listfiles
- documentclass{article}
- usepackage{color}
- usepackage{listings}
- lstdefinestyle{SC}{
- language=erlang,
- xleftmargin=.2textwidth,
- xrightmargin=.2textwidth
- }
- lstset{
- numbers=left,
- numberstyle=tiny,
- basicstyle=scriptsize,
- showstringspaces=false,
- showspaces=false,
- commentstyle=color{blue},
- keywordstyle=bfseriescolor{purple},
- captionpos=b,
- frame=lines
- }
- begin{document}
- begin{lstlisting}[style=SC, caption={test}]
- % Stop all containers
- docker stop $(docker ps -a -q)
- % Delete all containers
- docker rm $(docker ps -a -q)
- % Delete all images
- docker rmi $(docker images -q)
- end{lstlisting}
- end{document}
- *File List*
- article.cls 2014/09/29 v1.4h Standard LaTeX document class
- size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
- color.sty 2016/07/10 v1.1e Standard LaTeX Color (DPC)
- color.cfg 2016/01/02 v1.6 sample color configuration
- pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
- infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
- ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
- listings.sty 2015/06/04 1.6 (Carsten Heinz)
- keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
- lstmisc.sty 2015/06/04 1.6 (Carsten Heinz)
- listings.cfg 2015/06/04 1.6 listings configuration
- supp-pdf.mkii
- lstlang1.sty 2015/06/04 1.6 listings language file
- lstlang2.sty 2015/06/04 1.6 listings language file
- lstlang3.sty 2015/06/04 1.6 listings language file
- ***********
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement