473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simulating LaTeX's \emph{} tag ("inverted italics") with CSS?

Hi,

I'm an Austrian writer living in Montpezat (South France), and I'm currently
busy converting some of my writings from LaTeX to HTML to publish them on
the Internet.

The novel I'm working on has two different first-person narrators, formally
distinguished by the use of italics. One of them (Violetta) only appears in
italics, the other one (Victor) in normal fonts. This is a formal help for
the reader to distinguish the two narrative voices, which can get easily
mixed up.

In the LaTeX version of the novel, I use the \emph{} tag whenever I want to
emphasize a word. The result is the following:

1) Victor uses a "normal" font style, so the \emph{} tag produces an oblique
or italic font style.

2) On the other hand, Violettas chapters are all printed in italic (or
oblique) style. Here, the \emph{} tag prints an upright text (normal font
style) to distinguish it from the rest in italics.
Now I'd like to simulate that with cascading style sheets and different
classes, because I hate the idea of having to hand-code "inverted italics"
everywhere, like this:

<i>Here is a text in italics with an</i> emphasized <i>word in it.</i>

See what I mean?

What I'd like to do is define a sort of separate italics behaviour in two
different classes. Here's the general idea in my style sheet:

..victor {
font-family: serif;
font-size: 120%;
text-align: justify;
font-style: normal;
}

..violetta {
font-family: serif;
font-size: 120%;
text-align: justify;
font-style: italic;
}

i.violetta {
font-style: normal
}

And I figured this would work like this:

<span class="victor">
<p>Here's some thoughts of Victor with some <i>emphasis</i> in it.</p>

<p>Here's some more thoughts of Victor with some <i>emphasis</i> in it.</p>
</span>

<span class="violetta">
<p>Here's some thoughts of Violetta with some <i>emphasis</i> in it.</p>

<p>Here's some more thoughts of Viletta with some <i>emphasis</i> in it.</p>
</span>

The result *should* be as described above, only it isn't. I admit I'm not
very familiar with CSS. I'm sure there's some syntax quirk I didn't catch.
I've worked through a good half dozen of tutorials, but now I'm clueless.


Any suggestions?

Niki Kovacs



--
Whereof one cannot speak, thereof one frequently goes ranting on and on at
ball-breaking length. (Ludwig Wittgenstein, Tractatus Logico-Philosophicus,
first draft)
Jul 20 '05 #1
3 5130
On Tue, 24 Aug 2004 13:07:43 +0200, Kiki Novak <mi****@mouse.com> wrote:
Hi,

I'm an Austrian writer living in Montpezat (South France), and I'm
currently busy converting some of my writings from LaTeX to HTML to
publish them on
the Internet.

The novel I'm working on has two different first-person narrators,
formally distinguished by the use of italics. One of them (Violetta)
only appears in italics, the other one (Victor) in normal fonts. This is
a formal help for the reader to distinguish the two narrative voices,
which can get easily mixed up.

In the LaTeX version of the novel, I use the \emph{} tag whenever I want
to emphasize a word. The result is the following:

1) Victor uses a "normal" font style, so the \emph{} tag produces an
oblique or italic font style.

2) On the other hand, Violettas chapters are all printed in italic (or
oblique) style. Here, the \emph{} tag prints an upright text (normal
font style) to distinguish it from the rest in italics.
And I figured this would work like this:

<span class="victor">
You really should use DIV instead of SPAN here. Or you could add the class
directly to the paragraphs.
<p>Here's some thoughts of Victor with some <i>emphasis</i> in it.</p>

<p>Here's some more thoughts of Victor with some <i>emphasis</i> in
it.</p>
</span>

<span class="violetta">
<p>Here's some thoughts of Violetta with some <i>emphasis</i> in it.</p>

<p>Here's some more thoughts of Viletta with some <i>emphasis</i> in
it.</p>
</span>

You got the order of the elements in the selector wrong.

..victor i {
font-style: italic;
}

..violetta i {
font-style: normal
}
Here's an easy introduction to CSS syntax:
http://www.htmlhelp.org/reference/css/structure.html
--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 20 '05 #2
Rijk van Geijtenbeek wrote:


You really should use DIV instead of SPAN here. Or you could add the class
directly to the paragraphs.

Thanks a lot! This worked OK!

You got the order of the elements in the selector wrong.

.victor i {
font-style: italic;
}

.violetta i {
font-style: normal
}


Rijk, you made my day! I've been banging my head against this for the best
part of the morning.

Cheers,

Niki
--
Whereof one cannot speak, thereof one frequently goes ranting on and on at
ball-breaking length. (Ludwig Wittgenstein, Tractatus Logico-Philosophicus,
first draft)
Jul 20 '05 #3
Kiki Novak wrote:
In the LaTeX version of the novel, I use the \emph{} tag whenever I want to
emphasize a word. The result is the following: [...] <span class="victor">
<p>Here's some thoughts of Victor with some <i>emphasis</i> in it.</p>


In HTML you should use the em element for emphasis.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
3546
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else:...
1
2064
by: Tom | last post by:
I need a very, very minimal LaTeX system on Windows. I only need to have the possibility to get DVI files out of my tex files (with minimal fonts). An I need it without any installer (no settings...
8
3379
by: fortuneteller | last post by:
Hello, I'm quite new to python and Scipy. Anyway I want to use it to plot graphs. Does anybody know if there is the possibility to use Latex in SciPy's plotting functions like gplt? Thanks...
388
21396
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
0
1656
by: giovanni gherdovich | last post by:
Hello, first of all: Is this the right place to ask plastek-related questions? I'm trying to make plastex work on my Ubuntu Dapper Drake. For LaTeX, I have the all-in-one package tetex.
1
1765
by: adina | last post by:
Hello there, I need some help with LaTex and processing images in LaTex. I realise that this is a C/C++ forum, but I was thinking that perhaps there are a some people who are interested in LaTex,...
5
2025
by: vasan999 | last post by:
Basically, it should do all that any of the tools below and in addition, 1/ human readable output that maintains the text lines of the source, ie does not scramble the text lines or insert...
11
4725
by: S N | last post by:
how to print apostrophe character ' and double quote " in asp using vbscript. my code using response.write replaces " character with inverted question mark. please help
2
12180
by: r_ahimsa_m | last post by:
Hello, I am learning CSS and other WWW technologies. In the folowing definition italic doesn't work: h2 { color: Brown; text-decoration: italic; }
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.