Italics in a string

11 次查看(过去 30 天)
Isaac Gruver
Isaac Gruver 2019-5-1
Hello,
I am attempting to create a GUI that will generate a citation for a source given the author, title, date of publication, etc. The title of a source is almost always italicized, and I can't figure out how to make part of a string appear in italics. I can change the settings for the textbox where the title is entered to italics, but not in the given citation itself.
Any help would be great.
  3 个评论
Isaac Gruver
Isaac Gruver 2019-5-1
Citation Generator.pngMy intention is to have the user choose whether they want to create a single citation, or a bibliography. If they choose the single citation, it will come up in the citation edit field. If they choose a bibliography, then it will save to a file
Rik
Rik 2019-5-1
As far as I'm aware it is not possible to have a tex interpreter for uicontrol elements.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2019-5-1
Rik is mostly right: uicontrol('style', 'edit') and uicontrol('style', 'text') can only have character style (or color) affected for the entire control at one time, if you stick with supported methods.
uicontrol('style','edit') and uicontrol('style','text') have underlying java objects whose java handle can be found and manipulated.
There are some uicontrols such as style 'radio' for which the String property can start with '<html>' to have the rest of the string interpreted as HTML 1.1, such as '<html>Vinge, Verner, <i>A Fire on the Deep</i>'
text() elements can have Interpreter 'tex' or 'latex' properties, but text() elements must be within an axes. (annotation('text') creates a hidden axes to draw into.)
If you are creating a citation into a uicontrol style 'text' or 'edit', I wonder if the point is to create something that could be copied and pasted into a paper. If it is, then you would want to create something copyable that when pasted would cause the user's editor to create the appropriate result. That might be rather different content then the presentation layer. Potentially it might involve pushing something into the clipboard. You would probably want the opposite of clipboard('pastespecial')

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by