16

I want to put an apostrophe in a string to denote the possessive but it ends the string, how can I put one in.

3 Answers3

29
yourString = 'This is the answer to Tessa''s question.';

(I.e., you would use an double apostrophe.)

H.Muster
  • 9,187
  • 1
  • 31
  • 45
  • 1
    Specifying a string of a single apostrophe is even more confusing: `str = '''';` – Doresoom Feb 20 '13 at 18:10
  • 2
    @Sumit: You noticed that this question is about Matlab? On Matlab 2012a (and any previous version I used) your example `'Tessa\'s'` is not considered valid syntax and causes an error. – H.Muster Oct 09 '13 at 11:16
  • Since R2017a you can also use a double quote in order to declare a string, the principe is similar `str = "my double quote is "" – obchardon Apr 03 '18 at 09:56
8

add one more ' after ' apostrophe after apostrophe

Abhishek Thakur
  • 13,185
  • 13
  • 57
  • 92
0

\Usepackage[{amsfont} \vtick to put an apostrophe before or after s in a word. For example, teacher's will be entered as teacher\vtick s. Ok?

  • 1
    Welcome to StackOverflow! I recommend against rhetoric questions in answers. They risk being misunderstood as not an answer at all. You are trying to answer the question at the top of this page, aren't you? Otherwise please delete this post. – Yunnosch Apr 29 '21 at 05:53
  • The question is about MATLAB strings (actually char array), not about LaTeX. MATLAB accepts LaTeX formatting in certain graphic elements, but not generally. – Cris Luengo Apr 29 '21 at 06:01