TextClipboardType

TextClipboardType

is an option for cells that specifies how Edit Copy treats a cell when converting it for the system's textual clipboard.

Details

  • TextClipboardType is typically used in stylesheets to customize the default clipboard behavior for different cell styles.
  • Choose Edit Copy As instead of TextClipboardType to change the clipboard type for a single copy operation.
  • The following settings can be used:
  • "PlainText"preserve the cell as plain text; equivalent to Edit Copy As Plain Text
    "InputText"preserve the Wolfram System's ability to reevaluate the cell; equivalent to Edit Copy As Input Text
    "Package"return exactly what you would get if you saved the cell as a package
  • By default, the value of TextClipboardType is "InputText" for input and output cells, "PlainText" for textual, print, and message cells, and "Package" for code cells.
  • Both "InputText" and "Package" preserve evaluation semantics. "InputText" will adjust white space and line breaks to make the result more readable, while "Package" preserves the whitespace exactly as it was typed into the cell.
  • "PlainText" creates a textual form that closely resembles the visual appearance, even if that appearance would not evaluate in Wolfram Language.

Examples

open allclose all

Basic Examples  (3)

Select the printed input cell below, choose Edit Copy, and paste into a text editor:

Here is the pasted form:

2+2     a
b c

Select the printed input cell below, choose Edit Copy, and paste into a text editor:

Here is the pasted form:

{
{2 + 2, a},
{b, c}
}

Select the printed input cell below, choose Edit Copy, and paste into a text editor:

Here is the pasted form:

{
{2+2, a},
{b, c}
}

Properties & Relations  (4)

When copying invisible boxes, "PlainText" will omit them:

Here is the pasted form:

abc

Other forms will preserve the box structure if necessary to preserve evaluation semantics:

Here is the pasted form:

\!\(
TagBox["abc",
"tag"]\)

"PlainText" will not include the quotes in a copied string if they did not display in the cell:

Here is the pasted form:

2+string

InterpretationBox  (1)

InterpretationBox copies as its appearance for "PlainText":

Here is the pasted form:

fish

Other values will copy the interpretation:

Here is the pasted form:

"fowl"

TemplateBox  (1)

TemplateBox copies the boxes in DisplayFunction for "PlainText":

Here is the pasted form:

2 millions

Other values will copy the InterpretationFunction:

Here is the pasted form:

2*10^6

Possible Issues  (1)

It is possible to override rules for some very common typesetting structures:

TextClipboardType will not consult kernel formatting rules to resolve these common cases:

Here is the pasted form:

super^5

A better approach is to create a formatting rule that uses a TagBox or TemplateBox:

Here is the pasted form:

\!\(
TagBox[
SuperscriptBox["super", "5"],
$CellContext`super]\)
Wolfram Research (2008), TextClipboardType, Wolfram Language function, https://reference.wolfram.com/language/ref/TextClipboardType.html.

Text

Wolfram Research (2008), TextClipboardType, Wolfram Language function, https://reference.wolfram.com/language/ref/TextClipboardType.html.

CMS

Wolfram Language. 2008. "TextClipboardType." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TextClipboardType.html.

APA

Wolfram Language. (2008). TextClipboardType. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TextClipboardType.html

BibTeX

@misc{reference.wolfram_2024_textclipboardtype, author="Wolfram Research", title="{TextClipboardType}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/TextClipboardType.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_textclipboardtype, organization={Wolfram Research}, title={TextClipboardType}, year={2008}, url={https://reference.wolfram.com/language/ref/TextClipboardType.html}, note=[Accessed: 21-November-2024 ]}