Questions tagged [text]

Questions relating to working with textual information: textual analysis, data mining, etc.

Filter by
Sorted by
Tagged with
35 votes
2 answers
3k views

How do I extract the contents of a selected cell as plain text?

My aim is to extract the contents of an Input cells as plain text. Ideally I would like to be able to select one or more Input cells and press a button which would then extract the text from these ...
user avatar
  • 35.3k
44 votes
5 answers
21k views

How to import all files of a folder at once?

I know how to import one textfile by calling its name filestring = Import["myfile.tex", "Text"]; Then "filestring" is a string with the myfile content. How do ...
user avatar
  • 1,455
42 votes
4 answers
2k views

Is there a convenient way to copy/paste text-interspersed SE code snippets into Mathematica?

Is there a way to copy and paste code snippets from SE to Mathematica if these snippets are interspersed with text? Like e.g. in Morphing Graphics, color and location in both the question and answer, ...
user avatar
30 votes
3 answers
3k views

"Covering up" text in Graphics

Consider the following code: ...
user avatar
  • 2,169
33 votes
6 answers
5k views

How can I wrap text around a circle?

How can I wrap text around a circle? For example: the text in the sectors of this chord plot. Perhaps one could use FilledCurve[] and then apply a ...
user avatar
  • 30.6k
32 votes
3 answers
3k views

Is there a way to outline text?

If I have: Graphics[ {Red, EdgeForm[Directive[White, Thick]], Inset[Style[Text@"Hi!", 44], {0, 0}]}, Background -> Black ] I unfortunately get: ...
user avatar
  • 4,572
33 votes
4 answers
2k views

Movable text on a curve

Having an arbitrary curve defined as InterpolatingFunction, what is the best way to place a text on this curve? The text generally has two rows, for example: ...
user avatar
21 votes
4 answers
14k views

Skip header lines on import

When importing a data file what are the comment symbols for Mathematica? That is, given a file like this blabla bulbul 1 2 6 54 7 ... .. what symbol do I have ...
user avatar
  • 1,525
11 votes
1 answer
1k views

Poor anti-aliasing in Rotated text with ClearType on

There is a problem on my system that occurs when text is rotated 90 degrees as it is in frame labels. This only happens when ClearType is turned on, and only around 90 degrees of rotation. I am ...
user avatar
  • 265k
15 votes
2 answers
2k views

Computing the bounding boxes for Text objects

Regardless of AspectRatio, the Text boxes overlap. ...
user avatar
  • 14.8k
18 votes
3 answers
1k views

Highlighting pattern strings in a large text

I would like to apply Style to strings that are matched, for example, with one or more specified patterns or regular expressions, a string or a list of both, ...
user avatar
14 votes
2 answers
1k views

Dimensions of the results of Text[] within Graphics[]

Is there a way to get the dimensions that the results of a Text[] will occupy within a Graphics[]? Specifically, if I run ...
user avatar
  • 3,129
14 votes
2 answers
2k views

How to position text labels automatically to not overlap other graphics elements?

I was plotting reciprocal frame projection using Locators for a point to be expressed in terms of both the original basis (also specified with ...
user avatar
  • 6,228
13 votes
2 answers
6k views

How to dynamically name and date a file for export?

I have various functions that export Excel and text files, and need to have them named with a name based on the content of some variables in the function and the time and date. How can this be done ...
user avatar
  • 4,376
16 votes
2 answers
1k views

Backslash commands in strings?

I discovered by playing around that Text[DisplayForm@SubscriptBox["λ", "k"]] produces the same result as ...
user avatar
  • 8,571
3 votes
5 answers
685 views

How to write a function to remove comments from a .m source file preserving formatting such as line wrapping reasonably?

How to write a function to remove comments from a .m source file preserving formatting such as line wrapping reasonably? This means if I have ...
user avatar
  • 8,404
2 votes
3 answers
2k views

Outputting a fraction on one line with an oblique division sign

How can I make Mathematica output a fraction as x/2 as opposed to the x on top with a horizontal bar and ...
user avatar
17 votes
4 answers
1k views

How to determine the convex hull of some text?

How can I get the co-ordinates of the convex hull of a piece of Text?
user avatar
  • 1,650
15 votes
4 answers
19k views

subscripts in plot axis labels

Superscripts can be included in axis labels by the use of the caret symbol (e.g., Plot[x^2, {x, -1, 1}, AxesLabel -> {x, x^2}]). How does one include subscripts ...
user avatar
  • 1,387
2 votes
3 answers
2k views

How to import files with headers?

R has excellent header supports such as read.table with header options. I don't want to mess up with text-processing or stream-processing. I am looking for a similar tool as in R because it saves a ...
user avatar
  • 2,453
8 votes
3 answers
257 views

Re-encode text file to use Mathematica's character name, like \[Alpha]

How can I re-encode a text file (or string) so that non-ASCII characters will be represented using Mathematica's standard names? For example, if the original contents of the file was ...
user avatar
  • 227k
7 votes
1 answer
2k views

how to export data as text file

I have a list abc={{{x1,y1},{x2,y2},{x3,y3}}}, where all the x and y are the coordinates. How to import the coordinates into a text file, in which each line only ...
user avatar
  • 947
19 votes
3 answers
632 views

Parenthesize what I have highlighted

I want to highlight a piece of equation, click a button and have that part taken into parentheses.
user avatar
20 votes
6 answers
3k views

Determine the Number of Lines in a Text File

I have looked and looked but I do not see a simple efficient way to get Mathematica to return the number of lines in a text file? I thought about reading the file until it returned the EOF marker, ...
user avatar
  • 1,011
19 votes
4 answers
942 views

How to call Mathematica from $ \rm\LaTeX $?

The sagetex package for $ \rm\LaTeX $ allows you to embed Sage code into a $ \rm\LaTeX $ document, have that code evaluated during the ...
user avatar
  • 11.4k
19 votes
2 answers
2k views

Lexicographic ordering of strings in Mathematica

I recently realized that Mathematica seems incapable of comparing strings in the "normal" expected lexicographic order. Indeed, for some simulations, I need to process text directly, without fiddling ...
user avatar
  • 433
11 votes
3 answers
16k views

Import selected columns from a tab delimited text file

I have a very huge file (1GB) from which I desire to import only the 5th column. It is a tab delimited text file with a .txt extension. Can you please help me with ...
user avatar
  • 823
7 votes
2 answers
4k views

How to place PlotLabel inside the plot frame

I have the following plot: ...
user avatar
3 votes
1 answer
213 views

How to write graffiti, i.e., text on a polygon surface in Graphics3D?

Is there a relatively easy way to place Text[] on Polygon[] in Graphics3D? For example, I ...
user avatar
5 votes
1 answer
449 views

Export of all notebook files as text files

I want to export all my notebook files located in a root directory as text files. Below is a simple code that I use. Ho can I export "only" the necessary text content of each notebook file? ...
user avatar
  • 11.3k
3 votes
2 answers
2k views

Importing .txt or .csv financial data

I am trying to import some financial data exported from Excel. You can find the relevant file here : Text File or CSV File This is what the data looks like in Excel : Using the following code to ...
user avatar
  • 5,369
9 votes
5 answers
1k views

How to resize the text content of a grid with it?

I am in a resizing mood these days. This code works quite well, up to a point. ...
user avatar
  • 937
9 votes
1 answer
1k views

How can I replace the Greek symbols in an expression with their plain text names?

Suppose I have an expression with Greek symbols in it. How would I convert that expression to another expression where the Greek symbols have been replaces with their names in plain text? I've ...
user avatar
  • 417
8 votes
3 answers
1k views

Working with text in 3D graphics

I'd like to add text to the surfaces of a cuboid. I have tried Text and Epilog, and neither of them worked. Consider the ...
user avatar
  • 731
17 votes
3 answers
535 views

Grabbing a number of characters around a string pattern

If I have some string data: text = StringTake[ExampleData[{"Text", "DeclarationOfIndependence"}], 400] "When in the Course of human events, it becomes ...
user avatar
10 votes
2 answers
243 views

Inline TeX Input renders wrong characters / symbols

Bug introduced in 12.2, fixed in 13.0. As you may know, you can write TeX within a cell with CTR+$ and press ...
user avatar
  • 141
1 vote
1 answer
1k views

How do I include both text and variables in Input[ ]?

I want to prompt a user to input an answer to a question. I want the question that pops up to have both text and numbers or strings. For example, if I ask the user to give a name to something in the ...
user avatar
7 votes
2 answers
486 views

How to Rasterize in "Printout" style

I am trying to ascertain how large a justified text block will be when printed by rasterizing it in the "Printout" style environment. However, ...
user avatar
  • 29.5k
6 votes
2 answers
369 views

MaTeX: how to control horizontal alignment of the resulting object?

When I use MaTeX, I find that the displayed text is always centered with respect to the specified location. Adding TextAlignment -> Left seems to be ignored: <...
user avatar
  • 1,436
1 vote
2 answers
593 views

Select record when third column matches certain criterion

I've a table with 3 columns. The table looks like this: ...
user avatar
1 vote
0 answers
125 views

Words weighting with TF-IDF (updated with cleaned code)

I have a raw dataset under this form : {{label1,sentence1},{label2,sentence2}.....} Sample here: sample available here also I am trying to apply TF-IDF: putting ...
user avatar
16 votes
1 answer
627 views

Automatic edX Pdf Handout creator

I am trying to make an automatic handout creator for my courses on edX. It took me a long time to do it... (If you don't know edX: https://www.edx.org/) I wrote a program that adds to each slide ...
user avatar
  • 2,873
17 votes
3 answers
1k views

Apply an image as a texture to text

I have the following equation eq = Sum[x^2, {x, 0, 10}] and an image ...
user avatar
  • 7,479
15 votes
1 answer
758 views

Accessing figure style (oldstyle or lining) of TrueType fonts

Most professional fonts come with at least two figure styles: old style (or text) figures and lining figures. In plots and most other figures I prefer to use lining figures. This is no problem with ...
user avatar
  • 3,994
8 votes
2 answers
2k views

How can I convert a formatted text cell to latex code?

I have a formatted text cell, I want to export it as latex. How can I do that? Since copy as LaTeX doesn't work, I thought of pasting it into a string and exporting, but it's a no go: ...
user avatar
  • 30.6k
13 votes
3 answers
577 views

Word Squares and Beyond

A word square is a set of words which, when placed in a grid, read the same horizontally and vertically. For example, the following is an English word square of order 5: ...
user avatar
9 votes
3 answers
18k views

Label points in plot with a text

I'm a newbie at Mathematica and I couldn't find how to label the maximum and the zero of a simple function in Plot with their names: ...
user avatar
6 votes
1 answer
772 views

Compare two texts and find differences and similarities

I would like to compare two texts and try to find their degree of similarity and highlight the differences. I would like to do this, not only in terms of words, but also sentences/context, if it could ...
user avatar
29 votes
1 answer
389 views

How to speed up TextJustification in Mathematica 10

Based on this question: - Version 7 print environment - I set up two 10 page test documents in version 7.0.1 and version 10.1. The version 7 document exported to PDF in 4.18 seconds whereas the ...
user avatar
  • 29.5k
9 votes
2 answers
1k views

Convert quoted printable aka PrintableASCII characters to UTF-8

I have several .eml email files to import. Some of them were saved as quoted-printable 7-bit encoded. I skipped through the Mathematica documentation and found ...
user avatar
  • 323