# How to use \watt in lyx

I am trying to use `\watt` in LyX, but I find that although it is a very simple case, I have spent 1 week to solve it but in vein.

First, I found out that if I want to use watt then I must use the `siunits` package, so I tried to add this in LyX 'Document-Setting-LaTeX Preamble' with `\usepackage{siunits}` but when I typed in `\watt` (according to `siunits` documentation) in LyX, it appears as `\watt` still, without changing into 'W' symbol, and when I see the pdf file, it is also 'watt'

Second, I find that, maybe my TexLive does not have the `siunits` package, so I tried to install this package in TexLive on Ubuntu 14.04， but I find that it is another complicated issue, as I didn't directly install TexLive in my system, instead, I install it by installing TeXMaker, during which, the Texlive was installed automatically, but I noticed that someone said that this installation might lose some useful packages....but I really have no idea how to check that if my Texlive had installed the package `siunits`.

It's a little complicated, but, anybody has some idea? Thank you!

• Welcome to TeX.SX! I recommend asking a separate question about installation issues, that is a completely different topic. I typically install TeX Live form TUG.org, instead of the version found in Ubuntu repos, see How to install "vanilla" TeXLive on Debian or Ubuntu?. – Torbjørn T. Mar 21 '16 at 12:21
• @Torbjørn T. Sorry for my late (very late) reply, but after guiding by the instruction you suggested to instal vanilla TeXLive, my laptop 'burned', the system cracked down and when I rebooted it, my SSD was broken, so I bought another SSD, it just arrived today so I can only replied you now. The problem I had might be due to the fact that I have installed a version of TeXLive by installing TexMaker, however, this version should be deleted before installing Vanilla TeXLive, maybe in installing the later, these two version conflict. – odawnw Mar 30 '16 at 14:27
• @TorbjørnT. It is really my pleasure to have your comprehensive suggestions on the problem, thx to your re-editing, which made some spelling errors, and thx to category my question into two issues, that's easy to be understood. – odawnw Mar 30 '16 at 14:30
• @TorbjørnT. Actually, I tried to reinstall Vanilla TeXLive again today, unluckily, fail again, the problem is, after the first step for installing, when I try to add /opt/texbin to \$PATH variable, it failed, after reedited the document, when I close gedit, the terminal warned that "(gedit:19274): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files " As a result, when I check which tex, the terminal gives no reply...Do you know what is this problem? Thx – odawnw Mar 30 '16 at 14:34
• As I said, installation issues is a completely separate problem that should go in a different question. I don't know what is wrong. – Torbjørn T. Mar 30 '16 at 14:50

To use LaTeX code directly in a LyX document, you need to write this in a TeX Code box (often called an ERT), which is inserted with Insert -> TeX code, or the shortcut Ctrl+L (Cmd+L on a Mac). Write `\watt` inside such a box, and it should show up as expected.
Unrelated note: I would recommend taking a look at the `siunitx` package instead of `siunits`, which I think is more powerful. With `\usepackage{siunitx}` added to the preamble, you can write a number with a unit as `\SI{10}{\watt}`, or a unit alone with `\si{\watt}`. Look at the manual for a lot of examples.