zoukankan      html  css  js  c++  java
  • LaTeX 中插入GIF图片

    参见博文:liam.pagevoidcn

    前提条件

    1. 安装 ImageMagick 软件 (因为要把 gif 图片转换成 png 序列),使用它的命令行工具 convert.exe
    2. 命令行下把 gif 转换成 png 序列,实际,例如 convert latex_demo.gif -coalesce output-pngs/latex_demo.png
    3. latex 源文件中引入宏包 animate
    4. 编写代码插入图片

    需要注意的是,不是所有的PDF阅读器都能支持动画。

    示例

    第一步安装软件就不演示了,第二步转换图片序列,第三步、第四步的示例源码如下:

    % !TEX TS-program = xelatex
    % !TEX encoding = UTF-8
    
    % This is a simple template for a XeLaTeX document using the "article" class,
    % with the fontspec package to easily select fonts.
    
    documentclass[11pt]{article} % use larger type; default would be 10pt
    
    % 开启下面的设置可以插入中文
    usepackage{ctex}
    usepackage{color}
    
    usepackage{fontspec} % Font selection for XeLaTeX; see fontspec.pdf for documentation
    defaultfontfeatures{Mapping=tex-text} % to support TeX conventions like ``---''
    usepackage{xunicode} % Unicode support for LaTeX character names (accents, European chars, etc)
    usepackage{xltxtra} % Extra customizations for XeLaTeX
    
    %setmainfont{Charis SIL} % set the main body font (	extrm), assumes Charis SIL is installed
    %setsansfont{Deja Vu Sans}
    %setmonofont{Deja Vu Mono}
    
    % other LaTeX packages.....
    usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
    geometry{a4paper} % or letterpaper (US) or a5paper or....
    %usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
    
    % support the includegraphics command and options
    % PDF中插入GIF可以使用包 animate,前提是必须要先包含宏包 graphicx
    usepackage{graphicx}
    usepackage{animate}
    
    	itle{PDF中插入GIF示例}
    author{LinTeX9527}
    date{	oday}
    %date{} % Activate to display a given date or no date (if empty),
             % otherwise the current date is printed 
    
    egin{document}
    maketitle
    
    egin{center}
    	animategraphics[autoplay,
    					loop,
    					controls,
    					width=.7	extwidth]{15}{./latex-pngs/latex_demo-}{0}{80}	
    end{center}
    
    end{document}
    
    

    原始GIF图片如下

    PDF 中动图截图

    申明

    欢迎转载,请注明出处和作者,同时保留声明。
    作者:LinTeX9527
    出处:https://www.cnblogs.com/LinTeX9527/p/11122268.html
    本博客的文章如无特殊说明,均为原创,转载请注明出处。如未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利

  • 相关阅读:
    多读者多写者的无锁队列
    PCI设备的地址空间
    交换机能不能连接不同的网段?
    VMware Workstation的三种网络连接模式
    Linux内存寻址和内存管理
    Fragment基础信息传递
    Android Studio获取SHA1和MD5方法
    AppCan学习笔记数据存储及listview简单应用
    Fragment基础生命周期
    Fragment基础创建
  • 原文地址:https://www.cnblogs.com/LinTeX9527/p/11122268.html
Copyright © 2011-2022 走看看