LaTeX insert a GIF image

See Bowen: liam.page and voidcn

Prerequisites

  1. ImageMagick installed software (Since we converted to png gif image sequence), using its command-line tool convert.exe
  2. Converting the command into gif png sequence, the actual, e.g. convert latex_demo.gif -coalesce output-pngs/latex_demo.png
  3. latex packages introduced in the source file animate
  4. Write code to insert a picture

It should be noted that not all of the PDF reader can support animation.

Examples

The first step in installing the software is not demonstrated, the second step converts a sequence of pictures, the third step, the fourth step example source code as follows:

% !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 (\textrm), 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}

\title{PDF中插入GIF示例}
\author{LinTeX9527}
\date{\today}
%\date{} % Activate to display a given date or no date (if empty),
         % otherwise the current date is printed 

\begin{document}
\maketitle

\begin{center}
    \animategraphics[autoplay,
                    loop,
                    controls,
                    width=.7\textwidth]{15}{./latex-pngs/latex_demo-}{0}{80}    
\end{center}

\end{document}

Original GIF picture is as follows

Dynamic PDF screenshot

Declare

Welcome to reprint, please indicate the source and author, while retaining statement.
Author: LinTeX9527
Source: https://www.cnblogs.com/LinTeX9527/p/11122268.html
this blog article if no special instructions, are original, please indicate the source. Without the consent of the author must be retained as declared by this section, and is connected to the original article page gives clear position, otherwise reserved the right to pursue legal responsibilities

Guess you like

Origin www.cnblogs.com/LinTeX9527/p/11122268.html