许多学术期刊都实践双盲同行评审这意味着作者需要通过删除任何可能泄露作者身份的引用来隐藏其文档。我如何利用 TeX 和朋友的强大功能来隐藏或匿名化文档?或者更直白地说:人们如何成功隐藏他们的 LaTeX 文档?
以下是我能想到的一些技巧:
- 搜索并替换某人的姓名、所属机构等术语。
- 使用宏来编写敏感术语,例如
\newcommand\myname{N.N.}
,并在盲法时替换定义。 - 将敏感信息保存在单独的文件中,当保密时,这些文件不会包含在主文件中。
- 使用版本控制,以便可以轻松跟踪和撤销重大更改。
如果您能详细解答如何实施上述任何技术或它们各自的优点,我们将不胜感激。
答案1
我修改了Antal SZ 的回答到这个问题允许文本完全地隐藏 - 即隐藏的文本将从文档中完全删除,以防止在使用鼠标光标标记或使用其他工具分析文档时显示它。但是,布局和外貌周围的文本将保持不变(尽管由于连字符的变化可能会出现一些细微的差异)。
以下是完整代码:
\documentclass{minimal}
\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{calc}
\makeatletter
\newif\if@anonymize
\@anonymizetrue % Uncomment to hide text
%\@anonymizefalse % Uncomment to show text
\if@anonymize
\newcommand{\highlight@DoHighlight}{
\fill [outer sep = -15pt, inner sep = 0pt, color=black]
($(begin highlight)+(0,8pt)$) rectangle ($(end highlight)+(0,-3pt)$) ;
}
\newcommand{\highlight@BeginHighlight}{
\coordinate (begin highlight) at (0,0) ;
}
\newcommand{\highlight@EndHighlight}{
\coordinate (end highlight) at (0,0) ;
}
\newdimen\highlight@previous
\newdimen\highlight@current
\newlength{\item@width}
\DeclareRobustCommand*\anonymize{%
\SOUL@setup
\def\SOUL@preamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@BeginHighlight
\highlight@EndHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@postamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@EndHighlight
\highlight@DoHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@everyhyphen{%
\discretionary{%
\SOUL@setkern\SOUL@hyphkern
\SOUL@sethyphenchar
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everyexhyphen##1{%
\SOUL@setkern\SOUL@hyphkern
\settowidth{\item@width}{##1}%
\makebox[\item@width]{}%
\discretionary{%
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everysyllable{%
\begin{tikzpicture}[overlay, remember picture]
\path let \p0 = (begin highlight), \p1 = (0,0) in \pgfextra
\global\highlight@previous=\y0
\global\highlight@current =\y1
\endpgfextra (0,0) ;
\ifdim\highlight@current < \highlight@previous
\highlight@DoHighlight
\highlight@BeginHighlight
\fi
\end{tikzpicture}%
\settowidth{\item@width}{\the\SOUL@syllable}%
\makebox[\item@width]{}%
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}%
\SOUL@
}
\else
\newcommand{\anonymize}[1]{#1}
\fi
\makeatother
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet urna
nulla. Nam placerat risus quis elit placerat consectetur a in magna. Ut vitae
urna vitae urna sagittis mollis sed a velit. \anonymize{Phasellus enim tellus,
dictum nec sagittis sit amet, viverra at leo.} Pellentesque faucibus orci non
urna facilisis sed venenatis lacus ultricies. In in diam ut massa sodales
consequat at ut mi. Mauris pharetra tortor et nunc iaculis aliquet sodales
turpis convallis. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. \anonymize{Morbi vulputate}, risus non
accumsan vulputate, justo mauris pretium lorem, nec rhoncus mi nisl sit amet
lacus. Aenean metus nunc, sagittis in dictum sed, facilisis sit amet ante. Fusce
enim lorem, pharetra non congue a, vehicula id metus. Nam facilisis, velit
condimentum volutpat tristique, elit elit tristique est, a varius nulla purus
non mi. Nam elementum viverra ligula sit amet hendrerit. Aenean sit amet tempus
turpis. Suspendisse at risus quis eros semper cursus.
\anonymize{Nunc eleifend, augue non lacinia sagittis, lorem elit ullamcorper
libero, non placerat massa lectus vel nisi. Phasellus nunc elit, porttitor
tempor placerat et, semper sed leo. Integer commodo molestie pretium. Ut eu
dolor velit. Phasellus sed dui nunc. Donec iaculis est eu felis accumsan
sodales. Vivamus hendrerit dignissim faucibus.}
In congue condimentum metus in ornare. Etiam at diam vitae mi laoreet
consectetur. \anonymize{Curabitur at turpis commodo nisi tempus tincidunt. Nam
vestibulum lacinia mi, vitae auctor erat consequat ac.} Phasellus semper
blandit orci ac varius. Praesent et magna a mi faucibus porta a non libero. Cum
sociis natoque penatibus et magnis dis parturient montes, \anonymize{nascetur}
ridiculus mus. Nulla facilisi. Nullam commodo volutpat ante ac ornare. Donec
convallis diam accumsan ipsum porta eu elementum leo lacinia. Cras tincidunt
semper mauris, ut mollis lectus consectetur quis. \anonymize{Pellentesque sem
urna}, fringilla eget faucibus quis, condimentum nec mi. Quisque odio felis,
fermentum quis feugiat placerat, dapibus vitae massa. \anonymize{Ut semper elit
eget dolor imperdiet posuere.}
\end{document}
下面是一个显示匿名化和未匿名化的文本的示例。可以通过简单的注释和取消注释两行代码来控制设置。
匿名:
不匿名:
答案2
我不会编写特殊宏,而是使用灵魂包\hl
突出显示功能。在最终版本中,您可以取消其效果。
\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{soul}
\sethlcolor{black}
\makeatletter
\newif\if@blind
\@blindtrue %use \@blindfalse on final version
\if@blind \sethlcolor{black}\else
\let\hl\relax
\fi
\title{This is my title}
\author{\hl{Y Lazarides}}
\begin{document}
\maketitle
\hl{In our paper (Jones 22)} \lipsum*[1]
\end{document}
在最终版本中,将布尔值设置\if@blind
为\@blindfalse
(第 7 行)。
如果您只想吞噬文本而不是将其清空,请将代码更改为:
\if@blind \def\hl#1{}\else
\let\hl\relax
\fi
总结一些评论,似乎不存在任何安全的和高效的 自动“盲写”文档的方法。如果确保自己不受他人偏见的歧视对你来说很重要,那么最安全的方法可能是按下save as
按钮并重写论文的某些部分。
答案3
试试我的censor
包裹用于消除文本,同时保留其原始间距。编辑以演示\xblackout
和\censorbox
,以及\censor
和\blackout
。\xblackout
将稍微渗入边距。
\blackout
和均可\xblackout
跨换行符和段落边界工作。但是,这些宏中的连字符会丢失。
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{censor,caption}
\parskip 1ex
\begin{document}
The \censor{Liberty} missile, with charge diameter (CD) of
\censor{80}~mm, revealed a penetration capability of 1.30,
1.19, and 1.37~CD in three recent tests into armor steel.
\blackout{%
The Liberty missile, with charge diameter (CD) of 80~mm,
revealed a penetration capability of 1.30, 1.19, and 1.37~CD
in three recent tests into armor steel.}
\xblackout{%
The Liberty missile, with charge diameter (CD) of 80~mm,
revealed a penetration capability of 1.30, 1.19, and 1.37~CD
in three recent tests into armor steel.}
\begin{table}[ht]
\centering
\caption{This is my \protect\censor{censored caption.}}
\censorbox{
\begin{tabular}{|c|c|}
\hline
This & is my\\
tabular & content
\end{tabular}
}
\end{table}
\end{document}
答案4
我不会定义许多命令(例如、等),而是\myname
只\collabname
定义一个命令,该命令采用非盲文本并将其替换为盲文本;审核完成后,您可以重新定义它以返回未更改的文本。
\documentclass{article}
% Create the dimension variables outside the macro, so they'll
% be created once. (Each new creation consumes a new register)
\newlength{\sohigh}%
\newlength{\sowide}%
\def\blind#1{%
% To use blank lines in code, the comment mark is necessary --
% else, LaTeX inserts \pars.
%
% Set the dimensions of the black stripe
\settoheight{\sohigh}{\hbox{H}}%
\settowidth{\sowide}{\hbox{#1}}%
%
% ... and use them.
\rule{\sowide}{\sohigh}%
}
% Alternative, for if you don't particularly care about pretty boxes
% or if the length of the blacked-out text would provide a clue.
%\def\blind#1{CENSORED}
% When you no longer want to blind, use this instead.
%\def\blind#1{#1}
\begin{document}
Hello \blind{World}.
\end{document}
应该也有\begin{blind}...\end{blind}
,但由于我对 LaTeX 经验不足,我不知道如何定义它们。欢迎改进。