Horizontal Rule Above/Below Figure Caption

Source: tex.stackexchange.com

You can use caption packge if you want to draw a horizontal rule above or below a figure caption. \DeclareCaptionFormat can be used to create a custom caption format with the horizontal rule and \DeclareCaptionLabelFormat can be used to customize the caption label format. Finally \captionsetup can be used to tell the Latex system to use newly defined caption format and label format.


If you want the horizontal rule below the caption, all you have to do is move the \hrulefill to the end and remove \\ like {#1#2#3\hrulefill}. In caption format, #1 get replaced with the label, #2 get replaced with the separator and #3 get separated with the caption text. In caption label format, #1 get replaced with the name (e.g. Figure) and #2 get replavced with reference number.

Text With Background Color

framed package can be used to create a colored box with text.

% In preamble

% In document
Text goes here.

Figure Word Wrapping

wrapfig can be used to have figures wrap text around them.

  \caption{Caption Goes Here}