Graphics, Figures & TablesTwo Caption Questions

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Two Caption Questions

Post by sw3quant »

Hello,

I've got two questions.
  1. I wish to put text above and below a figure. When I try this now I get two figure numbers, which of course I don't want.

    How can I just get one figure number and a title above and an explanation underneath?

    my MWE code is below:

    Code: Select all

    \begin{figure}%[H]
        \caption{my Title}
        \begin{center}
            \includegraphics[width=4in,height=5in,keepaspectratio]{images/stateSpace}
            \label{stateSpace}
            \caption{hello world}
        \end{center}
    \end{figure}
  2. I am using the algorithm package. With this package when you use caption you get a title between two neat black lines at the top of your algorithm.

    I wish to use more than one line of text in between these two black lines.

    When I do the below, I get that effect. However, I also get the first line "MY title" unjustified and spread out over the width of the page. How do i enforce it being left justified?

    my MWE code is below:

    Code: Select all

    \usepackage{algorithm}
    \usepackage{algorithmic}
    \usepackage{algorithmwh}
    
    \begin{algorithm}[H]
        \label{algViterbi}
        \caption{MY title.
        \text{A = FUNC(B,C)}}
        \begin{algorithmic}[1]
            \STATE {\bf Initialize}
        \end{algorithmic}
    \end{algorithm}

Many Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two Caption Questions

Post by localghost »

sw3quant wrote:[…] my MWE code is below […]
Unfortunately I can't see a MWE.


Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Two Caption Questions

Post by Stefan Kottwitz »

Hi,

kindly have a look at this explanation, what an MWE is, click this link: Infominimal working example
Working means, that it is compilable, so we can test the code. If the issue is an error and the code cannot be compilable of course, then the code example should be so complete that it can be used for producing the error by compilation.

Perhaps somebody checks your code without requiring it to be complete. But just don't call it an MWE then, as other users might learn wrong requirements regarding MWEs.

Stefan
LaTeX.org admin
Post Reply