New answers tagged

1

I suggest using the AspectRation option to tighten up the graphics viewport. It turns out that setting that option to any value lower than a certain one, which depends on the characteristics of the given text, will work. So it is easy to find one by trial-and-error. Graphics[Text[Style["(a) My Long Long Text", 28]], AspectRatio -> .09] However, ...


2

Use Show @* Rasterize instead of Graphics: Show @ Rasterize @ text Head @ % Graphics Alternatively, use the option PlotRange to specify the vertical range: text = Text[Style["(a) My Long Long Text", 28, FontFamily -> "Arial"]] Graphics[text, PlotRange -> {-.1, .1}] PlotRange -> {All, {-.1, .1}} gives the same result.


8

As noted in the OP, "PenaltyFunction" has the form pf[..., step] where the first argument is constructed from the constraint. When minimizing an objective function of the form obj[x,..], the actual penalty function is a scaled sum of penalties constructed from pf[] and the constraints: Max[1, Abs[obj[x,..]]] * ( (* the objective function ...


3

Clear["Global`*"] xticks = Join[{#, "", {0.01`, 0.`}, {GrayLevel[0.], AbsoluteThickness[0.6`]}} & /@ Range[0, 2, 0.1], {#, #, {0.02`, 0.`}, {GrayLevel[0.], AbsoluteThickness[1]}} & /@ Range[0, 2, 0.5]]; nlp = NumberLinePlot[{0, 2}, PlotStyle -> Directive[Thick, PointSize[0.00016]], AxesStyle -> ...


7

Ticks -> Details NumberLinePlot[{0, 2}, PlotStyle -> Directive[Thick, PointSize[0.00016]], AxesStyle -> Thickness[0.004], TicksStyle -> {Thickness[0.004]}, LabelStyle -> {20, Bold}, ImageSize -> Full, Ticks -> {Table[{i, i, .02}, {i, 0, 2, 0.1}], None}] Use Ticks -> {Table[{i, i, {.02, 0}}, {i, 0, 2, 0.1}], None} to get Use ...


0

See this question. LevelScheme does that.


0

Consider this alternative that more easily enforces type on n using two alternative definitions, the first one with the integer type, the second "default" one when n is not an integer, essentially similar to an error handler. You could also omit the second one and r`f would simply not evaluate when there is a type mismatch. ClearAll[r`f, n]; r`f[...


Top 50 recent answers are included