我在 Latex 中绘制了一个图表,但是在放置图表标题时遇到了问题,因为我希望它正好位于页面左侧的图表下方,但无论我做什么,它始终位于中心。为了将它移到左侧,我使用了图片环境。我也研究了类似的问题,但解决方案没有奏效。这是我正在使用的代码。我应该做哪些更改才能解决这个问题?这里我放了 2 个代码,其中一个是我不使用英语时,所有命令都会起作用,但第二个是我使用波斯语时,这个问题仍然存在:
\documentclass[a4]{book}
\usepackage{color}
\usepackage{graphicx}
\usepackage{pict2e}
\textwidth =12cm
\textheight =19cm
\usepackage{amsmath,amssymb}
\usepackage{pict2e}
\begin{document}
\begin{figure}[htp!]
\setlength{\unitlength}{0.1cm}
\linethickness{0.3mm}
\begin{picture}(0,20)
\put(0,0){\vector(1,0){40}}
\put(42,0){$x$}
\put(0,0){\vector(0,1){30}}
\put(0,32){$y$}
\put(0,0){\color{red}\vector(2,1){30}}
\put(30,16){$(x,y)$}
\put(29,-4){$x$}
\put(-4,16){$y$}
\put(9,1){$\theta$}
\put(14,10){$r$}
\multiput(0,15)(0.8,0){38}{\line(1,0){0.3}}
\multiput(29.5,0)(0,0.8){20}{\line(0,1){0.3}}
\end{picture}
\caption{ I want name below gragh }
\end{figure}
\end{document}
第二个:
\documentclass[a4]{book}
\usepackage{caption}
\usepackage{color}
\usepackage{graphicx}
\usepackage{pict2e}
\textwidth =12cm
\textheight =19cm
\usepackage{amsmath,amssymb}
\usepackage{pict2e}
\usepackage{xepersian}
\settextfont[Scale=1]{XB Zar}
\setdigitfont[Scale=1]{XB Zar}
\begin{document}
\begin{figure}[!hb]
\setlength{\unitlength}{0.1cm}
\linethickness{0.3mm}
\begin{LTR}
\begin{picture}(0,20)
\put(0,0){\vector(1,0){40}}
\put(42,0){$x$}
\put(0,0){\vector(0,1){30}}
\put(0,32){$y$}
\put(0,0){\color{red}\vector(2,1){30}}
\put(30,16){$(x,y)$}
\put(29,-4){$x$}
\put(-4,16){$y$}
\put(9,1){$\theta$}
\put(14,10){$r$}
\multiput(0,15)(0.8,0){38}{\line(1,0){0.3}}
\multiput(29.5,0)(0,0.8){20}{\line(0,1){0.3}}
\end{picture}
\end{LTR}
\captionsetup{singlelinecheck=false}
\caption {نمایشِ قطبیِ یک نقطه}
\end{figure}
\end{document}
答案1
您可以为这样的图像设置标题格式:
\documentclass{book}
\usepackage{caption}
\usepackage{color}
\usepackage{graphicx}
\usepackage{pict2e}
\textwidth=12cm
\textheight=19cm
\usepackage{amsmath,amssymb}
\usepackage{pict2e}
\begin{document}
\begin{figure}[htp!]
\setlength{\unitlength}{0.1cm}
\linethickness{0.3mm}
\begin{picture}(0,20)
\put(0,0){\vector(1,0){40}}
\put(42,0){$x$}
\put(0,0){\vector(0,1){30}}
\put(0,32){$y$}
\put(0,0){\color{red}\vector(2,1){30}}
\put(30,16){$(x,y)$}
\put(29,-4){$x$}
\put(-4,16){$y$}
\put(9,1){$\theta$}
\put(14,10){$r$}
\multiput(0,15)(0.8,0){38}{\line(1,0){0.3}}
\multiput(29.5,0)(0,08){20}{\line(0,1){0.3}}
\end{picture}
\captionsetup{singlelinecheck=false}
\caption{ I want name below graph}
\end{figure}
\end{document}
答案2
非常感谢你们,我的问题刚刚通过使用这个代码得到解决:
\documentclass[a4]{book}
\usepackage{caption}
\usepackage{color}
\usepackage{graphicx}
\usepackage{pict2e}
\textwidth =12cm
\textheight =19cm
\usepackage{amsmath,amssymb}
\usepackage{pict2e}
\usepackage{xepersian}
\settextfont[Scale=1]{XB Zar}
\setdigitfont[Scale=1]{XB Zar}
\begin{document}
\begin{figure}[!hb]
\setlength{\unitlength}{0.1cm}
\linethickness{0.3mm}
\begin{LTR}
\begin{picture}(0,0)
\put(0,0){\vector(1,0){40}}
\put(42,0){$x$}
\put(0,0){\vector(0,1){30}}
\put(0,32){$y$}
\put(0,0){\color{red}\vector(2,1){30}}
\put(30,16){$(x,y)$}
\put(29,-4){$x$}
\put(-4,16){$y$}
\put(9,1){$\theta$}
\put(14,10){$r$}
\multiput(0,15)(0.8,0){38}{\line(1,0){0.3}}
\multiput(29.5,0)(0,0.8){20}{\line(0,1){0.3}}
\end{picture}
\end{LTR}
\captionsetup{singlelinecheck=off , format=hang,justification=raggedright}
\caption{نمایشِ قطبیِ یک نقطه}
\end{figure}
\end{document}
所以唯一的变化是
\captionsetup{singlelinecheck=off , format=hang,justification=raggedright}