自定义表格和图形标签以及相应的文本引用

自定义表格和图形标签以及相应的文本引用

我正在使用 tex4ht,我将尝试获取用于 xml 的自定义标签。

梅威瑟:

\documentclass{article}

\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{hyperref}

%\makeatletter
\newcommand{\customizeref}[3]{\hyperref[#1]{#2\ref{#1}}{\hyperref[#1]{#3}}}%
%\makeatletter

\begin{document}

\begin{table}
\caption{Sample Table Caption.\label{tab:1}} 
{\begin{tabular*}{\textwidth}{lrr} 
Head 1 & Head 2 & Head 3 \\  
\midrule
$\beta$ \\
2.0 & 0.03699 & 0.01833  \\  
3.0 & 0.04127 & 0.02063   \\  
\end{tabular*}}{Sample footnote text}
\end{table}

The above mentioned table should be called the customized link \customizeref{tab:1}{Table~}{A}.


\begin{figure}[!b]
\includegraphics{d:/Source/Tex_Testing/20140260/Fig/zna20140260_fig1.pdf}
\caption{Schematic flow configuration.\label{fig:1}}
\end{figure}

The above mentioned figure should be called the customized link \customizeref{fig:1}{Figure~}{A}.

\end{document}

目前我得到了下面提到的输出:

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" 
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" > 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML"><head> <title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<!-- html,xhtml,mathml,NLM,charset=UTF-8,-xtpipes,NoFonts,refcaption --> 
<meta name="src" content="Sample.tex" /> 
<meta name="date" content="2015-10-05 18:29:00" /> 
<link rel="stylesheet" type="text/css" href="Sample.css" /> 
</head>
<body>

<div class="table">
<hr class="float"/>
<div class="float">
<div class="caption">
<span class="id"><a id="x1-21">Table&#x00A0;1</a>: </span>
<span class="content">Sample Table Caption.</span></div><!--tex4ht:label?: x1-21 -->
<div class="tabular"> 
<table id="TBL-1" class="tabular" cellspacing="0" cellpadding="0">
<colgroup id="TBL-1-1g">
<col id="TBL-1-1" />
<col id="TBL-1-2" />
<col id="TBL-1-3" />
</colgroup>
<tr style="vertical-align:baseline;" id="TBL-1-1-">
<td  style="text-align:left; white-space:nowrap;" id="TBL-1-1-1" class="td11">Head 1</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-1-2" class="td11">Head 2</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-1-3" class="td11"> Head 3</td>
</tr>
<tr style="vertical-align:baseline;" id="TBL-1-2-">
<td  style="text-align:left; white-space:nowrap;" id="TBL-1-2-1" class="td11"><!--l. 20--><mml:math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mml:mi>&#x03B2;</mml:mi></mml:math></td>
</tr>
<tr style="vertical-align:baseline;" id="TBL-1-3-">
<td  style="text-align:left; white-space:nowrap;" id="TBL-1-3-1"  class="td11">2.0</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-3-2" class="td11">0.03699</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-3-3" class="td11">0.01833</td>
</tr>
<tr style="vertical-align:baseline;" id="TBL-1-4-">
<td style="text-align:left; white-space:nowrap;" id="TBL-1-4-1" class="td11">3.0</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-4-2" class="td11">0.04127</td>
<td  style="text-align:right; white-space:nowrap;" id="TBL-1-4-3" class="td11">0.02063</td>
</tr>
<tr style="vertical-align:baseline;" id="TBL-1-5-"><td  style="text-align:left; white-space:nowrap;" id="TBL-1-5-1" class="td11"></td>
</tr>
</table>
</div>
Sample footnote text
</div>
<hr class="endfloat"/>
</div>
<p>The above mentioned table should be called the customized link <a href="#x1-21">Table&#x00A0;1</a><a href="#x1-21">A</a>.</p> 

<hr class="figure" /><div class="figure">
<p><img src="Sample0x.png" alt="PIC" class="graphics" /><!--tex4ht:graphics name="Sample0x.png" src="d:/Source/Tex_Testing/20140260/Fig/zna20140260_fig1.pdf" -->
<br/></p> 
<div class="caption"><span class="id"><a id="x1-31">Figure&#x00A0;1</a>: </span>
<span class="content">Schematic flow configuration.</span>
</div>
<!--tex4ht:label?: x1-31 -->

</div><hr class="endfigure" />
<p>The above mentioned figure should be called the customized link <a href="#x1-31">Figure&#x00A0;1</a><a href="#x1-31">A</a>.</p> 

</body>
</html>

我需要的图形、表格、文字引用输出:

<table-wrap id="j_\filename_tab_1">
<label>Table&#x00A0;1</label>
<caption><p>Sample Table Caption.</p></caption>
<table>
<thead>
<tr>
<th align="left" valign="top">Head 1</th>
<th align="right" valign="top">Head 2</th>
<th align="right" valign="top">Head 3</th>
</tr>
</thead>
<tbody>                                                                  
<tr>
<td align="left" valign="top">2.0</td>
<td align="right" valign="top">0.03699</td>
<td align="right" valign="top">0.01833</td>
</tr>
<tr>
<td align="left" valign="top">3.0</td>
<td align="right" valign="top">0.04127</td>
<td align="right" valign="top">0.02063</td>
</tr>
</tbody>
</table>
<table-wrap-foot><p>Sample footnote text</p></table-wrap-foot>
</table-wrap>

<xref ref-type="table" rid="j_\jobname_tab_1">Table 1</xref>

<fig id="j_\jobname_fig_1">
<label>Figure 1:</label>
<caption><p>Schematic flow configuration.</p></caption>
<graphic xlink:href="epsname"></graphic>
</fig>

<xref ref-type="fig" rid="j_\jobname_fig_1">Figure 1</xref>

表头后面应该跟着<th align="left" valign="top">Head 1</th>标签。表头应该被标识\midrule。上面一行\midrule应该是表头标识。如果你认为\midrule没有,那么该行应该被视为普通<td align="left" valign="top">Head 1</td>标签。

请指教如何实现所需的输出。

相关内容