# Show text in italics

**URL:** <https://www.ruby-forum.com/t/show-text-in-italics/143435>\
**Category:** Ruby\
**Created:** [July 18, 2008, 2:48pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435 "2008-07-18T14:48:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 2:48pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/1 "2008-07-18T14:48:09Z")

</div>

Hi ,

well, is there any logic to display a text in italics in ruby.

like a simple program that shows text in italics?

ex: def text  
puts" hi to all"  
end  
puts text

so i need to display "hi to all " in italics.

i know there is not. but want to try, and please reply if u know …  
thanks.

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 3:11pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/2 "2008-07-18T15:11:55Z")

</div>

2008/7/18 Vamsi K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> so i need to display "hi to all " in italics.

See this wikipedia article: [ANSI escape code - Wikipedia](http://en.wikipedia.org/wiki/ANSI_color)

In theory you could do

puts “\e[3mhi to all\e[0m”

But apparently italics is not widely supported. Bold and underline seem  
to  
work in my Ubuntu terminal (\e[1m and \e[4m respectively).

James

> **[jcoglan - Overview](https://github.com/jcoglan)**
>
> jcoglan has 145 repositories available. Follow their code on GitHub.

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 3:20pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/3 "2008-07-18T15:20:07Z")

</div>

- Vamsi K., 2008-07-18, 21:43:

> ex: def text  
> puts" hi to all"  
> end  
> puts text
> 
> so i need to display "hi to all " in italics.

Italics are not available, other kinds of highlighting are (bold,  
underlined, colour, etc.). Read

man console\_codes

for details. ECMA-48 ones usually work on Windows as well. If you do  
not have the man page simply use an online version of it;

> **[Google Search](https://www.google.com/search?q=console_codes)**

finds many of them.

Josef ‘Jupp’ Schugt

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/4 "2008-07-18T16:37:38Z")

</div>

Paul S. wrote:

> Where are you displaying the text? At the console? In a window? Using  
> shoes?
> 
> On Fri, Jul 18, 2008 at 1:43 PM, Vamsi K.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > so i need to display "hi to all " in italics.
> > 
> > ## i know there is not. but want to try, and please reply if u know … thanks.
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> –  
> Paul S.  
> DCI Level 2 Judge, Bath FNM Organiser
> 
> Upcoming events in Bath -  
> July 26th Eventide Launch Party
> 
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

In the coonsole as well in an rhtml.

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/5 "2008-07-18T18:35:47Z")

</div>

For console impossible, but in rhtml just surround the text with either  
 or tags, since rhtml is converted to html any tags  
around  
the word will be shown.

Reuben Doetsch

On Fri, Jul 18, 2008 at 9:32 AM, Vamsi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 4:25pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/6 "2008-07-18T16:25:22Z")

</div>

Where are you displaying the text? At the console? In a window? Using  
shoes?

On Fri, Jul 18, 2008 at 1:43 PM, Vamsi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> so i need to display "hi to all " in italics.
> 
> ## i know there is not. but want to try, and please reply if u know … thanks.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

–  
Paul S.  
DCI Level 2 Judge, Bath FNM Organiser

Upcoming events in Bath -  
July 26th Eventide Launch Party

[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 21, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/7 "2008-07-21T15:02:17Z")

</div>

Dave B. wrote:

> reuben doetsch wrote:
> 
> > in rhtml just surround the text with  
> > either or tags
> 
> Ahem… if you want italics, use _. If you want emphasis, use ._
> 
>  
> 
> _This may be too subtle a distinction for most folk. “They both look the  
> same in my browser!” 😉_
> 
>  
> 
> _Dave_

 

_Thaks all of u … i’m trying to print at console…_

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 18, 2008, 7:35pm UTC](https://www.ruby-forum.com/t/show-text-in-italics/143435/8 "2008-07-18T19:35:02Z")

</div>

reuben doetsch wrote:

> in rhtml just surround the text with  
> either or tags

Ahem… if you want italics, use _. If you want emphasis, use ._

 

_This may be too subtle a distinction for most folk. “They both look the  
same in my browser!” 😉_

 

_Dave_
