Fixing image position in latex, [h] doesn't work - latex

Here's the usual code
\begin{figure} [H]
\centering
\includegraphics[scale=0.45]{ncurve.jpg}
\caption{tata}
\label{fig:ts}
\end{figure}
including the float package
But the result is the image at any other place, followed by [H]. What's happening?

i have the same problem so i have simply fix it by using flot package
\usepackage{float}

I had this issue, but I added the command [h] next to the {figure}
\begin{figure}[h]
\centering
\includegraphics[width=.70\textwidth]{image/image}
\caption{image example}
\label{fig-clean-architecture}
\end{figure}
and it worked for me!

Related

Caption Centered To Image Rather Than Page

There isn't exactly any code here, since I just want to centre \begin{figure} and \end{figure}'s captions to the entre of the image included rather than to the centre of the page, if i centre the image to the left, the caption still appears to the centre of the page (without using minipage as that is the only way i know to do it right now).
Here's an example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\includegraphics[width=0.5\textwidth]{image.png}
\caption{Caption}
\end{figure}
\end{document}
What I get from compiling it:
I want this be centered to the image itself, and not the page, without using minipage.
Here is the source image btw, just some image I found on google
One possible approach using the varwidth package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{varwidth}
\begin{document}
\begin{figure}[h]
\begin{varwidth}{\linewidth}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\caption{Caption}
\end{varwidth}
\end{figure}
\end{document}

How to center a line in a verbatim LATEX?

I have the following code:
\begin{verbatim}
{app_id:X[X]YY}
\end{verbatim}
This verbatim box only contains one line. I simply want to center that only line. How can I do it? \centerline doesn't work inside verbatim. Thank you so much for your help!
Sorted out thanks to this source:
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\begin{center}
\begin{BVerbatim}
{app_id:X[X]YY}
\end{BVerbatim}
\end{center}
\end{document}
You need the package fancyvrb to implement this solution.

Above point in latex

I would like to know how to make a point above a symbol (ie : αΊ‹)
I tried \overset{.}{x}, but the point is very small...
Can you help me ?
Thanks
Just to write down one answer, elaborating a bit the source cited in the comments, and to add the following minimal codes.
\documentclass{article}
\begin{document}
$\dot{x}$
$\ddot{x}$
\end{document}
One dot (\dot) and two dots (\ddot) work in math mode as above. Three dots (\dddot) and four dots (\ddddot) the same but they require the package amsmath:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\dddot{x}$
$\ddddot{x}$
\end{document}
Instead in text mode, the package called stackengine may help:
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\stackon[1pt]{x}{.}
\end{document}

Figure in Latex is not centering despite using \centering

I am very new to LaTex and am trying to center a figure.
I have tried to use the package float using both [h] and [H], I have tried to add \centering and I have tried to wrap the image in \begin{center} \end{centering} but nothing seems to work.
My full code is as such
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\graphicspath{ {images/} }
\title{Dissertation}
\author{GC}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}[H]
\centering
\includegraphics{my_grades}
\caption{grades plot}
\label{fig:grade}
\end{figure}
This figure does not seem to want to centre
\end{document}
This figure on the compiled document looks as such. If someone could help me understand why this doesn't want to move that would be great:
Your code seems fine, I just added a [width=50mm] in your include graphics and it centered the Figure.
I would check two issues:
Is your figure to larger than the textwidth?
Does your Figure has a white part on its lefthand side?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\graphicspath{ {images/} }
\title{Dissertation}
\author{GC}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}[H]
\centering
\includegraphics[width=50mm]{darth-vader_5yvm.jpeg}
\caption{grades plot}
\label{fig:grade}
\end{figure}
This figure does not seem to want to centre
\end{document}

Document doesn't display the list of figures (LaTeX)

I have the problem that LaTeX doesn't show the List of figures and List of Listings. I don't know where the problem is.
I'm working with TeXstudio and the code was defined as follows:
\begin{document}
\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single]
//here is the code
\end{lstlisting}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{pic1.jpg}
\caption{That is a pic}
\label{fig: That is a pic}
\end{figure}
\listoffigures
\lstlistoflistings
\end{document}
Both lists remain empty. Can anyone tell me what the problem is??
I am able to generate the list of figures by doing these modifications on your file;
Adding these two lines to the very beginning of the file:
\documentclass{article}
\usepackage{listings}
and then, changing [H] into [h] (lower case).
#Winsoft There is nothing wrong with using [H] you just need to add the float-package (see https://tex.stackexchange.com/questions/132106/difference-between-h-and-h-in-float-position).
Adding the minimal set of needed packages compiled to the desired result. Please note that the list of figures and list of listings won't show up before compiling the document twice.
\documentclass{article}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single]
//here is the code
\end{lstlisting}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{pic1.jpg}
\caption{That is a pic}
\label{fig: That is a pic}
\end{figure}
\listoffigures
\lstlistoflistings
\end{document}

Resources