# Changing style of table caption

I'm using the \caption command inside \begin{table} command and in the output I'm getting:

Table 4.1 - Caption
Table Content


Is it possible to change that style to something like this?

                    *Table 4.1*
**Caption**
Table Content


The word "Table" and its number should be at the right side of page and in italic, the caption should be centered and bold.

PS

\usepackage{caption}
\DeclareCaptionFormat{hfillstart}{\hfill#1#2#3\par}
\captionsetup[table]{format=hfillstart,labelsep=newline,justification=centering}

\usepackage{floatrow}
\floatsetup[table]{capposition=top}


I have used this code from link below. How to change it to make Table italic, and caption bold?

• Welcome to TeX.SX! Nov 5, 2012 at 10:52
• See the caption2 package for such customisations. Nov 5, 2012 at 11:12
• Have a look at tex.stackexchange.com/questions/78774/… Nov 5, 2012 at 12:07
• @AndrewSwann The caption2 package is obsolete. One should use caption or floatrow; the latter builds upon the former. Nov 5, 2012 at 12:09
• @egreg You are perfectly right - a few years ago it used to be the other way around... Nov 5, 2012 at 12:22

You're almost there:

\usepackage{caption}
\DeclareCaptionFormat{hfillstart}{\hfill#1#2#3\par}
\DeclareCaptionFont{mdit}{\mdseries\itshape}
\captionsetup[table]{
format=hfillstart,
labelsep=newline,
justification=centering,
font=bf,
labelfont=mdit,
}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}


I'm not too much convinced about boldface captions, though.

• It's not necessary to declare a new mdit font; simply use the labelfont and textfont keys. Nov 5, 2012 at 15:01
• @lockstep Right, but it may be useful to have also this possibility, so the two parts can share some setting. Nov 5, 2012 at 15:03
• what do #1#2#3 in \DeclareCaptionFormat{hfillstart}{\hfill#1#2#3\par} refer to? Feb 4, 2019 at 16:15
• @Viesturs The package documentation specifies that #1 refers to the caption label, #2 to the separator and #3 to the caption text. Feb 4, 2019 at 16:52

It's not clear to me whether your "Table italic" refers to the "Table XXX" label in the table's caption or to the body of the table:

• In the first case, add labelfont=it,textfont=bf to the argument of \captionsetup.

• In the second case, add font=bf to the argument of \captionsetup and font=it to the argument of \floatsetup.

See section 2.3 of the caption manual and section 3.1.2 of the floatrow manual for details.