使用floatrow宏包处理浮动体

插图 2019-09-24 22:07  浏览 :5010
在LaTeX排版中,使用figure和table环境分别排版插图和表格浮动体时,对于居中处理、子图处理、题注处理往往是比较烦琐的,floatrow宏包是一个功能强大的宏包,可以灵活处理类似的排版问题。 在此,通过几个排版中常见的示例,对floatrow宏包的使用进行简单介绍。 ###引入宏包 像其它宏包的使用一样,需要在导言区引入floatrow宏包,并且为了更好地使用该宏包,建议同时引入graphicx和subcaption宏包。 ```tex % 插图宏包 \\usepackage{graphicx} % 灵活排版浮动体 \\usepackage{floatrow} % 子标题宏包 \\usepackage{subcaption} ``` ###并排两个图共享题注 可以使用如下代码并排排版两个图,并共享题注: ```tex \\begin{figure}[!htp] \\begin{floatrow} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.45textwidth]{example-image-a} \\includegraphics[width=0.45textwidth]{example-image-b} }{\\caption{共享题注}\\label{sharefig:a}} \\end{floatrow} \\end{figure} ``` 其排版结果为: ![两图并排共享题注](https://wenda.latexstudio.net/data/attach/190924/LIQIOpS3.png "两图并排共享题注") ###并排两个图独立题注 可以使用如下代码并排排版两个图,并各自独立题注: ```tex \\begin{figure}[!htp] \\begin{floatrow} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.45textwidth]{example-image-a} }{\\caption{独立题注}label{sepfig:a}} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.45textwidth]{example-image-b} }{\\caption{独立题注}\\label{sepfig:b}} \\end{floatrow} \\end{figure} ``` 其排版结果为: ![并排两图独立题注](https://wenda.latexstudio.net/data/attach/190924/SYT7pvdf.png "并排两图独立题注") ###并排两图带子题注 可以使用如下代码并排排版两个图,并带子题注: ```tex \\begin{figure}[!htp] \\begin{floatrow} \\ffigbox[\\textwidth]{ \\begin{subfloatrow}[2] \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.45textwidth]{example-image-a} }{\\caption{子题注}\\label{subfig:a}} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.45textwidth]{example-image-b} }{\\caption{子题注}\\label{subfig:b}} \\end{subfloatrow} }{\\caption{共享题注带子题注}\\label{fig:sub}} \\end{floatrow} \\end{figure} ``` 其排版结果为: ![并排两图带子题注](https://wenda.latexstudio.net/data/attach/190924/x7DMJwsX.png "并排两图带子题注") ###并排三图子题注与独立题注并存 可以使用如下代码并排排版三个图,并带子题注和独立题注: ```tex \\begin{figure}[!htp] \\begin{floatrow} \\ffigbox[\\FBwidth] { \\begin{subfloatrow}[2] \\ffigbox[\\FBwidth]{ \\includegraphics[height=0.16textheight]{example-image-a} }{\\caption{子题注1}\\label{sepsubfig:a}} \\ffigbox{ \\includegraphics[height=0.16textheight]{example-image-b} }{\\caption{子题注2}\\label{sepsubfig:b}} \\end{subfloatrow} }{\\caption{独立题注1}\\label{sepsubfig:ab}} \\ffigbox{ \\includegraphics[height=0.16textheight]{example-image-c}\\\\[5.5ex]% 不完全合理 }{\\caption{独立题注2}l\\abel{sepsubfig:c}} \\end{floatrow} \\end{figure} ``` 其排版结果为: ![三图子题注与独立题注并存](https://wenda.latexstudio.net/data/attach/190924/JVMp1qPQ.png "三图子题注与独立题注并存") ###三图带子题注 可以使用如下代码排版三个图,并带子题注: ```tex \\begin{figure}[!htp] \\ffigbox[textwidth]% {% \\begin{subfloatrow}[1]%useFCwidth \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-a} }{\\caption{子题注1}\\label{trifig:a}} \\end{subfloatrow} \\begin{subfloatrow}[2]%useFCwidth \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-b} }{\\caption{子题注2}\\label{trifig:b}} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-c} }{\\caption{子题注3}\\label{trifig:c}} \\end{subfloatrow} }{\\caption{三个子图}\\label{trifig}} \\end{figure} ``` 其排版结果为: ![三个子图](https://wenda.latexstudio.net/data/attach/190924/OsHtgvJc.png "三个子图") ###四图带子题注 可以使用如下代码排版四个图,并带子题注: ```tex \\begin{figure}[!htp] \\ffigbox[\\textwidth]% {% \\begin{subfloatrow}[2]%useFCwidth \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-a} }{\\caption{子题注1}\\label{trifig:a}} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-b} }{\\caption{子题注2}\\label{trifig:b}} \\end{subfloatrow} \\begin{subfloatrow}[2]%useFCwidth \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image-c} }{\\caption{子题注3}\\label{trifig:c}} \\ffigbox[\\FBwidth]{ \\includegraphics[width=0.4textwidth]{example-image} }{\\caption{子题注4}\\label{trifig:d}} \\end{subfloatrow} }{\\caption{四个子图}\\label{trifig}} \\end{figure} ``` 其排版结果为: ![四个子图](https://wenda.latexstudio.net/data/attach/190924/jlAww9rq.png "四个子图") floatrow宏包还有更为丰富的使用方式,并且使用floatrow宏包也可以实现对表格浮动体的灵活控制。 有关floatrow宏包的使用细节,请在**命令行**使用`texdoc floatrow`命令查看其**使用手册**。
发布评论
登录后方可评论!点击登录
全部评论 (1)