-1

How can I replace, during compilation, all the white spaces of my document, except in the frontmatter and the bibliography, by

\textcolor{white}{i} + <a white space>

Here is a MWE to work on.

\documentclass[twocolumn]{autart} 
\usepackage{lipsum}
\usepackage{filecontents}
\begin{filecontents*}{My.bib}   
   @Article{b,
      date =     2003,
      author =   {Author, Amy},
      title =    {Title},
      journaltitle = {Journal},
      volume =   10,
      number =   4,
      doi = {10.1016/j.automatica.2013.06.002},
      pages =    {100-141}}   
  \end{filecontents*}
 \bibliographystyle{plain}

\begin{document} \begin{frontmatter} \author[MyCity]{Marcus}\ead{myemail@gmail.com}, \address[MyCity]{My University, My address, My City}

    \begin{abstract}
        Hello, abstract!
    \end{abstract}
\end{frontmatter}
    \lipsum \cite{b}.

\bibliography{My.bib} \end{document}

rasha
  • 704
  • Whitespace becomes glue during tokenization. What do you need to do? Other solutions could become possible for your use-case, e.g. censor package. Also: \textcolor{white}{i} + <a white space> = 2 "spaces" for the user; \textcolor{white}{i} becomes visible when pagecolor is not transparent or white, or if textblock is selected with the mouse. Also, every word will copy-paste as wordi, – Cicada Oct 23 '22 at 05:42
  • Note that EOL converts to "space" (and tabs etc). Note also, successive white space is collapsed (to glue or \par and so on), so do you want i i i i i... or i or some other variation? (e.g., max of 1 i per word, or multiple?) – Cicada Oct 23 '22 at 05:47
  • @Cicada I'd like to substitute each single space in the final document by a <single white i linked to the previous word + a single space>. Example: <Hello world, how are you?> would become <Helloi world,i howi arei you?> where each i appears in white on a white page (i.e. does not appear) and the space is anyway present to cut words and go to new line when needed. – rasha Oct 23 '22 at 09:21
  • The main objective is to prevent automatic softwares from detecting autoplagiat. When we write research papers, we often use some standard definitions from one paper to another before presenting our original results. Those softwares prevent us even from recalling standard definitions :-( – rasha Oct 23 '22 at 09:22
  • The i letter is chosen as it takes the less space. But may be it is not the right way to prevent those softwares from detecting autoplagiat? – rasha Oct 23 '22 at 09:24
  • 1
    Best way to avoid it is not to try to avoid it. Rewrite and rephrase: refer to the previous definition and cite the reference for it - see e.g., aje. What is termed "uncited recycled information" is not original work, and may even be copyright infringement - see aje. Unrelated: howi arei youi? will give spell-check error: it won't care what colour the text is. – Cicada Oct 23 '22 at 10:57
  • Write as if the reader has the standard definitions open in front of them while reading your paper. – Cicada Oct 23 '22 at 11:06
  • While I'm not approving of the ethics of your intention, I don't see anything wrong with the question itself. Probably also solves the issue: copy paste - Is it possible to produce a PDF with un-copyable text? - TeX - LaTeX Stack Exchange – user202729 Oct 23 '22 at 14:32
  • This task is borderline impossible to completely automate correctly in all cases. Nevertheless an easy-to-understand way for people without much LaTeX programming experience is to use the editor to replace all space with your snippet (or a short macro), then replace back when you need to edit it. – user202729 Oct 23 '22 at 14:35
  • @Cicada Technically, white space becomes (explicit) space tokens during tokenization. – user202729 Oct 23 '22 at 14:36

1 Answers1

0

The question is an XY question and also a subset of the more general question of how attaching arbitrary metatext to text can be done.

For example, in the first instance, using white-text, with zero-width boxes taking care of the extra spacing.

boxes

Obviously, a non-white page colour (\pagecolor{black}, for example), makes white text visible.

Plus, copy-pasting reveals "gibberish":

TheCcoaptCysroaiptgCyhortonipgC2tyh0ohrt2pei2g2Cy.mh0roti2Aapg22thyl.l.

MWE

\documentclass{article}
\usepackage{xcolor}

\newcommand\cmetatext{Copyright 2022. All Rights Reserved. }

\ExplSyntaxOn

\NewDocumentCommand { \cmeta } { s } { \tl_set:Nx \l_tmpb_tl { \cmetatext } \hbox_set:Nn \l_tmpb_box { \l_tmpb_tl } \IfBooleanF { #1 } { \box_set_wd:Nn \l_tmpb_box { 0pt } } \group_begin: \IfBooleanTF { #1 } { \color{blue} } { \color{white} }

            \box_use:N  \l_tmpb_box
    \group_end:

}

\NewDocumentEnvironment { cmetaenv } { s +b } { \tl_set:Nx \l_tmpa_tl { #2 } \IfBooleanTF { #1 } { \regex_replace_all:nnN { (\S+) } { \0 \c{cmeta}* } \l_tmpa_tl } { \regex_replace_all:nnN { (\S+) } { \0 \c{cmeta} } \l_tmpa_tl }

        \tl_use:N \l_tmpa_tl

}{}

\ExplSyntaxOff

\newcommand\test{The cat sat on the mat. }

\begin{document}

zero-width box, white text:

\begin{cmetaenv} \test \test \test \end{cmetaenv}

\test\cmeta\ xxx

\bigskip natural-width box, blue text:

\begin{cmetaenv}* \test \test \test \end{cmetaenv}

\test\cmeta*\ xxx

\end{document}


However, leaving out zero-width boxes and white text, and instead scaling the metatext font to Infodot sizes results in:

in plain sight

Zooming in:

zoom 1

Zooming in some more:

zoom 2

and the result of copy-pasting is the much more legible:

TheCopyright 2022. All Rights Reserved. catCopyright 2022. All Rights Reserved. satCopyright 2022. All Rights Reserved. onCopyright 2022. All Rights Reserved. theCopyright 2022. All Rights Reserved. mat.Copyright 2022. All Rights Reserved. The

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{NotoSerif}
\newfontface\infofont[Scale=0.001]{NotoSerif}

\newcommand\cmetatext{{\infofont Copyright 2022. All Rights Reserved. }}

\ExplSyntaxOn

\NewDocumentCommand { \cmeta } { s } { \tl_set:Nx \l_tmpb_tl { \cmetatext } \hbox_set:Nn \l_tmpb_box { \l_tmpb_tl }

    \group_begin:
    \IfBooleanTF { #1 }
    {
            \color{blue}
    }
    {
            \color{white}
    }

            \box_use:N  \l_tmpb_box
    \group_end:

}

\NewDocumentEnvironment { cmetaenv } { s +b } { \tl_set:Nx \l_tmpa_tl { #2 } \IfBooleanTF { #1 } { \regex_replace_all:nnN { (\S+) } { \0 \c{cmeta}* } \l_tmpa_tl } { \regex_replace_all:nnN { (\S+) } { \0 \c{cmeta} } \l_tmpa_tl }

        \tl_use:N \l_tmpa_tl

}{}

\ExplSyntaxOff

\newcommand\test{The cat sat on the mat. }

\begin{document}

natural-width box, white text:

\begin{cmetaenv} \test \test \test \end{cmetaenv}

\test\cmeta\ xxx

\bigskip natural-width box, blue text:

\begin{cmetaenv}* \test \test \test \end{cmetaenv}

\test\cmeta*\ xxx

\end{document}


Using any method to try to take attribution and ownership away from others is not recommended, and it displays lack of academic ability.


On the use-case side, metatext allows the creation of three-dimensional texts, where one document can be a whole library.

Cicada
  • 10,129