I want to use a well-formatted caption for my listing, as is proposed in addition to the content Frame should be done.
{document} \ documentclass {report} \ usepackage {xcolor} \ usepackage {listings} \ usepackage {title} \ DeclareCaptionFont {white} {\ Color {white}} \ DeclareCaptionFormat { List} {\ colorbox {gray} {\ parbox {\ textwidth} {# 1 # 2 # 3}}} \ captionsetup [lstlisting] {format = list labelfont = white, textfont = white} \ lstdefinestyle {framed} {frame = Lrb, belowcaptionskip = -1pt, xleftmargin = 8pt, framexrightmargin = 5pt, framextopmargin = 5pt, framexbottommargin = 5pt, framesep = 0pt, rulesep = 0pt,} start {document} \ start {lstlisting} [style = frozen] , Label = some-code, title = some code] public void here () {goes (). (). Results in code ()} \ end {lstlisting} \ end {document}:
As you can clearly see, the frame is misplaced from 1x pixels to the left. In Zooming, I convey to the conclusion that this is the limit for the limit - the caption's own settings. Although I'm not getting any information about how to configure the range with \ captionsupup.
Any idea how to solve this greatly appreciated.
Someone gave me a great hint, to take a little title box for a bus Manually left:
DeclareCaptionFont {white} {\ Color {white}} \ DeclareCaptionFormat {list} {% \ hspace * {- 0.4pt} \ colorbox {gray} {\ parbox {\ Dimexpr \ textwidth -2 \ fboxsep + .8pt \ comfort} {# 1 # 2 3 #}}} \ Captionsetup [lstlisting] {format = listing, labelfont = white, textfont = white}
No comments:
Post a Comment