如何用单个命令隐藏尾注

如何用单个命令隐藏尾注

我使用endnotes.sty包创建作者查询。但我需要endnotemark在单个命令中隐藏和尾注文本\queriesoff。我不知道如何实现逻辑。请提供建议。

平均能量损失

\documentclass[twocolumn]{article}

\usepackage{authblk}
\usepackage{endnotes}
\usepackage{hyperref}
\usepackage{graphics}
%\usepackage{multicol}
\usepackage{graphicx}
\usepackage{vruler}
\usepackage{etoolbox}
\patchcmd{\makevruler}
{\tiny}
{\fontsize{8}{10}\selectfont}
{}
{}

% ------------- comment this at the first run -------------
\AtBeginDocument{\theendnotes\clearpage%
  \setvruler[10pt][1][1][4][1][0pt][0pt][0pt][\textheight]}
%----------------------------------------------------------


\begin{document}

\title{Sample document for endnotes}
\author[1,]{Junli Liu}
\author[2]{James Rowe}
\author[2]{Keith Lindsey}
\affil[1]{Integrative Cell Biology Laboratory, School of Biological and Biomedical Sciences, The Bio physical Sciences Institute, Durham University, Durham, UK}
\maketitle

\noindent Patterning\endnote{note1} in Arabidopsis root development
is coordinated via a localized auxin concentration maximum in the
root tip (Sabatini et al., 1999), requiring the regulated expression
of speciÞc genes. This auxin gradient has been hypothesized to be sink-driven (Friml et al., 2002) and com- putational modeling suggests that auxin efßux carrier activity may be sufÞcient to generate the gradient in the absence of auxin biosynthesis in the root (Grieneisen et al., 2007; Wabnik et al., 2010). However, other experimental studies show that local auxin biosynthesis modulates gradient- directed planar polarity in Arabidopsis, and a local source of auxin biosynthesis contributes to auxin gradient homeostasis (Ikeda et al., 2009). Thus genetic studies show that auxin biosynthesis (Ikeda et al., 2009; Normanly, 2010; Zhao, 2010), the AUX1/LAX inßux carriers (Swarup et al., 2005, 2008; Jones et al., 2008; Krupinski and Jonsson, 2010), and the PIN auxin efux carri- ers (Petr‡sek et al., 2006; Grieneisen et al., 2007; Krupinski and Jonsson, 2010; Mironova et al., 2010) all play important roles in the formation of auxin gradients. In addition, experimental evidence shows that, in root devel- opment, hormones and the associated regulatory and target genes form a network, in which relevant genes regulate hormone activ- ities and hormones regulate gene expression. For example, ethy- lene promotes auxin ßux in the root, in a process dependent on the POLARIS (PLS) peptide (Ruzicka et al., 2007; Swarup et al., 2007; Liu et al., 2010a). Furthermore, PIN levels are positively reg- ulated by ethylene and auxin in Arabidopsis roots (Ruzicka et al., 2007). Interestingly, cytokinin can negatively regulate PIN lev- els (Ruzicka et al., 2009), while repressing auxin biosynthesis and promoting ethylene responses (Nordstrom et al., 2004; Chandler, 2009; Liu et al., 2010a). Cytokinin also has the capacity to mod- ulate auxin transport, by transcriptional regulation of the PIN genes (Ruzicka et al., 2009).

\begin{figure}[!t]
\caption{The sample caption\label{fig:1}}
\end{figure}\endnote{figure endnote}
\end{document} 

我当前的输出和所需的输出如下所述: 在此处输入图片描述 在此处输入图片描述

我的双向链接endnote.sty供您参考:

\usepackage{color}
\@definecounter{endnote}
\def\theendnote{\@arabic\c@endnote}

\def\@makeenmark{\textcolor{red}{\fbox{Q\@theenmark}}}
\def\makeenmark{\@makeenmark}

\def\theenmark{\@theenmark}

\newdimen\endnotesep

\def\endnote{\@ifnextchar[\@xendnote{\stepcounter{endnote}%
     \protected@xdef\@theenmark{\theendnote}%
     \@endnotemark\@endnotetext}}

\def\@xendnote[#1]{%
   \begingroup
     \c@endnote=#1\relax
     \unrestored@protected@xdef\@theenmark{\theendnote}%
   \endgroup
   \@endnotemark\@endnotetext}

%  Here begins a section of endnote code that's really different from
% the footnote code of LaTeX.

\let\@doanenote=0
\let\@endanenote=0

\newwrite\@enotes
\newif\if@enotesopen \global\@enotesopenfalse

\def\@openenotes{\immediate\openout\@enotes=\jobname.ent\relax
      \global\@enotesopentrue}

%  The stuff with \next and \meaning is a trick from the TeXbook, 382,
% there intended for setting verbatim text, but here used to avoid
% macro expansion when the footnote text is written.  \next will have
% the entire text of the footnote as one long line, which might well
% overflow limits on output line length; the business with \newlinechar
% makes every space become a newline in the \@enotes file, so that all
% of the lines wind up being quite short.

\long\def\@endnotetext#1{%
     \if@enotesopen \else \@openenotes \fi
     \immediate\write\@enotes{\@doanenote{\@theenmark}}%
     \begingroup
        \def\next{#1}%
        \newlinechar='40
        \immediate\write\@enotes{\meaning\next}%
     \endgroup
     \immediate\write\@enotes{\@endanenote}}

% \addtoendnotes works the way the other endnote macros probably should
% have, requiring the use of \protect for fragile commands.

\long\def\addtoendnotes#1{%
     \if@enotesopen \else \@openenotes \fi
     \begingroup
        \newlinechar='40
        \let\protect\string
        \immediate\write\@enotes{#1}%
     \endgroup}

%  End of unique endnote code

\def\endnotemark{%
   \@ifnextchar[\@xendnotemark
     {\stepcounter{endnote}%
      \protected@xdef\@theenmark{\theendnote}%
      \@endnotemark}}

\def\@xendnotemark[#1]{%
   \begingroup
      \c@endnote #1\relax
      \unrestored@protected@xdef\@theenmark{\theendnote}%
   \endgroup
   \@endnotemark}

\def\@endnotemark{%
  \leavevmode
  \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
  \makeenmark
  \ifhmode\spacefactor\@x@sf\fi
  \relax}

\def\endnotetext{%
     \@ifnextchar [\@xendnotenext
       {\protected@xdef\@theenmark{\theendnote}%
    \@endnotetext}}

\def\@xendnotenext[#1]{\begingroup \c@endnote=#1\relax
   \xdef\@theenmark{\theendnote}\endgroup \@endnotetext}

\def\@xendnotenext[#1]{%
  \begingroup
     \c@endnote=#1\relax
     \unrestored@protected@xdef\@theenmark{\theendnote}%
  \endgroup
  \@endnotetext}


%  \theendnotes actually prints out the endnotes.

%  The user may want separate endnotes for each chapter, or a big
% block of them at the end of the whole document.  As it stands,
% either will work; you just say \theendnotes wherever you want the
% endnotes so far to be inserted.  However, you must add
% \setcounter{endnote}{0} after that if you want subsequent endnotes
% to start numbering at 1 again.

%  \enoteformat is provided so user can specify some special formatting
% for the endnotes.  It needs to set up the paragraph parameters, start
% the paragraph, and print the label.  The \mbox stuff in \enoteheading
% is to make and undo a dummy paragraph, to get around the games \section*
% plays with paragraph indenting and instead give us uniform
% indenting for all notes.

\def\notesname{Notes}%
\def\enoteheading{\section*{\notesname
  \@mkboth{\MakeUppercase{\notesname}}{\MakeUppercase{\notesname}}}%
  \mbox{}\par\vskip-\baselineskip}

\def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em
  \leavevmode\llap{\makeenmark}}

\def\enotesize{\footnotesize}

\def\theendnotes{\immediate\closeout\@enotes \global\@enotesopenfalse
  \begingroup
    \makeatletter
    %
    % The machinery with \@ResetGT and > here ensures that
    % \@doanenote works properly even if > is an active character
    % at the point where \theendnotes is invoked. > needs to have
    % catcode 12 when the arguments of \@doanenote are scanned, so
    % that the > in the string "macro:->" is matched.  The actual
    % footnote text is not an argument to \@doanenote, but just
    % follows it in the .ent file; so \@ResetGT can reset the
    % category code for > that should be used when processing
    % that text.  That resetting takes place within a
    % \begingroup-\endgroup block set up by \@doanenote and
    % \@endanenote, so the catcode for > is back to 12 for the
    % next note.
    %
    \edef\@tempa{`\string >}%
    \ifnum\catcode\@tempa=12%
      \let\@ResetGT\relax
    \else
      \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
      \@makeother\>%
    \fi
    \def\@doanenote##1##2>{\def\@theenmark{##1}\par\begingroup
        \@ResetGT
        \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}%
        \enoteformat}
    \def\@endanenote{\par\endgroup}%
    \enoteheading
    \enotesize
    \input{\jobname.ent}%
  \endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% hyperendnotes.sty started
\makeatletter
\newif\ifenotelinks
\newcounter{Hendnote}
% Redefining portions of endnotes-package:
\let\savedhref\href
\let\savedurl\url
\def\endnotemark{%
\@ifnextchar[\@xendnotemark{%
\stepcounter{endnote}%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotemark
}%
}%
\def\@xendnotemark[#1]{%
\begingroup\c@endnote#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\endgroup
\@endnotemark
}%
\def\endnotetext{%
\@ifnextchar[\@xendnotenext{%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotetext
}%
}%
\def\@xendnotenext[#1]{%
\begingroup
\c@endnote=#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\endgroup
\@endnotetext
}%
\def\endnote{%
\@ifnextchar[\@xendnote{%
\stepcounter{endnote}%
\protected@xdef\@theenmark{\theendnote}%
\protected@xdef\@theenvalue{\number\c@endnote}%
\@endnotemark\@endnotetext
}%
}%
\def\@xendnote[#1]{%
\begingroup
\c@endnote=#1\relax
\unrestored@protected@xdef\@theenmark{\theendnote}%
\unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
\show\@theenvalue
\endgroup
\@endnotemark\@endnotetext
}%
\def\@endnotemark{%
\leavevmode
\ifhmode
\edef\@x@sf{\the\spacefactor}\nobreak
\fi
\ifenotelinks
\expandafter\@firstofone
\else
\expandafter\@gobble
\fi
{%
\Hy@raisedlink{%
\hyper@@anchor{Hendnotepage.\@theenvalue}{\empty}%
}%
}%
\marginpar{\hyper@linkstart{link}{Hendnote.\@theenvalue}%
\makeenmark
\hyper@linkend}
\ifhmode
\spacefactor\@x@sf
\fi
\relax
}%
\long\def\@endnotetext#1{%
\if@enotesopen
\else
\@openenotes
\fi
\immediate\write\@enotes{%
\@doanenote{\@theenmark}{\@theenvalue}%
}%
\begingroup
\def\next{#1}%
\newlinechar='40
\immediate\write\@enotes{\meaning\next}%
\endgroup
\immediate\write\@enotes{%
\@endanenote
}%
}%
\def\theendnotes{%
\immediate\closeout\@enotes
\global\@enotesopenfalse
\begingroup
\makeatletter
\edef\@tempa{`\string>}%
\ifnum\catcode\@tempa=12
\let\@ResetGT\relax
\else
\edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
\@makeother\>%
\fi
\def\@doanenote##1##2##3>{%
\def\@theenmark{##1}%
\def\@theenvalue{##2}%
\par
\smallskip %<-small vertical gap between endnotes
\begingroup
\def\href{\expandafter\savedhref}%
\def\url{\expandafter\savedurl}%
\@ResetGT
\edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}%
\enoteformat
}%
\def\@endanenote{%
\par\endgroup
}%
% Redefine, how numbers are formatted in the endnotes-section:
\renewcommand*\@makeenmark{%
\hbox{\normalfont\@theenmark~}%
}%
% header of endnotes-section
\enoteheading
% font-size of endnotes
\enotesize
\input{\jobname.ent}%
\endgroup
}%
\def\enoteformat{%
\rightskip\z@
\leftskip1.8em
\parindent\z@
\leavevmode\llap{%
\setcounter{Hendnote}{\@theenvalue}%
\addtocounter{Hendnote}{-1}%
\refstepcounter{Hendnote}%
\ifenotelinks
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi
{\@firstofone}%
{\hyperlink{Hendnotepage.\@theenvalue}}%
{\makeenmark}%
}%
}%
% stop redefining portions of endnotes-package:
\makeatother
% Toggle switch in order to turn on/off back-links in the
% endnote-section:
\enotelinkstrue
%\enotelinksfalse

答案1

您可以使用布尔开关:

\newif\ifEndNotes
%\EndNotestrue Un-comment out to have the endnotes

\makeatletter
\ifEndNotes
\else
  \let\endnote\@gobble
  \let\theendnotes\relax
\fi
\makeatother

取消注释该行以\EndNotestrue显示结束注释。

简单修改一下就可以得到所需的命令:

\newif\ifEndNotes
\def\queriesoff{\EndNotesfalse}
\def\querieson{\EndNotestrue}

\querieson
%\queriesoff Un-comment out to suppress the end notes

\makeatletter
\ifEndNotes
\else
  \let\endnote\@gobble
  \let\theendnotes\relax
\fi
\makeatother

相关内容