簡體   English   中英

Latex \\ newcommand參數

[英]Latex \newcommand argument

我有一個Latex文本,我想寫一個非常基本的類來渲染。 基本上所有文本的命令都需要定義。 到目前為止,我做得很好,直到我點擊這個:

\\swordfootnote{1}{}{Philemon 1:23}{crossReference}{}{See \\swordxref{Col.1.7}{Col. 1:7}}

基本上這是一個花哨的腳注,我至少在這個時刻想要作為一個腳注呈現。 它有6個參數,但我真的只需要最后一個,這是腳注文本。

我做了以下事情:

\\RequirePackage{hyperref} \\newcommand{\\swordxref}[2]{\\hyperref{#1}{#2}} \\newcommand{\\swordfootnote}[6]{\\footnote{#6}}

我正在編譯消息,這是多余的}。

! Argument of \\@finalstrut has an extra }. <inserted text> \\par l.9 ...ver. 9}; See \\swordxref{Eph.3.1}{Eph. 3:1}}

關於我做錯了什么的任何建議?

您對\\hyperref使用不正確。 \\hyperref的“雙參數”版本使用該接口

\hyperref[<label>]{<text>}

用方括號表示第一個參數。

這是一個顯示用法的最小示例:

在此輸入圖像描述

\documentclass{article}
\usepackage[paperheight=20\baselineskip]{geometry}% Just for this example
\usepackage{hyperref}
\newcommand{\swordxref}[2]{\hyperref[#1]{#2}}
\newcommand{\swordfootnote}[6]{\footnote{#6}}
\begin{document}

\section{A section}\label{sec:section}

See~\swordxref{sec:section}{this section} or a footnote\swordfootnote{1}{2}{3}{4}{5}{See~\swordxref{sec:section}{this section}.}.

\end{document}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM