## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Change of justification to \justified in figure captions Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
vichome
Posts: 3
Joined: Wed Dec 19, 2012 11:24 pm

### Change of justification to \justified in figure captions

Hi,

How can I change the justification from centered to justified in figure captions?

Document class I use: revtex4-1
Tex Live for Mac

Revtex4-1 does not support the caption package I am using, and the \usepackage command is of no use: justification does change from the original \centered to \raggedright, but not to justified:

\usepackage[labelfont=bf,labelsep=quad,justification=justified]{caption}

The \Declare command does not help either:
\DeclareCaptionJustification{justified}{\justified}

Can the problem be solved by \renew commands? If it can and if someone can help, I need a sufficiently detailed description

Many thanks in advance and happy Christmas!
Victor
Last edited by cgnieder on Fri Dec 21, 2012 4:58 pm, edited 1 time in total.

Tags:

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
Hi Victor,

Welcome to the LaTeX community!

As you've already found out caption is not aware of the »revtex4-1« class. I don't think it's easy for a user to change that. I wouldn't use it at all but instead change the internal macro that is responsible for the typesetting of the caption:

\documentclass{revtex4-1}\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc} \usepackage{lipsum}% for dummy text \makeatletter\renewcommand\@make@capt@title[2]{%  \@ifx@empty\float@link{\@firstofone}{\expandafter\href\expandafter{\float@link}}%   {\textbf{#1}}\@caption@fignum@sep#2\quad}%\makeatother \begin{document} \lipsum[1] \begin{figure}[ht]  \rule{5cm}{3cm}  \caption{\protect\lipsum[2]}  \label{fig:foo}\end{figure} \lipsum[3] \end{document}

Since the »revtex4-1« class seems to be designed for articles submitted to the American Physical Society or the American Institute of Physics, the captions are designed exactly the way they want it. Why do you want to change them, then? (Or aren't you using the class to submit an article to them?)

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

vichome
Posts: 3
Joined: Wed Dec 19, 2012 11:24 pm
Thanks, Clemens -- but I was unable to get the result using the code, even after numerous attempts.

\makeatletter     \renewcommand\@make@capt@title[2]{%      \@ifx@empty\float@link{\@firstofone}{\expandafter\href\expandafter{\float@link}}%       {\textbf{#1}}\@caption@fignum@sep#2\quad}%     \makeatother

What I did was to put the code in the preample. I commented the previously used \caption but the other things remained the same, correct?
(\begin{figure} ... \caption ... \end{figure})

LaTeX reacted to this by changing Figure 1--no full stop -- \quad to FIG. 1. But justification did not change to justified.

Could you please tell where I can find information on the \caption package for TeX Live 2011/2012 to read about the TeX Live inherent caption package?

Your message prompted me to just use \hfil to spread the words along the line so that the figure captions look like justified. I do need to understand how TeX Live's intrinsic \caption works, though, and would appreciate your advice on that.

Frohe Weinachten!

Victor

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
vichome wrote:Thanks, Clemens -- but I was unable to get the result using the code, even after numerous attempts.

Could you then post a minimal working example (similar to what I posted, i.e., beginning with \documentclass and ending with \end{document}) so I (or someone else) can see what is going on?

vichome wrote:Could you please tell where I can find information on the \caption package for TeX Live 2011/2012 to read about the TeX Live inherent caption package?

There are in principle two main ways to find information on a package. The first: look on your own computer where the documentation is probably installed. A command line call of the following:
texdoc caption

should open the caption documentation for instance. If it isn't there there's also http://texdoc.net:
http://texdoc.net/pkg/caption

should also open the documentation.

Second there's always CTAN (the Comprehensive TeX Archive Network):
http://www.ctan.org/pkg/caption

vichome wrote:Frohe Weinachten!

Thanks! Merry Christmas to you, too

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

vichome
Posts: 3
Joined: Wed Dec 19, 2012 11:24 pm
Now your code works! Probably, I missed something when inserting it. Anyway, I have prepared an MWE and would put it on display -- it could be useful to others...


Thanks a lot!