
저는 Tex 초보자이고 tex 파일을 가지고 있습니다.
\documentclass{article}
\addtolength{\jot}{1em}
\begin{document}
\begin{verbatim}
\end{verbatim}
\begin{chestnutStem}
In the following figure, if the spinner is divided into 8 colored sections, what is the probability of it stopping at blue?
\centerline{\includepdf[page=2]{mypdf.pdf}}
\end{chestnutStem}
\chestnutKey{
$ \frac{1}{4} $
}
\begin{chestnutAnswer}
\begin{align*}
\textrm{The probability of the spinner stopping at blue}&=\frac{\textrm{the number of blue sections}}{\textrm{total number of sections}}\\
&=\frac{2}{8}\\
&=\frac{1}{4}.
\end{align*}
\end{chestnutAnswer}
\end{document}
그리고 나한테 cls 파일이 있어
\ProvidesClass{chestnut}[2016/02/17]
\LoadClass{article}
\RequirePackage{amsmath}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
\RequirePackage{xkeyval}
\DeclareStringOption{country}{}
\DeclareStringOption{language}{}
\DeclareStringOption{math}{}
\DeclareStringOption{numerals}{}
\ProcessKeyvalOptions*\relax
\DeclareOption{example}{%
\typeout{You are using example object.}
}%
\DeclareOption*{}{}
\ProcessOptions*\relax
\RequirePackage[lmargin=0.5in,rmargin=0.5in,tmargin=0.5in,bmargin=0.5in]{geometry}
\let\country=\chestnut@country
\typeout{ Your country \country}
\let\language=\chestnut@language
\typeout{ Your language \language}
\let\math=\chestnut@math
\typeout{ Your symbols language is \math}
\let\numerals = \chestnut@numerals
\typeout{ Your numerals are in \numerals}
\newenvironment{chestnutStem}{\underline{\textbf{Stem}}\\* }{\hfill \\* }
\newcommand\chestnutKey[1]{\underline{\textbf{Key}}\\*#1\hfill\\* }
\newenvironment{chestnutAnswer}{\underline{\textbf{Answer}}\\*}{\hfill \\* }
\RequirePackage{alternative4ht}
\altusepackage{pdfpages}
\newcommand\chestnutTikZ[1]{\includepdf[pages=-,width=.9\textwidth]{#1}}
\setlength{\parindent}{0pt}
\pagenumbering{gobble}
\IfFileExists{approved.jpg}{%
\RequirePackage{fancyhdr}
\renewcommand\headrule{}
\rhead{\vspace{0.5in}\includegraphics[scale=0.2]{approved.png}}
\pagestyle{fancy}
}%
및 Alternative4ht.sty 파일
\ProvidesPackage{alternative4ht}
\newcommand{\altusepackage}[2][]{%
\ifx\HCode\relax%
\usepackage[#1]{#2}%
\else%
\IfFileExists{#2-alt4ht.sty}{%
\usepackage[#1]{#2-alt4ht}%
}{\typeout{alternative4ht: no patch file for #2}}
\fi%
}
\endinput
및 pdfpages-alt4ht.sty 파일
\ProvidesPackage{pdfpages-alt4ht}
\RequirePackage{graphicx}
\newcommand\includepdf[2][]{%
\includegraphics{#2}
}
\endinput
pdf 페이지를 png 이미지로 변환하는 cfg 파일
\Preamble{xhtml}
\Configure{graphics*}
{pdf}
{\Needs{"convert -scene 1 \csname Gin@base\endcsname.pdf
\csname Gin@base\endcsname.png"}%
\Picture[pict]{\csname Gin@base\endcsname .png}% here i want add page number with pdf file name for example <mypdf-2.png>
\special{t4ht+@File: \csname Gin@base\endcsname.png}
}
\begin{document}
\EndPreamble
\includepdf
구성 파일에서 사용하기 위해 명령 에서 [페이지] 값 옵션을 가져오고 싶습니다.
답변1
pdfpages
tex4ht
일단 포함되면 실패를 일으키는 패키지 중 하나입니다 . 이 경우 TeX 소스를 변경해야 하는데, 이는 tex4ht
.helpers4ht 번들\altusepackage
에 대한 대체 버전의 패키지를 로드하는 데 사용할 수 있는 명령을 제공합니다 tex4ht
. 이러한 대체 패키지의 이름은 입니다 packagename-alt4ht.sty
. 여기에는 문서에 사용되는 매크로에 대한 정의가 포함되어 있습니다. 에 대한 정의는 pdfpages
단지 기본적일 뿐이며 한 페이지의 PDF 문서만 포함하는 데 사용될 수 있습니다.
여러 페이지로 구성된 PDF 파일을 지원하기 위해 패키지 에 명령 pages
옵션을 추가했습니다 . 구현하기가 매우 어렵고 HTML 출력에서는 의미가 없다고 생각하기 때문에 원본의 모든 기능을 지원하지는 않습니다.\includepdf
pdfpages-alt4ht.sty
\ProvidesPackage{pdfpages-alt4ht}
\RequirePackage{graphicx}
\RequirePackage{xkeyval}
\define@key{includepdf}{pages}{\edef\current@pdf@page{\the\numexpr #1-1\relax}}
\newcommand\includepdf[2][]{%
\def\current@pdf@page{0}
\setkeys*{includepdf}{#1}
\filename@parse{#2}
\def\current@png@name{\filename@area\filename@base-\current@[email protected]}
\IfFileExists{\current@png@name}{}{%
\Needs{"convert #2[\current@pdf@page]
\current@png@name"}
}
\includegraphics{\current@png@name}
}
\endinput
요청된 페이지를 매크로에 저장합니다 . 페이지 수는 0부터 계산 \current@pdf@page
되므로 1씩 감소해야 합니다. 이름은 다음과 같이 구성되고 프로그램 은 아직 존재하지 않는 경우에만 호출됩니다.imagemagick
png
imagename-pagenumber.png
convert
에서 한 가지 문제를 해결해야 했는데 다음 에서 chestnut.cls
누락되었습니다 .{}
IfFileExists
\ProvidesClass{chestnut}[2016/02/17]
\LoadClass{article}
\RequirePackage{amsmath}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
\RequirePackage{xkeyval}
\DeclareStringOption{country}{}
\DeclareStringOption{language}{}
\DeclareStringOption{math}{}
\DeclareStringOption{numerals}{}
\ProcessKeyvalOptions*\relax
\DeclareOption{example}{%
\typeout{You are using example object.}
}%
\DeclareOption*{}{}
\ProcessOptions*\relax
\RequirePackage[lmargin=0.5in,rmargin=0.5in,tmargin=0.5in,bmargin=0.5in]{geometry}
\let\country=\chestnut@country
\typeout{ Your country \country}
\let\language=\chestnut@language
\typeout{ Your language \language}
\let\math=\chestnut@math
\typeout{ Your symbols language is \math}
\let\numerals = \chestnut@numerals
\typeout{ Your numerals are in \numerals}
\newenvironment{chestnutStem}{\underline{\textbf{Stem}}\\* }{\hfill \\* }
\newcommand\chestnutKey[1]{\underline{\textbf{Key}}\\*#1\hfill\\* }
\newenvironment{chestnutAnswer}{\underline{\textbf{Answer}}\\*}{\hfill \\* }
\RequirePackage{alternative4ht}
\altusepackage{pdfpages}
\newcommand\chestnutTikZ[1]{\includepdf[pages=-,width=.9\textwidth]{#1}}
\setlength{\parindent}{0pt}
\pagenumbering{gobble}
\IfFileExists{approved.jpg}{%
\RequirePackage{fancyhdr}
\renewcommand\headrule{}
\rhead{\vspace{0.5in}\includegraphics[scale=0.2]{approved.png}}
\pagestyle{fancy}
}{}%
chestnut
클래스가 사용되지 않았기 때문에 TeX 파일도 있습니다 .
\documentclass{chestnut}
\addtolength{\jot}{1em}
\begin{document}
\begin{verbatim}
\end{verbatim}
\begin{chestnutStem}
In the following figure, if the spinner is divided into 8 colored sections, what is the probability of it stopping at blue?
\centerline{\includepdf[pages=2]{mypdf.pdf}}
\end{chestnutStem}
\chestnutKey{
$ \frac{1}{4} $
}
\begin{chestnutAnswer}
\begin{align*}
\textrm{The probability of the spinner stopping at blue}&=\frac{\textrm{the number of blue sections}}{\textrm{total number of sections}}\\
&=\frac{2}{8}\\
&=\frac{1}{4}.
\end{align*}
\end{chestnutAnswer}
\end{document}
샘플 출력: