命令删除文本和引用?

命令删除文本和引用?

我正在对一个大文档进行重大编辑(砍杀),想要对其中的内容进行字数统计(因此是 texcount),并且,当我在编辑和我们正在审查时,我想保留我在删除线文本中删除的内容。

文本中有引文,因此有些地方也需要删除线,我希望能够通过简单更改命令轻松地从最终文档中删除此文本,如果忽略文本,我希望忽略该部分中的任何引文,这样 LaTeX 就不会通过.bib文件查找并将引文添加到bibliography。目前,我正在尝试makeboxes格式化删除线,但没有得到我期望的结果。

我是新手,LaTeX所以请原谅我的代码不好。下面的代码中有更多解释。谢谢

%TC: macro \cmd [1]

\documentclass[]{article}
\immediate\write18{texcount.pl -total \jobname.tex -out=\jobname.sum}

\newcommand{\cmt}[1]{}
\usepackage{ulem}

\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{verbatim}
\newcommand\wordcount{\verbatiminput{\jobname.sum}}


% This is my command. I want to strike out, 
\newcommand{\strikeit}[1]
{
\makebox[\textwidth][s]{\sout{#1}}
}



\begin{document}
The first thing I want is to have this word count which ignores the words contained in the \textbackslash cmd macro
\wordcount

I want to be able to strike out text \sout{like this} and also be able to \sout{strikeout citations like this : \mbox{\cite{CA,HB98}}} and still have evertthing in situ but do all of this from a command that I can later edit to remove the edits from my pdf if they are all approved rather than manually editing the tex file twice.

Problem 1: This should be the width of the page and be in situ, but it's not \strikeit{\blindtext}

How do I wrap the text to the page (or text) width?

Problem 2: The next issue I am having is to do with citations.
\strikeit{
    \cite{CA,HB98} 
}

As you can see, the first citation is there, but the second is missing.
Also I'm getting the error \textit{Undefined Control Sequence. \}}

And Problem 3: When the edits are accepted I want to ultimatly be able to generate a PDF that will ignore these sections of text by changing my command \textit{\textbackslash strikeit} to

\textit{\textbackslash newcommand{\textbackslash strikeit}[1]{}}

but will also not process the citations if they are inside that command.

\begin{thebibliography}{1}

    \bibitem{HB98} Huynen, M.~A. and Bork, P. 1998. Measuring genome evolution. {\em
        Proceedings of the National Academy of Sciences USA}
    95:5849--5856.
    \bibitem{CA} Caprara, A. 1997. Sorting by reversals is difficult. In: {\em
        Proceedings of the First Annual International Conference on Computational
        Molecular Biology (RECOMB 97),} New York: ACM.  pp. 75-83.
\end{thebibliography} 
\end{document}

答案1

这是解决了 情况下的文本换行问题,但它消除了和等情况strikeout下的问题。\sout\cite

我已经定义了一个\ifcorrectingmode开关并使用 将其设置为 true \correctingmodetrue

当此功能处于活动状态时,\strikeit将显示效果\sout。在最终运行中,只需说\correctingmodefalse并且\strikeit不执行任何操作。

\cite命令不可扩展,这就是它\sout不起作用的原因,但可以将其放入\cite框中,然后将其划掉。

%TC:macro \cmt [ignore]

\documentclass[]{article}
\immediate\write18{texcount -total \jobname.tex -out=\jobname.sum}

\usepackage{ulem}

\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{verbatim}

\usepackage{letltxmacro}
\newcommand{\cmt}[1]{}



\newcommand\wordcount{\verbatiminput{\jobname.sum}}

\newif\ifcorrectingmode
\correctingmodetrue

\LetLtxMacro\origcite\cite

% This is my command. I want to strike out, 
\newcommand{\strikeit}[1]{%
  \ifcorrectingmode
  \mbox{\sout{#1}}%
%  \makebox[\textwidth][s]{\sout{#1}}%
  \fi
}

\renewcommand{\cite}[2][]{%
  \ifcorrectingmode
  \mbox{\origcite[#1]{#2}}%
  \else
  \origcite[#1]{#2}%
  \fi
}

\begin{document}
The first thing I want is to have this word count which ignores the words contained in the \textbackslash cmd macro
\wordcount

I want to be able to strike out text \sout{like this} and also be able to \sout{strikeout citations like this : \mbox{\cite{CA,HB98}}} and still have evertthing in situ but do all of this from a command that I can later edit to remove the edits from my pdf if they are all approved rather than manually editing the tex file twice.

Problem 1: This should be the width of the page and be in situ, but it's not \strikeit{\blindtext}

How do I wrap the text to the page (or text) width?

Problem 2: The next issue I am having is to do with citations.
\strikeit{%
  \cite{CA,HB98}
}

As you can see, the first citation is there, but the second is missing.
Also I'm getting the error \textit{Undefined Control Sequence. \}}

And Problem 3: When the edits are accepted I want to ultimatly be able to generate a PDF that will ignore these sections of text by changing my command 
\verb+\strikeit+ to

\verb+\newcommand{\strikeit}[1]{}+

but will also not process the citations if they are inside that command.

\begin{thebibliography}{1}

    \bibitem{HB98} Huynen, M.~A. and Bork, P. 1998. Measuring genome evolution. {\em
        Proceedings of the National Academy of Sciences USA}
    95:5849--5856.
    \bibitem{CA} Caprara, A. 1997. Sorting by reversals is difficult. In: {\em
        Proceedings of the First Annual International Conference on Computational
        Molecular Biology (RECOMB 97),} New York: ACM.  pp. 75-83.
\end{thebibliography} 
\end{document}

相关内容