Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I've a problem with image import in LaTex. I want to set all images centered, i tried a lot of commands found around here but nothing seems works. Now I have encountered another problem, because images aren't positioned in the right part of the document @_@ I'm new with LaTex, so probably is a noob's mistake.

Here is the code:

\section{Cliente}

\begin{figure}[ht!]
    \includegraphics[page=1,width=1.5\textwidth,center]{./Query-OrderByRandOttimizzata.png}
\end{figure}

\section{Contratto}

\begin{figure}[ht!]
    \includegraphics[page=1,width=1.5\textwidth,center]{./10Contratti.png}
\end{figure}

\section{Societ\`a}

\begin{figure}[ht!]
    \includegraphics[page=1,width=1\textwidth,center]{./10Societa.png}
\end{figure}

\section{Impianti}

\begin{figure}[ht!]
    \includegraphics[page=1,width=1\textwidth,center]{./10Impianti.png}
    \caption{Nota: in questo caso si \`e costretti a utilizzare la query con ORDER BY per via della condizione sull' ID non rispettata.}
\end{figure}

I can't post the image for results, but it's like this:

8.1 Cliente
Image. -> Not centered.

8.2 Contratto
Image. -> Not centered.

8.3 Società
NO IMAGE -> It is in the next page.

8.4 Impianti
NO IMAGE -> It is in the next page.

Another question: How can I insert the result of a query SQL in LaTex without use a screenshot? With "result of a query" I mean:

+----------+----------+
| Col1     | Col2     |
+----------+----------+
| Val1     | Val2     |
+----------+----------+

Hope that someone can help me, Thanks :)

P.s. Sorry for my bad English.

share|improve this question
1  
Insert \centering inside the figure environment. –  Sigur Jan 24 at 22:23
    
Welcome to TeX.SX! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Kevin C Jan 24 at 22:23
1  
1) PNG does not support multiple images (animation) unlike GIF. Thus page=1 is not needed. 2) width=1.5\textwidth means the image will never fit in \textwidth and not fit in \linewidth that is usually equal or smaller than \textwidth. The result is an overfull \hbox warning and centering is not an issue. Smaller images can be horizontally centered by using \centering at the start of the figure environment. 3) center is not an option for \includegraphics. –  Heiko Oberdiek Jan 25 at 0:25
    
For the centering issue, see tex.stackexchange.com/questions/16582/…, though with .5\textwidth it may run off the page on both sides. –  Torbjørn T. Feb 24 at 8:36
add comment

migrated from stackoverflow.com Jan 24 at 22:18

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Torbjørn T., Svend Tveskæg, Guido, Adam Liter, Peter Jansson Mar 16 at 20:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

You could use \centering or \begin{center}, maybe this page help you.

share|improve this answer
    
Thanks for the answer. With \begin{center} the images are in their right position but why aren't centered? My images have big width, and if I increase the scale value the left and right margins do not remain the same. –  Nasca91 Jan 10 at 15:56
    
Try using \begin{figure}[H!], Here you have a more detailed explanation, wikibooks –  algui91 Jan 10 at 16:53
add comment