Illustrations #
Author: Erhua
Keywords: Illustrations, transformations
Inserting and transforming images are essential skills that need to be learned.
Inserting Images #
The basic packages graphics
or graphicx
provide commands for inserting images and manipulating their geometry.
We assume that you already know how to set up floating objects for images and tables. If this concept is unfamiliar to you, please refer to this link.
The image insertion command is completed by the commands of the package graphics
or graphicx
(it is recommended to use the graphicx
package because it supports the option=value syntax):
\includegraphics[options]{filename}
height |
Height of the graphic (can be any TEX dimension unit). |
---|---|
totalheight |
Total height of the graphic (can be any TEX dimension unit) (added in version 6/95). |
width |
Width of the graphic (can be any TEX dimension unit). |
scale |
Scaling factor of the graphic; scale=2 will make the inserted graphic twice its natural size. |
angle |
Rotation angle, in degrees. Positive values are counter-clockwise. |
origin |
origin specifies the point around which the graphic rotates. The default is the reference point of the graphic (added in version 12/95). For example, origin=c will rotate the graphic around its center. Possible values are (l,r,c,t,b,B) for (left,right,center,top,baseline,bottom), one or two values can be used at the same time, with the default value being lb. |
bb |
Setting the value of BoundingBox. bb=10 20 100 200 sets the bottom-left corner of the BoundingBox at (10,20) and the top-right corner at (100,200) . Since \includegraphics automatically reads the BoundingBox values from EPS files, this option is generally not used. However, it is useful when the BoundingBox is missing or incorrect in the EPS file. |
Basic methods of inserting images:
\documentclass[]{article}
\usepackage{caption,subcaption}
\usepackage{graphicx}
\usepackage{ctex}
\begin{document}
\begin{figure}
\centering
\includegraphics[width = 1cm]{/Users/fplee/blog/public/xiaobo.png}
\includegraphics[height = 2cm]{/Users/fplee/blog/public/xiaobo.png}
\includegraphics[scale = 0.2]{/Users/fplee/blog/public/xiaobo.png}
\caption{小波好}
\end{figure}
\end{document}
\includegraphics[width = 1cm,angle = -90]{/Users/fplee/blog/public/xiaobo.png}
\includegraphics[height = 2cm,angle = -45,origin = c]{/Users/fplee/blog/public/xiaobo.png}
\includegraphics[scale = 0.2]{/Users/fplee/blog/public/xiaobo.png}
% Specific angle settings can be found in the table above
NOTICE
Since compiling images can be time-consuming and the file sizes are relatively large, in the early stages of document typesetting, you can set \includegraphics to use the draft option, or use the global draft option for the document class. This way, the compiled PDF will only contain large boxes with filenames that are the same size as the graphic.
\documentclass[draft]{article}
或者使用
\usepackage[draft]{graphicx}
Transformations #
To be filled
Setting the Font #
How can you set the font for the caption of the image? Generally, you can use the package caption
.
\usepackage{caption}
\captionsetup[figure(或者table)]{font = small, label = bf}
The font options and label are as follows:
\documentclass[]{article}
\usepackage{ctex}
\usepackage{anyfontsize}
\usepackage{fontspec}
\newCJKfontfamily\qingsong{FZQKBYSJW--GB1-0}
\renewcommand{\small}{\fontsize{8pt}{\baselineskip}\selectfont}
\bibliographystyle{unsrt}
\usepackage{caption}
\captionsetup[figure]{font = small}
\begin{document}
\begin{figure}
\centering
\includegraphics[width = 0.5\textwidth]{111.jpeg}
\caption{\qingsong {你好呀}}\label{fig:nihao}
\end{figure}
Comparison of font sizes
\end{document}