将多张图片整合到一个文件并输出PDF

#!/bin/bash

#set -x

usage()
{
cat <<EOF
${txtcyn}
Usage:

$0 options${txtrst}

${bldblu}Function${txtrst}:

This script is used generate a picture collection for all pics in
given folder.

${txtbld}OPTIONS${txtrst}:
	-d	The path for pics${bldred}[NECESSARY], like tandem/. The slash
	'/' at the end is alternative. ${txtrst}
	-p	Prefix for header line[${bldred}NECESSARY, like 50-200${txtrst}]
	-o	Output prefix, the name for output files.
		[${bldred}NECESSARY, like 50-200${txtrst}]
	-e	Execute or not[${bldred}Default TRUE, accept FALSE${txtrst}]
EOF
}

dir=
prefix=
output=
execute='TRUE'

while getopts "hd:p:o:e:" OPTION
do
	case $OPTION in
		h)
			usage
			exit 1
			;;
		d)
			dir=$OPTARG
			;;
		p)
			prefix=$OPTARG
			;;
		o)
			output=$OPTARG
			;;
		e)
			execute=$OPTARG
			;;
		?)
			usage
			exit 1
			;;
	esac
done
if [ -z $dir ]; then
	usage
	echo "** No dir **"
	exit 1
fi

if [ -z $prefix ]; then
	usage
	echo "** No prefix **"
	exit 1
fi

if [ -z $output ]; then
	usage
	echo "** No output **"
	exit 1
fi

dir=`echo ${dir%/}`
dir=$dir"/"

file=${output}.tex


newdir=${prefix}.${output}.${dir}

/bin/rm -rf ${newdir}*
/bin/mkdir -p $newdir


cat <<END >$file
	
\documentclass[presentation, compress, blue, 9pt]{beamer}

\usetheme{Frankfurt}
\usefonttheme[stillsansseriflarge, stillsansserifsmall]{serif}

\usepackage[english]{babel}
\usepackage{graphicx} %used to insert picture
\usepackage{times}
\usepackage{color}

\usepackage{caption}

%\captionsetup{labelformat=simple, labelsep=period, font=scriptsize}
%\captionsetup[subfigure]{labelformat=simple}
%\renewcommand\thesubfigure{\Alph{subfigure}}

\usepackage{xcolor}


\graphicspath} 
\setbeamercovered{dynamic}

\setbeamertemplate{caption}[numbered]
%%this delete the naigation bar at bottom-right
\setbeamertemplate{navigation symbols}{} 
\setbeamertemplate{blocks}[rounded][shadow=true]
%-------------newcommand---------------------------------------------
\newcommand{\graph}[1]{\includegraphics[width=\textwidth,
height=0.8\textheight, keepaspectratio=true]{#1}}
\newcommand{\graphe}[1]{
\begin{figure}
  \centering
  \includegraphics[width=\textwidth, height=0.85\textheight, keepaspectratio=true]{#1}
\end{figure}}
%
% The following info should normally be given in you main file:
%
\title{To my Dou dou}
\author[Qhy]{Qhy}
\date{\today}

\begin{document}

\frame1{\titlepage} %delete the navagation bar at first page


\part<presentation>{Main Talk}

END

num=0


for i in `ls ${dir} | grep 'png$'`; do
	((num++))
	title=${prefix}"-"${num}
	subtitle=`echo $i | \
		awk '{split($0,a,"_"); chr=a[1]; start=a[2]; \
	split(a[3],b,"."); end=b[1]; name=chr":"start"-"end; print \
		name,"(Distance:", end-start,"nt)";}'`
	/bin/cp -f ${dir}${i} ${newdir}${num}.png
	#echo $pic_file
	cat <<END >>$file
\begin{frame}1
  \begin{figure}
	\centering
	\textbf{${title}}
  \end{figure}
  \begin{figure}
	\centering
	${subtitle}
  \end{figure}
  \graphe{${num}}
\end{frame}
END
done

#\begin{frame}1
#  \begin{figure}#
#	\centering
#	\Huge Thank you!
#  \end{figure}
#\end{frame}

cat <<END >>$file
\end{document}
END

if [ "$execute" == "TRUE" ]; then
	xelatex $file
fi
CHENTONG
版权声明:本文为博主原创文章,转载请注明出处。
alipay.png WeChatPay.png

CHENTONG

CHENTONG
积微,月不胜日,时不胜月,岁不胜时。凡人好敖慢小事,大事至,然后兴之务之。如是,则常不胜夫敦比于小事者矣!何也?小事之至也数,其悬日也博,其为积也大。大事之至也希,其悬日也浅,其为积也小。故善日者王,善时者霸,补漏者危,大荒者亡!故,王者敬日,霸者敬时,仅存之国危而后戚之。亡国至亡而后知亡,至死而后知死,亡国之祸败,不可胜悔也。霸者之善著也,可以时托也。王者之功名,不可胜日志也。财物货宝以大为重,政教功名者反是,能积微者速成。诗曰:德如毛,民鲜能克举之。此之谓也。

生信宝典文章集锦

生信的作用越来越大,想学的人越来越多,不管是为了以后发展,还是为了解决眼下的问题。但生信学习不是一朝一夕就可以完成的事情,也许你可以很短时间学会一个交互式软件的操作,却不能看完程序教学视频后就直接写程序。也许你可以跟着一个测序分析流程完成操作,但不懂得背后的原理,不知道什么...… Continue reading

生信宝典文章集锦

Published on January 01, 2100

生信宝典文章集锦

Published on January 01, 2100