Hot answers tagged

65

Here is a start. I'm sure others will come up with better solutions, but I think from here it's mostly down to finding a better algorithm to pick the random lines. First, we get ourselves a Region representation of the text we want to stylise (thanks to yode for simplifying this part): textRegion = DiscretizeGraphics[ Text[Style["MUSEUM", FontFamily ->...


43

Weighted sampling of line segments based on overlap/non-overlap ratio: Module[{reg}, reg = BoundaryDiscretizeGraphics[ Text[Style["MUSEUM", FontFamily -> "Arial"]], _Text, MaxCellMeasure -> 0.1]; Graphics@Line@ RandomSample[(With[{iarea = Quiet@Area@ BoundaryDiscretizeRegion@ ...


42

This problem is probably due to the MathematicaMono font which is introduced in v10. Defining the problem: Some fonts ("[","_","]","=", etc.) are rendered badly with strange thinning in v10 in some notebook magnifications. This is obvious when you compare the renderings from v10 with those from v9. Analyzing the problem: I found that all of these ugly-...


38

Here is another way of making this kind of graphics using version 6 commands. I am not sure how valuable is this different way of making them compared to the other answers of Martin Buettner and kirma, but I do think some of the results look interesting. I was mainly motivated to explore the 3D versions of writing words with straight lines. Code Here is ...


33

Another way that produces a more uniform distribution of lines is to take the DistanceTransform of the text. I start with the text itself: image = Rasterize@Graphics[ Text[ Style["MUSEUM", 64, Bold, FontFamily -> "Arial"] ], ImageSize -> {360, 200}] And the use the distance transform: ImageAdjust@DistanceTransform@ColorNegate@image as ...


21

You can match formatting between Mathematica figures and LaTeX using a small package I just wrote for using LaTeX-snippets in Mathematica: MaTeX. Here's an example: <<MaTeX` Plot[Sin[z], {z, -2 Pi, 2 Pi}, Frame -> True, FrameStyle -> BlackFrame, FrameLabel -> (MaTeX[#, Magnification -> 20/12] &) /@ {"z", "a(z) = \\sin z"}, ...


20

There is an option for Column or Grid to avoid this: AllowScriptLevelChange cell = Framed[Style[(2*x^(3/2))/3, FontSize -> 14], FrameMargins -> 10, FrameStyle -> {AbsoluteThickness[1], LightGray}, RoundingRadius -> 3]; {cell, Column[{cell}, AllowScriptLevelChange -> False]} UPDATE Honestly, I don't know why Panel doesn't respect ...


19

Font family, size, etc. depends on "Graphics" style in the notebook stylesheet CurrentValue[{StyleDefinitions, "Graphics", "FontSize"}] (* 10 *) CurrentValue[{StyleDefinitions, "Graphics", "FontFamily"}] (* "Times" *) You can manually change it: open Format->Edit Stylesheet..., add Cell[StyleData["Graphics"],FontSize->20] and press Ctrl+Shift+E. ...


19

No need to modify a stylesheet, it is sufficient to evaluate SetOptions[$FrontEnd, StyleHints -> {"CodeFont" -> "Courier"}] or equivalently CurrentValue[$FrontEnd, {StyleHints, "CodeFont"}] = "Courier"; for permanently setting the default font to "Courier New" system-wide in Mathematica 11. Note that the undocumented StyleHints option is new in ...


16

Fonts in version 10.3.1 v1031 = {"Al Bayan", "Al Nile", "Al Tarikh", "American Typewriter", "Andale Mono", "Apple Braille", "Apple Chancery", "Apple Color Emoji", "AppleGothic", "AppleMyungjo", "Apple SD Gothic Neo", "Apple Symbols", "Arial", "Arial Black", "Arial Hebrew", "Arial Hebrew Scholar", "Arial Narrow", "Arial Rounded MT Bold", "...


15

You can use my brace function. p2c[p_]:=p[[1]]+I p[[2]]; c2p[p_]:={Re[p],Im[p]}; brace[pa_,pb_,a_:1/10,t_:1/3]:=Module[{θ,ρ}, θ=Arg[p2c[pb-pa]]; ρ=Norm[p2c[pb-pa]]; {Circle[pa+a ρ{Cos[θ],Sin[θ]},a ρ,{π+θ+t π/2,(3π)/2+θ}], Line[{pa+a ρ{Cos[θ],Sin[θ]}+a ρ{Sin[θ],-Cos[θ]},(pa+pb)/2-a ρ{Cos[θ],Sin[θ]}+a ρ{Sin[θ],-Cos[θ]}}], Circle[(pa+pb)/2-a ρ{Cos[θ],Sin[θ]...


15

Straight from the proverbial horse's mouth: Default font changed to Source Code Pro on Mac, Consolas on Windows, and Bitstream Vera Sans Mono on Linux.


13

Personally I installed the Latin Modern font for this, which is an OpenType-packaged version of the same font face. When we set the font in Mathematica using the FontFamily option, we need to use the font name that the operating system uses, not the filename of the font. You can find this by looking at a font chooser dialog in any application. Example: ...


11

Mathematica will only let you use fonts installed on the system. I have two suggestions here: At the top of your CDF file, display a link depending on the operating system, pointing to the correct file for downloading the font link = If[$OperatingSystem == "Linux" || $OperatingSystem == "Windows", Hyperlink["Download font for " <> $...


11

The Program style is purpose-built for this sort of thing: If you do not like the look of the bars above and below the cell, you can remove them by selecting the cell and changing the CellFrame option in the Option Inspector:


11

CurrentValue["ControlsFontFamily"] (* "Segoe UI" on Version 9 / Windows 8 *) (* "Lucida Grande" on OS X 10.6.8 -- thanks: m_goldberg *) (* "Bitstream Vera Sans" on Fedora 20 -- thanks Oska *) CurrentValue["ControlsFontSize"] (* 12 on Version 9 / Windows 8 *) Style[StringJoin[CharacterRange["a", "z"]], FontFamily :> CurrentValue["ControlsFontFamily"], ...


11

The circle is not cropped when used in a Subscript: Subscript["M", "⊙"] Thus, by using this answer you can easily do: str = "This is some text with a CircleDot: " <> ToString[Subscript["M", "⊙"], FormatType -> StandardForm] If you want some Style: Style[str, Red, 20]


11

The issue is that for reasons that are mysterious, Mathematica has been using an incorrect value of the ScreenResolution parameters on Windows machines since time untold. I believe this has some historical reasons, related to developers using Apple machines at some time, for which somehow the 72dpi is appropriate (noting in parentheses that this "screen ...


11

Following the lead from J.M., and then some comments therein from User18 and QuantumDot, the following is working: In the common StyleSheet, under Notebook options, I added the option: StyleHints->{"CodeFont" -> "Courier"} So, for example, the options now read: Cell[StyleData["Notebook"], Saveable->False, ShowAutoSpellCheck->False, ...


11

This is all covered in the built-in documentation. Search for MaTeX in Mathematica's documentation centre, or type in the following address: MaTeX/guide/MaTeX. But I will give some examples here anyway: How to set a given font is really a LaTeX question. You will find many fonts samples with instructions on how to use them at The LaTeX Font Catalogue. ...


11

You can control the fonts that are used through a stylesheet. First, note the style definition used by the DefaultBaseStyle GraphicsBox option: Options[GraphicsBox, DefaultBaseStyle] {DefaultBaseStyle -> "Graphics"} This means that the following options are used unless overridden: CurrentValue[{StyleDefinitions, "Graphics"}] {CellMargins -> {{4, ...


11

Another approach is to set AllowScriptLevelChange -> False via GridBoxOptions: {cell, Style[ Panel[Column[{cell}], "Hello", DefaultBaseStyle -> None], GridBoxOptions -> {AllowScriptLevelChange -> False}]} For curiosity, here is a low-level workaround based on AllowScriptLevelChange -> False: {cell, RawBoxes@Replace[ToBoxes[ ...


11

Style has a PrivateFontOptions option with suboption OperatorSubstitution. With the default setting "OperatorSubstitution" -> True, special characters such as {, (, or [ are replaced by the equivalent characters in a special Wolfram System font. With the setting "OperatorSubstitution" -> False, such characters are not replaced. For ...


10

Plot[Sin[x], {x, 0, 10}, TicksStyle -> Large] For something not quite so big, use: Larger, or choose your own font size with: Plot[Sin[x], {x, 0, 10}, TicksStyle -> Directive[FontSize -> 16]] Edit: Further to @YvesKlett helpful comment, one can even choose different styles for the x and y axes: Plot[Sin[x], {x, 0, 10}, TicksStyle -> {{...


10

I can no longer get this working. The commands shown below don't give me an output with the correct typeface with Greek letters. I don't know why. tl;dr Use the Latin Modern Math OpenType fonts downloadable from here and make all Greek italic. According to my research this is not a Mathematica-specific issue. The Computer Modern fonts do not have a ...


10

These issues are unfortunately OS- and font family-dependent, so I will preface that I am working on Windows 7 - 64 bit using MMA 10.2. I currently don't have the Aller font installed on my machine, so I won't yet be able to comment on that one, but I do have Minion Pro. As you mentioned Minion Pro uses lining figure by default. The version installed on ...


10

On my Windows 7 system, CurrentValue[{StyleHints, "CodeFont"}] gives Consolas. A perhaps more intuitive way to find it is to simply highlight a piece of text/output/input/etc. the font of which you're interested in, then go to Format->Font..., and you'll see the font highlighted. Having said that, I am a bit surprised, too, that they use the somewhat dated ...


9

In version 10, we can bypass exporting to PDF and re-importing and can outline text directly using region discretization functions. This is shown in the documentation of BoundaryDiscretizeGraphics. reg = BoundaryDiscretizeGraphics[Text[Style["R", FontFamily -> "Cambria"]], _Text] The region can then be converted back to graphics, and the FilledCurve ...


8

As of version 10.1 you can use $FontFamilies. From the documentation: $FontFamilies gives the list of the font families available to the Wolfram System. For me $FontFamilies yields an accurate representations on the fonts I have installed on my system (v10.3.1 on Win10).


8

The FontSize refers to printers points, which by convention are 1/72 of an inch. So the red 'Hig' is fixed to an external font size and will not scale with the graphic. However, you are right to say that this font size doesn't seem to be strictly 72 points... If you try: Export["hig.pdf", Style["Hig", FontFamily -> "Times New Roman", FontSize -> 72]] ...


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