Tag Info

32

Have a look at FileNames: files=FileNames["*.pdf", NotebookDirectory[]] {"a.pdf","b.pdf","c.pdf"} will get you a list of all files in the directory where your notebook resides (of course you can choose any path) that match "*.pdf". You can then import the files like this: Import[#]&/@files or if you want certain files (look at the help for ...

28

Assuming nb is your notebook object, then this will do what you want without touching the clipboard: First[FrontEndExecute[ FrontEndExportPacket[NotebookSelection[nb], "InputText"]]] Some notes about this solution: It preserves evaluation semantics precisely, regardless of typesetting. It does not dirty the clipboard If you prefer to get the ...

26

Code extractor using the StackExchange API The following code uses the 2.0 version of the SE API and has also been cleaned up a bit (place it in your kernel's init.m or your custom functions package if you'd like to be able to use it anytime). The function takes a single string argument, which is the URL obtained from the "share" link under a ...

26

Import text as a FilledCurve in graphics, using PDF as an intermediate format. Below are modified examples from Documentation Center: text = First[First[ImportString[ExportString[Style["Hi", Italic, FontSize -> 24, FontFamily -> "Times"], "PDF"], "PDF", "TextMode" -> "Outlines"]]]; Outline fonts using different edge and face forms: ...

24

You can use Inset: Show[{Graphics3D[{Opacity[0.2], Sphere[], Opacity[1.0], Blue, Inset[Graphics[Text[Style["Surprise!", Green, 24]]], {0, 0, 0}]}], ParametricPlot3D[{Sin[th] Cos[ph], Sin[th] Sin[ph], Cos[th]}, {th, 0, Pi}, {ph, 0, 2 Pi}, RegionFunction -> Function[{x, y, z}, Abs[x] < .9], PlotRange -> {-1, 1}, PlotStyle -> ...

21

An alternative approach that does not require the ComputationalGeometry package: You can use a combination of ClusteringComponents and ComponentMeasurements as follows: Define chVertices[txtimg_] := Insert[#, First@#, -1] &@ ComponentMeasurements[ClusteringComponents[Binarize@txtimg, 2], "ConvexVertices"][[2, 2]] Example data: textimg1 = ...

20

For this purpose I made a function that puts an arbitrary expression into a 3D graphic. It's described on this page, going back originally to this MathGroup post, I'll copy the code here: label3D[s_, pos_, xVec_, tiltAngle_, opts : OptionsPattern[]] := Module[{ra, width, height, r}, ra = Rasterize[ Style[HoldForm[s], FilterRules[{opts}, ...

20

The following response borrows shamelessly from Mr.Wizard: Manipulate[ Graphics[{{Dashed, If[circle, Circle[{0, 0}, r], {}]}, Rotate[MapThread[ Rotate[Text[Style[#, FontFamily -> "Courier", fs], #2], 90° - #3] &, {txt, {-r Cos[#], r Sin[#]} & /@ (range = Range[0, arc, arc/(Length@txt - 1)]), range}], θ, {0, 0}]}, ...

20

It might be overkill, but with: DictionaryLookup[{"German", All}] you get a list of every German word. To be a bit more precise, you could then narrow things with string searches, i.e. DictionaryLookup[{"German", "a" ~~ ___ ~~ "b"}] gets you a list of words that begin with a and end with b. Full documentation is here.

20

This is just a quick sketching out of an answer (rescales galore!) textOnCurve[text_, f_, n_, p_: 0.01] := Text[Rotate[text, ArcTan @@ (f[Rescale[n + p, {0, 1}, {p, 1 - p}]] - f[Rescale[n - p, {0, 1}, {p, 1 - p}]])], f[n]] textCurve[string_, f_, stylef_: (# &), range_: {0, 1}] := With[{chars = ...

20

Here's a method based on creating a MeshRegion from the text: text = Style[HoldForm @ Sum[x^2, {x, 0, 10}], 100, Bold]; graphics = First[text ~ExportString~ "PDF" ~ImportString~ "PDF"]; region = DiscretizeGraphics[graphics, MaxCellMeasure -> 5]; image = ExampleData[{"ColorTexture", "Kingwood"}]; RegionPlot[region, Frame -> False, ...

19

I have this palette open all the time: CreatePalette@Row@ { Button["(\[SelectionPlaceholder])", FrontEndExecute[ FrontEndToken[SelectedNotebook[], "SelectionParenthesize"]]], Button["[\[SelectionPlaceholder]]", FrontEndExecute[ FrontEndToken[SelectedNotebook[], "SelectionBracket"]]], ...

17

You could use Row to build up the text to be shown: aboveBox[info_, colors_] := Graphics[{colors, EdgeForm[Thick], Rectangle[{0, 0}, {26, 3}], Text[Row[{Style["subject", 12, Bold, Black, TextAlignment -> Center], Style[info, 18, Bold, Red, TextAlignment -> Center]}], {26, 3}/ 2]}, ImageSize -> 300] aboveBox["AK6", ...

17

This places a string on the outside of a unit circle. It works for variable width fonts. circularText[str_, ang : {a0_, a1_} : {0, 2 Pi}, scale:(_?NumericQ): 1] := Module[{text, curves, pts, xrange, ymin, xrlst, subgroups, maxwidth, centers}, (* transform string to FilledCurves *) text = ImportString[ ExportString[Style[str, Bold, FontFamily ...

17

Here's an attempt to implement the idea suggested by Szabolcs, based on Heike's clever image processing method. The code uses MinFilter to identify regions where the label may go without overlapping anything, and Nearest to pick the closest point to the desired position. The rest is just scaling between image and graphics coordinates. It won't be fast ...

17

You want to use an UnderBrace. Highlight the g....g then type Ctrl-4 to get under it, then type Esc u{ Esc, then highlight the underbracket and hit Ctrl-4 again, gives this To get better, you might want to use Szabolcs's MaTeX package, in which case you will get an image of the rendered TeX, <<MaTeX MaTeX@Underscript["g...g", Underscript[︸, ...

16

Here's another way...Text[] has a direction argument, so ArcTan is not necessary. txt1 = "Now we can follow" // Characters; txt2 = "an arbitrary path" // Characters; f[t_] := {Cos[2 π t], Sin[6 π t]}; totalarclength = NIntegrate[Sqrt[f'[τ].f'[τ]], {τ, 0, 1}]; invarclength = First@NDSolve[{D[$t[s], s] == 1/Sqrt[f'[$t[s]].f'[$t[s]]],$t[0] == 0}, $t, {s, 0, ... 15 There are a variety of ways to do this. One can use Stylesheets as noted by acl. Perhaps the most direct way is this: For one Notebook: SetOptions[EvaluationNotebook[], FontSize -> 16] For all Notebooks: SetOptions[$FrontEnd, FontSize -> 16] You can also set FontSize for different Box types, such as GraphicsBox: SetOptions[$FrontEnd, ... 15 The question could be rephrased: how do we get a vector graphic from a bitmap? The solution is pretty simple by using the code we can find here. p = Image[Graphics[Text[Style["Get Convex Hull points.", Large]]]]; img = Thinning@EdgeDetect@p; points = N@Position[ImageData[img], 1]; pts = Union@Flatten[FindCurvePath[points] /. c_Integer :> points[[c]], 1]; ... 15 You can open a text cell using Alt7, and type some text. When you need math, open a subcell using Ctrl9. Single letter variables will be formatted in italics in the subcell, as is usual. Use the usual shortcuts (e.g. Ctrl6 for superscript) to enter math. Use CtrlSpace to get out of the subcell (or the arrow keys). On a Mac, use ⌘ in place of Alt. 15 Here is a starting point: txt = "This is some text to warp." // Characters; arc = 1; range = Range[0, arc, arc/(Length@txt - 1)]; coords = {-Cos[#], Sin[#]} & /@ range; Graphics[ MapThread[ Rotate[Text[Style[#, FontFamily -> "Courier"], #2], 90° - #3] &, {txt, coords, range}] ] 15 Per Vitaliy's request: With[{before = 4, after = 5}, StringTake[text, First[StringPosition[text, "entitle"]] + {-before, after}]] yields "God entitle them". 15 After downloading and unpacking the stanford Part-Of-Speech tagger that @PlatoManiac mentioned it is easy to call it with JLink:$POSTaggerPath = "/some/where/stanford-postagger-2013-11-12/"; << JLink` AddToClassPath[$POSTaggerPath]; tagString[str_String] := JavaBlock[ Module[{tagger}, ... 14 You could do something like this: string = "(Paste Here)" exps = Select[ string ~StringSplit~ "\n\n", SyntaxQ@# && ! MatchQ[MakeExpression@#, _@__Times | _@Null] &]; CellPrint@Cell[#, "Input"] & ~Scan~ exps 14 You can generate actual 3D data describing the text by Importing from PDF. wordData = ImportString[ExportString["Surprise", "PDF"], "PDF"][[1, 1, 2, 1, 1, 2]]; Graphics3D[Tube[#, 0.2] & /@ Map[Append[#, 0] &, wordData, {2}]] Or, in reference to Sjoerd's comment to the OP, wordData = ImportString[ExportString[Style["\[Euro]", FontFamily ... 13 In the answer linked here, I did the following: out = FileNameJoin @ {$TemporaryDirectory, "MathematicaOutput" <> ToString /@ Date[] <> ".rtf"} /tmp/MathematicaOutput2012519111731.900549.rtf Then you would say Export[out, ...]. If you want to have the date in a more readable and less detailed form, you could use this for the name: ...

12

Rather than using a Rectangle, consider a Pane that is Framed text = "Bunch of random text "; Framed@Pane[StringJoin @@ Table[text, {10}], 300] The second argument to Pane determines the width in points. If you want more control over the text within the Pane, consider putting a TextCell inside the Pane. If you just use a TextCell, you can't control ...

12

Overall, your data is just badly formatted. For instance, later in the list your dates look similar to "3-Mar" which is interpreted as the third of March not March 2003, as you intended. For the most part, this is not your fault, but Excel arbitrarily formats data, and you have to be vigilant that it doesn't misinterpret it. Towards that end, I've rewritten ...

12

There is a subtle problem if you use strings as axis labels. Look closely at a plot like this: Plot[f, {x, -1, 1}, AxesLabel -> {x, "\!$$\*SubscriptBox[\(f$$, $$i$$]\)(x)"}] You will see that the argument x in the function appears in a different font style than the argument on the horizontal axis. To make sure that you get a consistent font style on ...

12

Modifying an example from the help on FilledCurve[]: Module[{l = Cases[First[First[ImportString[ExportString[Style["CIRCLE", Bold, FontFamily -> "Courier", FontSize -> 12], "PDF"], "TextMode" -> "Outlines"]]], FilledCurve[a__] :> {EdgeForm[Black], Yellow, FilledCurve[a]}, Infinity]}, Animate[Graphics[{Red, Circle[{0, 0}, ...

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