简体   繁体   English

尽管使用 \centering,Latex 中的图未居中

[英]Figure in Latex is not centering despite using \centering

I am very new to LaTex and am trying to center a figure.我对 LaTex 非常陌生,并且正在尝试使数字居中。

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.我尝试使用[h][H]使用 package float ,我尝试添加\centering并尝试将图像包装在\begin{center} \end{centering}但似乎没有任何效果。

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.您的代码看起来不错,我刚刚在您的包含图形中添加了一个 [width=50mm] 并将其居中。

I would check two issues:我会检查两个问题:

  1. Is your figure to larger than the textwidth?您的数字是否大于文本宽度?
  2. 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}

乳胶输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM