LaTeX學習-day05

LaTeX學習-day05
教程鏈接:B站
使用環境:

  1. 代碼:
% 導言區
\documentclass{ctexart}

\usepackage{graphicx}
\graphicspath{{figures/}}%t圖片在當前目錄下的figure目錄,也可以添加多個路徑:\graphicspath{{figures/},{pics/}}

%語法:\includegraphics[<選項>]{<文件名>}
%格式:EPS,PDF,PNG,JPEG,BMP

%正文區(文檔區)
\begin{document}
	\LaTeX{}中插圖
	%原圖
	\includegraphics{jepg.jpg}
	\includegraphics{eps.eps}
	
	%縮放因子
	\includegraphics[scale=0.3]{jepg.jpg}
	\includegraphics[scale=0.03]{eps.eps}
	
	%固定高度
	\includegraphics[height=2cm]{jepg.jpg}
	\includegraphics[height=2cm]{eps.eps}
	
	%固定寬度
	\includegraphics[width=2cm]{jepg.jpg}
	\includegraphics[width=2cm]{eps.eps}
	
	%固定文本高度 
	\includegraphics[height=0.1\textheight]{jepg.jpg}
	\includegraphics[height=0.1\textheight]{eps.eps}
	
	%固定文本寬度
	\includegraphics[width=0.2\textwidth]{jepg.jpg}
	\includegraphics[width=0.2\textwidth]{eps.eps}
	
	%旋轉角度
	\includegraphics[angle=-45,width=0.2\textwidth,height=0.1\textheight]{jepg.jpg}
	
	%查詢指令texdoc graphicx
	
	
	%from CSDN:插圖
	Latex的插圖 \\
	\includegraphics[scale=0.3]{jepg.jpg} \\
	浮動體 \\
	一般情況下我們很少會把圖片直接插入到我們的文本當中,而是會給它放置在一個叫做浮動體(float)的東西中。這樣圖片可以有一些相對位置的變換,不會造成分頁困難等問題。 \\
	\begin{figure}[ht]
		
		\centering
		\includegraphics[scale=0.1]{jepg.jpg}
		\caption{this is a figure demo}
		\label{fig:label}
	\end{figure} \\
浮動體環境:figure \\
選項:[ht]是可選項  \\
		h 此處(here) \\
		t 頁頂(top) \\
		b 頁底(bottom) \\
		p 獨立一頁(page) \\
使用figure表示的是把我們這個東西看成一個段落並且是沒有任何縮進的 \\

% \centering表示的是裏面緊跟的內容都居中
% \includegraphics[]{}表示的插入圖片
% \caption設置圖片的一個編號以及爲圖片添加標題
相對路徑插入 \\
我們在寫論文的時候,一般如果圖片比較多我們一般會選擇把圖片統一的放到和源文件一個路徑下的某個目錄裏,這個時候我們要成功的加載圖片我們就可以使用相對路徑來加載。 \\
如我們把圖片全部放在一個叫做figures的文件夾下面,如圖所示: \\
\begin{figure}[ht]
	
	\centering
	\includegraphics[scale=0.1]{figures/eps.eps}
	\caption{this is a figure demo}
	\label{fig:pathdemo}
\end{figure} \\
絕對路徑插入圖片 \\
有相對路徑當然還有絕對路徑,使用絕對路徑插入圖片的代碼如下所示,使用與windows系統和linux系統。 \\
\begin{figure}[ht]
	
	\centering
	\includegraphics[scale=0.1]{E:/Documents/LaTeX/Study/texTest/figures/jepg.jpg}
	\caption{this is a figure demo}
	\label{fig:pathdemo1}
\end{figure} \\
跨雙欄插入圖片 \\
在figure後面加*號這樣就可以把單欄的圖片雙欄顯示了 \\
\begin{figure*}[ht]
	
	\centering
	\includegraphics[scale=0.1]{eps.eps}
	\caption{this is a figure demo}
	\label{fig:pathdemo4}
\end{figure*}
\end{document}
  1. 結果
    在這裏插入圖片描述
    在這裏插入圖片描述
    在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章