简体   繁体   中英

Latex \newcommand argument

I have a Latex text for which I want to write a very basic class to render. basically all of the text's commands need defining. I am doing well so far until I hit this:

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

Basically this is a fancy footnote which I simply, at this moment at least, want to render as a footnote. It has 6 arguments, but I really only need the last one, which is the footnote text.

I have done the following:

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

I am getting on compiling messages that there is a superfluous }.

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

Any suggestions as to what I am doing wrong?

Your use of \\hyperref is incorrect. The "two-argument" version of \\hyperref uses the interface

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

with square brackets for the first argument.

Here's a minimal example showing the usage:

在此输入图像描述

\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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM