Text Formattinghelp with a graphic

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dvd1975
Posts: 4
Joined: Tue Oct 21, 2014 6:39 pm

help with a graphic

Post by dvd1975 »

I want an image and down i want a sentence.
I write this

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[activeacute,spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage{graphicx} 
\usepackage{wrapfig}

\begin{document}
\begin{figure}
	\centering
		\includegraphics{image.jpg}
\end{figure}

\begin{flushleft}
\rmfamily \tiny hello hello 
\end{flushleft}

\end{document}
But this doesnt work, when I built and see the output, there are two pages, one with the text, and another one with the image.
What's the mistake?
Thank you for your help.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

help with a graphic

Post by Johannes_B »

Do you want to give a caption to the figure like »Figure 1: Hello World«?

You can control the output of captions using a package with the same name: caption

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[activeacute,spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{caption}
\captionsetup{font=scriptsize}
%\usepackage{wrapfig}%JB Please don't use this

\begin{document}
\begin{figure}
	\centering
	\includegraphics{image.jpg}
	\caption{Hello World}
\end{figure}

\begin{flushleft}
	\rmfamily \tiny hello hello
\end{flushleft}

\end{document}
Hint, if you markup code using [code⁠] LaTeX code[/code] you can click above the code-block on »Open in Writelatex«.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
dvd1975
Posts: 4
Joined: Tue Oct 21, 2014 6:39 pm

Re: help with a graphic

Post by dvd1975 »

Thank you for your answer.
But it doesnt work.
When i built and see the outpout there's a black image(not my image) in the center of page. And the image is very big.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: help with a graphic

Post by Johannes_B »

I don't have your image, so i used package option demo. Some black rectangle is used as a replacement.
Delete it and you should be fine.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
dvd1975
Posts: 4
Joined: Tue Oct 21, 2014 6:39 pm

Re: help with a graphic

Post by dvd1975 »

Sorry it doesnt work.
I wrote your code.
And the program TexnicCenter created two pages, one with the text and another one with the image.
I want only a page, with the image first, and below the text
Like this


0000
0000
0000

Text

Thank you for your help
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

help with a graphic

Post by Johannes_B »

The simplest things are sometimes not as obvious as they should be.

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}
	\centering
	\includegraphics{image.jpg}
\begin{flushleft}
	\rmfamily \tiny hello hello
\end{flushleft}
\end{figure}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
dvd1975
Posts: 4
Joined: Tue Oct 21, 2014 6:39 pm

Re: help with a graphic

Post by dvd1975 »

Sorry i wrote before i posted in the forum your last code but it doesnt work too.
The text is written at the end of the document, not below the image.
it appears

0000
0000
0000




text


thank you for your help
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Re: help with a graphic

Post by Stefan Kottwitz »

Possibly there's a problem with your image. Such as too much whitespace around it. You could post it here, as attachment.

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

help with a graphic

Post by Johannes_B »

Another quick way to test for any white space is to place an fbox around the image.

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[activeacute,spanish]{babel}
\usepackage{mwe}
%\usepackage{wrapfig}%JB Please don't use this

\begin{document}
\begin{figure}
	\centering
	\fbox{%Adding a frame around the picture
	\includegraphics{example-image}
}
\begin{flushleft}
	\rmfamily \tiny hello hello
\end{flushleft}
\end{figure}

\end{document}
If the cause should be another one, please try to build a minimal working example so we can reproduce your document.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply