# Tag Info

28

Since a native method is not forthcoming, I shall post my file based circumvention, for Windows. You will need to have this utility in the command path (it apparently is stock with Windows 7). copyUnicode[expr_] := Run["clip <", Export["$Clipboard.temp", ToString[expr, InputForm], "Text", CharacterEncoding -> "Unicode"] ]; Usage: expr ... 20 Declaration: This method for Windows is based on the .NET code from Todd Gayley's this wonderful answer. My .NET knowledge is absolutely ZERO, all credit goes to Todd. Code: The main idea is to extract the "Input"-style code string, convert it to the UTF-16 little endian form, which is the standard byte order in Windows, feed the bytes to system clipboard ... 14 As Mr.Wizard showed me here. You use UndocumentedTestFEParserPacket to print the pasted data. For example: FixSpacesAndLineBreaksFormatting[t_] := (StringReplace[t, { RegularExpression["^[ ]+$"] -> "", "\n" -> "\[IndentingNewLine]"}]); CellPrint@Cell[ Replace[ First@FrontEndExecute@UndocumentedTestFEParserPacket[ Catch[...

12

Edit 2: A new version of the Mac solution with button is listed below Fixed problem with pasting into textarea In some applications on Mac, copying as Unicode from Mathematica already works without having to do any postprocessing. However, it doesn't work in textarea fields in web browsers. Nevertheless, if you're willing to do a few additional mouse ...

9

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.) 1. Add Package Copy Silvia's first code block that starts with Needs["NETLink"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path. 2. Initialize the Front End Save the ... 9 Here's a version that doesn't require a temporary file. Linux (needs xclip) SetAttributes[copyUnicode, HoldAll]; copyUnicode[expr_] := With[{ stream = OpenWrite["!xclip -in -selection clipboard", CharacterEncoding -> "UTF-8"] }, WriteString[stream, ToString[Unevaluated@expr, InputForm]]; Close@stream; ]; Example: executing the cell ... 8 I use a small web application for when there are too many to convert by hand. 8 As a start we can create a basic paste function using the ClipboardNotebook as follows: pasteRaw[] := NotebookGet[ClipboardNotebook[]] /. Notebook[{Cell[BoxData[data_] | data_, ___]}, ___] :> (CellPrint[Cell[BoxData[data], "Input"]];) After copying the desired text you can evaluate pasteRaw[] to paste it as input. At present no syntax checking ... 7 In your code notebook go to menu Format, Edit StyleSheet paste in the following Cell[StyleData[All, "Printout"], ShowAutoStyles->True, ShowSyntaxStyles->True] select 'with interpretation' (upon prompt). Close the stylesheet. In the code notebook paste and evaluate Export["eg.pdf", EvaluationNotebook[]] Copy the colour-formatted text from the ... 7 Here is a function that copies a Unicode string to the clipboard using JLink: Needs["JLink"]; InstallJava[]; LoadJavaClass["java.awt.Toolkit", AllowShortContext -> False]; uniclip[s_String] := JavaBlock[ javaawtToolkit`getDefaultToolkit[]@getSystemClipboard[]@setContents[#, #]& @ JavaNew["java.awt.datatransfer.StringSelection", s] ];... 4 I think this is the problem you are talking about (screen shot from Word): In Mathematica 9, the line thickness was less so it looked like this: One thing you could try is to set the line thickness explicitly in Mathematica 10: Plot[Sin[x], {x, 0, 10}, PlotStyle -> AbsoluteThickness[0]] Then, it will look like this in Word: Which is closer to ... 3 I'm not understanding, or I can't reproduce the behaviour of the pasting of the first part, please post a more concrete example. As to the 0.3333 issue, you could set the NumberMarks option of the input cells to False. Also, if you really meant that you wanted it copied as 0.3333 when your output had been 0.333333 you should also change PrintPrecision to 4 ... 3 I know a very awkward way to make an Input cell which behaves the way you are looking for. It has different editing properties. I came across such cells when importing notebooks from very long ago. They were from the mid 1990's either Mathematica 3 or Mathematica 4 and they had editing properties, which I still miss very much today. Here I show you a ... 1 try this: CopyFile[First@FileNames[ "E:\\work\\META分析\\source\\GSE28160_RAW1\\" ~~ cases[[1]] ~~"*.CEL"], "E:\\work\\1.CEL"] CopyFile on is own does not do filesystem globbing and so the way you have it its looking for a file that literally has a "*" in its name. 1 Something like... Export["C:\\Temp\\Out.txt",StringJoin[Riffle[Map[ToString[Out[#]]&,{1,2,3}],";"]]] I'd suggest you look up each of Export, StringJoin, Riffle, Map, ToString etc to work out what does what. 1 As a generalization to the excellent answer by ens, Silvia's solution also can be added as a palette to the menu as follows. First, create and save the UniCodeCopy.m package, as described by ens. Then create as a separate notebook, perhaps named Unicode Copy Source.nb, CreatePalette[Button["UniCode Copy", Module[{codestr}, AppendTo[$...

Only top voted, non community-wiki answers of a minimum length are eligible