plotting – How to properly write multiline text with LaTeX symbol in a frame and with background

I wanted to include a number of text-box with background color white inside a plot. The text inside the box will also have LaTex expressions as well as multiple lines.

Is there any way to include multiline text (including LaTeX symbol) inside a plot?

In addition I want to set frame and background color for the box.
I am currently using Epilog and Prolog to include such text.

  ListLinePlot(
  Table({k, 
  PDF(BinomialDistribution(50, p), k)}, {p, {0.3, 0.5, 0.8}}, {k, 0,50}), 
  Filling -> Axis, 
  FillingStyle -> Automatic,
  (**Option-1**)
  Epilog -> Text(Style(ToExpression("\text{E}_{x} \n text2", TeXForm, HoldForm),Bold),{30, 0.13}),
  (**Option-2**)
  Prolog -> {Inset(Framed( "E_{x}ntext2" , RoundingRadius -> 5,Background -> White), {45, 0.13})}
  (**Option-3**)
(*Prolog -> {Inset(Framed( MaTeX("E_{x}\n text2" ) , RoundingRadius -> 5,Background ->White),{45,0.13})}*)
   )

Option-1 fails writing E_{x} as well as breaking line.
Option-2 fails writing E_{x} but breaks line.
Option-3 is the one I wanted but it fails in breaking line.

Is there any way to achieve this.

Moreover I also wanted to ask, what should one do if one has to include say more that two text boxes?

What is the meaning of the small blinking camera symbol in my Canon 70D viewfinder?

This is the electronic level indicator. It indicates that you’re not holding the camera parallel to the ground but instead have tilted it. The specific configuration indicates that you’ve got a tilt of greater than 2°.

From page 66 of the manual:

enter image description here

Note that this is configurable — you can turn it off if you don’t like it. It’s also available on the rear LCD during Live View shooting (where it’s maybe a little more obvious as a level).

Also note the manual’s warning of a 1° margin of error (or even greater when the camera is far from level).

Symbol occurs in more than one context – only once defined

I don’t understand why I am getting an error for "K" but not let’s say "A" – and the slider is labeled with "Global`K"

ClearAll(Y, A, K, L, a)
Y(A_, K_, L_, a_) := A*K^a*L^(1 - a);

Manipulate(Plot(Y(A, K, L, a), {L, 0, 100},PlotRange -> {25, 3000}), {{A, 5}, 1, 10}, {{K, 225}, 200, 350}, {{a, 1/3}, 10^-2, 1})

Thanks!

What does this symbol mean in hangout

What does a star symbol mean next to someones name in hangouts mean. The star symbol suddenly appeared next to that persons name. If I click it brings up the profile pic. I sent a message and it was delivered but not sure if I could have been blocked.

r – How to convert a list of paragraphs in a dataframe based on symbol?

I have a a vector of text containing multiple paragraphs separated by four stars :

 text <-("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus metus sapien
 ****
 maximus id commodo vitae, imperdiet sed ante. Nunc tristique velit quis est ultrices, faucibus. 
 ****
 Curabitur sit amet orci nulla. Mauris sed interdum diam, et suscipit nisi.
 ****
 Integer eu arcu eu tortor molestie mollis ut vitae erat. Integer justo tortor
 ****
 facilisis non condimentum in, tincidunt nec erat. Mauris vel dictum elit.")

I Want to convert my vector into a dataframe based on the four stars separators :

 |column                                                                                         |
 |-----------------------------------------------------------------------------------------------|
 |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus metus sapien                  |
 |-----------------------------------------------------------------------------------------------| 
 |maximus id commodo vitae, imperdiet sed ante. Nunc tristique velit quis est ultrices, faucibus.|
 |-----------------------------------------------------------------------------------------------| 
 |Curabitur sit amet orci nulla. Mauris sed interdum diam, et suscipit nisi.                     |
 |-----------------------------------------------------------------------------------------------| 
 |Integer eu arcu eu tortor molestie mollis ut vitae erat. Integer justo tortor                  |
 |-----------------------------------------------------------------------------------------------| 
 |facilisis non condimentum in, tincidunt nec erat. Mauris vel dictum elit.                      | 
 |-----------------------------------------------------------------------------------------------|    |

Font style inconsistency on “number sign” (hashtag) and “at symbol”

Why number sign "#" (known as hashtag symbol on social media) or at sign "@" are not consistent with the style of other letters of alphabet?

On the other hand "&" or "$" match the style of other letters.

Using default font:

Style(Partition({"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", 
    "K", "L", "M", "N", "#", "@", "O", "P", "Q", "R", "$", "&", "S", 
    "T", "U", "V", "W", "X", "Y", "Z"}, 6) // Grid, 50)

enter image description here

Using specific font family:

Style(Partition({"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", 
    "K", "L", "M", "N", "#", "@", "O", "P", "Q", "R", "$", "&", "S", 
    "T", "U", "V", "W", "X", "Y", "Z"}, 6) // Grid, 
 FontFamily -> "Lucida Console", 50)

enter image description here

Specifically I need mono-spaced font, like for example “Lucida Console” is, but the result is simply ugly.

Do you have recommendation for a nice mono-spaced font that correctly displays both "#"and "@"?

Update:

I found out Mathematica itself uses weird font for "@#": (see the distorted edges of "@", "#" has no distorted edges probably just because it is composed only of horizontal and vertical lines)

Rasterize("A # @ $ &" , ImageSize -> 600, RasterSize -> 1000)

enter image description here

algorithm – JavaScript Symbol Table implementation using Binary Search

I’m currently going over Robert Sedgewick’s Algorithms book. I implemented a Symbol Table using two parallel arrays one for keys and one for values. The keys array is ordered and the Symbol Table uses binary search to find the position of the elements in the array.

In the practice section, the implementation of the delete and floor method were left as exercises. Here are the directions for delete and floor:

enter image description here
enter image description here

I would like to see if there is any feedback in the implementation of those elements. Specially floor.

I come from Ruby, so any feedback regarding best practices in JavaScript is also welcome.

Here is the code:

class BinarySearchSt {
  constructor() {
    this.n = 0;
    this.keys = ();
    this.vals = ();
  }

  isEmpty() {
    return this.n === 0;
  }

  get(key) {
    if(this.isEmpty() === true) {
      return null;
    }

    let i = this.rank(key);

    if (i < this.n && this.keys(i) === key) {
      return this.vals(i);
    } else {
      return null;
    }
  }

  put(key, val) {
    let i = this.rank(key);
    if(i < this.n && this.keys(i) === key) {
      return this.vals(i) = val;
    }

    for(let j = this.n; j > i; j--) {
      this.keys(j) = this.keys(j - 1);
      this.vals(j) = this.vals(j - 1);
    }
    this.keys(i) = key;
    this.vals(i) = val;
    this.n++;
  }

  rank(key) {
    let lo = 0;
    let hi = this.n - 1;

    while(lo <= hi) {
      let mid = lo + Math.floor((hi - lo) / 2);
      let cmp = this.compareTo(key, this.keys(mid));
      if(cmp < 0) {
        hi = mid - 1;
      } else if(cmp > 0) {
        lo = mid + 1;
      } else {
        return mid;
      }
    }
    return lo;
  }

  compareTo(val1, val2) {
    if((val1 === null || val2 === null) || (typeof val1 !== typeof val2)) {
      return null;
    }
    if (typeof val1 === 'string') {
      return (val1).localeCompare(val2);
    } else {
      if(val1 > val2){
        return 1;
      } else if (val1 < val2) {
        return -1;
      }
      return 0;
    }
  }

  min() {
    return this.keys(0);
  }

  max() {
    return this.keys(-1)
  }

  select(index) {
    return this.keys(index);
  }

  ceiling(key) {
    let i = this.rank(key);
    return this.keys(i);
  }

  floor(key) {
    if(this.n === 0) {
      throw 'noSuchElementException';
    }
    if(key === null) {
      throw 'ilegalArgumentException';
    }
    let i = this.rank(key);
    if(this.keys(i) === key || i === 0){
      return this.keys(i);
    }
    else {
      return this.keys(i - 1);
    }
  }

  delete(key) {
    if(key === null) { throw 'ilegalArgumentException' };
    let i = this.rank(key);
    this.keys.splice(i, 1);
    this.vals.splice(i, 1);
  }
}

const bst = new BinarySearchSt();

bst.put('s', 0)
bst.put('e', 1)
bst.put('a', 2)
bst.put('r', 3)
bst.put('c', 4)
bst.put('h', 5)
bst.put('e', 6)
bst.put('x', 7)
bst.put('a', 8)
bst.put('m', 9)
bst.put('p', 10)
bst.put('l', 11)
bst.put('e', 12)

console.log(bst.get('e'))

syntax – Is there a common agreed upon token symbol used in computer science or common across languages?

I have seen tokens like this:

 var message = "Hello, {Name}";

and like this:

 var message = "Hello, ${name}";

and like this:

 var message = "Hello, @NAME";

and a few other styles over the years.

Is there a common or preferred token format, style or character used in creating a set of tokens?

I have tried to used constants, like so,

“The width is WIDTH”

but I ran into problems when I had a token phrase that was contained in another token phrase.

For example, I had WIDTH and PERCENT_WIDTH as tokens. If the string contained both tokens one token could be replaced by the other in the first run through.

So if the token replacement value was 50 and the string was:

“The width of the item is WIDTH. That is PERCENT_WIDTH of the total.”

then I ended up with,

“The width of the item is 50. That is PERCENT_50 of the total.”

It wouldn’t find “PERCENT_WIDTH” because that token string was modified.

So if I replaced the “PERCENT_WIDTH” token first that would solve that problem but as I added more tokens that would increase the chances for errors. So now I’m trying to figure out a recommended token format.

I’m using regex to find and replace matches.

There appears to be no “tokens” topic tag.

Why do I have an alarm symbol on my notification bar when I don’t have an alarm set

I recently started seeing the alarm icon on my notification bar even though I don’t have an alarm set.

Why is this happening? What can I do to find what’s making this show? I don’t want to disable the icon since I want it show when I do have an alarm set.

This image shows the icon I'm referring to

numbers – What’s the best symbol to use to mask unknown digits?

I’m working with groups of product identifiers and need to be able to represent when the last couple numbers of the identifier are unspecified.

For example, a product might have the following product IDs:

1000-1234-01
1000-1234-05
1000-1234-10
1000-1234-50

I would like to represent this group with just the first eight digits, and use a masking character to indicate that the IDs are actually 10-digits long but the user doesn’t need to worry about the last two digits, for example using X characters:

1000-1234-XX

But I’m concerned if the X character is universally recognized as a “placeholder” character. They might confused the X as part of the ID. (My users are in the US, but I can’t assume their cultural background).

Other options I can think of:

  • Elipsis: 1000-1234-…
  • Underscore: 1000-1234-__
  • Times: 1000-1234-××
  • Whitespace: 1000-1234-
  • Question marks: 1000-1234-??
  • Asterisks: 1000-1234-**

The masking character is less ambiguous when users will recognize the format of the number, e.g., for credit card numbers XXXX-XXXX-XXXX-4000 or phone numbers (555) 123-XXXX, but is more critical when you want to avoid ambiguity about the purpose of masking character.

What is the best character to use in this case?