将大图像与其中心对齐

将大图像与其中心对齐

我必须在我的论文报告中插入一张大图像。出于某种原因,图像默认在页面中右对齐。我尝试使用 \hspace{-1.4cm} 将图像居中,但没有任何改善。任何建议都会有所帮助。

%\documentclass[a4paper, 12pt, oneside, BCOR1cm]{scrbook}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

%function definition for starting intro from first section.
\def\frontmatter{%
  %\pagenumbering{roman}
  \setcounter{page}{1}
  \renewcommand{\thesection}{\Roman{section}}
}%

\def\mainmatter{%
  %\pagenumbering{arabic}
  %\setcounter{page}{1}
  \setcounter{section}{0}
  \renewcommand{\thesection}{\arabic{section}}
}%

\def\backmatter{%
  %\pagenumbering{arabic}
  
}%
\usepackage{fontspec}
%\setmainfont{Times New Roman}

\usepackage{makecell}
\usepackage{graphicx}
\usepackage{float}%%%
\usepackage{wrapfig}%%%
\usepackage{caption}
\usepackage{subfigure}
\usepackage{amsmath} 
\numberwithin{equation}{section}
\usepackage{textgreek}
\usepackage{gensymb}
\usepackage{svg}
\usepackage{commath}\usepackage{amsmath}
\linespread{1.32}
%\usepackage[top = 2.8cm, bottom = 3.5cm, inner = 3cm, outer = 3cm, headheight = 15pt]{geometry}
%\usepackage{geometry}
\usepackage[a4paper, total={5.7in, 8.72in}]{geometry}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{\leftmark}
\cfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}


\usepackage{chngcntr}
\usepackage{microtype}
\usepackage{titletoc}
%\usepackage{blindtext}
\usepackage{dirtytalk}
%\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage[hidelinks]{hyperref}
\counterwithin{figure}{section}
\counterwithin{table}{section}
%\usepackage{picins}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\floatstyle{plaintop}
\restylefloat{table}
\newenvironment{bottompar}{\par\vspace*{\fill}}{\clearpage}



\begin{document} 

%%%%%%Lots of text 
\begin{figure}[H]
\centering
\hspace{-1.4cm}
\includegraphics[height=5.4in,width=7.4in]{images/image1.png}
\caption[demo]{demo}
\vspace{0cm}
\label{fig:arc6}
\end{figure}
%%%%%%Text

\backmatter
\thispagestyle{plain}
\bibliographystyle{ieeetr}
\bibliography{References}

%\bibliographystyle{unsrt}
\end{document}



图像的位置看起来像这样: 在此处输入图片描述

答案1

您的图片比 宽textwidth,无法居中。请将图形的指定宽度减小到不超过textwidth

% picprob.tex  SE

\documentclass[a4paper,12pt,oneside,BCOR1cm]{scrbook}
\usepackage{float}

\usepackage{mwe}  % provides example images
\usepackage{graphicx}

\usepackage{lipsum} % provides many lines of text

\begin{document}
\lipsum[1]

\begin{figure}[H]  %% your code
\centering
\hspace{-1.4cm}
\includegraphics[height=5.4in,width=7.4in]{images/image1.png}
\caption[demo]{demo}
\vspace{0cm}
\label{fig:arc6}
\end{figure}

Text

%%% my code
\lipsum[2]

\begin{figure}%[H]  %% my code
\centering
%\hspace{-1.4cm}
%\includegraphics[height=5.4in,width=7.4in]{example-image}
\includegraphics[height=5.4in,width=5.4in]{example-image}
\caption[demo]{demo}
\vspace{0cm}
\label{fig:arc6}
\end{figure}

\end{document}

请不要使用[H]浮动选项,因为它会使浮动无效;如果您坚持不要浮动,那么就不要调用浮动,还有其他方法可以为图形或表格添加标题。

相关内容