將大圖像與其中心對齊

將大圖像與其中心對齊

我必須在論文報告中插入一張大圖像。由於某種原因,預設情況下圖像在頁面中右對齊。我嘗試使用 \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]浮動選項,因為它會使浮動無效;如果您堅持不使用浮動,那麼就不要要求浮動,還有其他方法可以在圖形或表格中添加標題。

相關內容