[Tex/LaTex] Table caption label format as “Table L-1.”

captionsformatting

I want to make a new table caption as

Table L-1. This is a table caption

Currently, I am using the below code, but it has large margin between character and number as "Table L- 1". Could you help me to make a professional table caption as above requirement

This is my code

\captionsetup[table]{labelfont={bf},labelformat={default},labelsep=period,name={Table L-}}
\begin{table}
\captionsetup{labelfont={bf}}
\caption{This is a table caption}
\begin{tabular}{@{} lcccccc @{}} % suppress vertical whitespace at start and end
\end{tabular}
\label{labelhere}
\end{table} 

Best Answer

Change format only in caption label

You can make use of \DeclareCaptionLabelFormat from the caption package, see section 4 of the caption manual.

You can use either

\DeclareCaptionLabelFormat{nospace}{#1#2}
\captionsetup[table]{labelfont=bf,name=Table L-,labelformat=nospace,labelsep=period}

or simply

\DeclareCaptionLabelFormat{tablel}{#1L-#2}
\captionsetup[table]{labelfont=bf,labelformat=tablel,labelsep=period}

Change format in both caption label and references

If you want the table counter to have the format "L-1" as well, you can simply use \renewcommand{\thetable}{L-\arabic{table}} as in the below MWE:

\documentclass{article}
\usepackage{caption}

\renewcommand{\thetable}{L-\arabic{table}}
\captionsetup[table]{labelfont=bf, labelsep=period}

\begin{document}

\begin{table}
\caption{This is a table caption}
\begin{tabular}{@{} lcccccc @{}} % suppress horizontal whitespace at start and end
\end{tabular}
\label{labelhere}
\end{table}

In text: Table \ref{labelhere}

\end{document}

which gives the output

Output