## 6Using Scientiﬁc word

### 6.1location of external package in Scientiﬁc word

if using SW on windows and want to add a package not included by SW, then ﬁrst download it from CTAN and put the .sty ﬁle here

C:\swp55\TCITeX\TeX\LaTeX\contrib

and from inside SW, follow instructions as given here

or you can simply edit the preamble and add \usepackage{packageName}

### 6.2inputting Latex ﬁles into SW document

This is tricky. But just do this and do not follow any other instructions given in other places, they are all very confusing. Here is the deal.

When you write input{file.txt} in SW document main.tex, then it will not ﬁnd file.txt becuase SW process main.tex is some other temporary folder. The easiest way to do this, is to make main.tex as a master document, then it will use the current folder.

To make main.tex as master document, create a ﬁle called empty.tex in the same folder and type in it exactly the following (using a text editor)

%TCIDATA{LaTeXparent=0,0,main.tex}

That is all, the one line above. Now go back to main.tex, and open that in a text editor (not in SW) and go to the end of the ﬁle just before end of the document, and add these lines, including the comments! this is important.

%TCIMACRO{\QSubDoc{Include empty}{\input{empty.tex}}}%
%BeginExpansion
\input{empty.tex}%
%EndExpansion

Now, close everything. Now main.tex is a master document. Now you can write \input{file.txt} in master.tex and SW will now inlcude the ﬁle.txt (assuming of course the ﬁle is in the same folder as master.tex).

So, for each latex ﬁle that is meant to include input ﬁles, we must have an empty.tex ﬁle there, and add it at the bottom of the document itself as shown above.

### 6.3Adding Latex code into SW so that SW do not touch it

sometimes I have a need to insert Latex code into the .tex ﬁle while using SW, but do not want SW to look at this code. This is code used by htlatex for example. One way to do that is by using encapsulated tex ﬁeld. This ﬁeld can be added either from the SW GUI, or directly in source code. To add it in source, let assume we want to add \ifdefined\HCode\href{../../index.htm}{up} in the Latex source ﬁle. Then write

%
%TCIMACRO{\TeXButton{TeX field}
%{  \ifdefined\HCode\href{../../index.htm}{up}   }
%}
%BeginExpansion
\ifdefined\HCode\href{../../index.htm}{up}
%EndExpansion

Notice what we did. The code has to be put in 2 places. In the comment and inside the BeginExpansion and %EndExpansion block.

That is the only reliable way to insert Latex code for use by tex or tex4ht without having SW see it. Otherwise, SW can change it or move it around, or worst, comment it out. Now, the above can be processed OK by htlatex, since the TexField is a comment, but the code is still there in the second block.

### 6.4Fixing decoration fbox

When adding a frame in SW, around math equation such as displayed formula, it will add \fbox to do it. To improve how the math looks inside, added this to the preamble of the document

\usepackage{amsmath}

\let\latexfbox\fbox
\renewcommand{\fbox}[1]{%
\latexfbox{\everymath{\displaystyle}#1}%
}

Thanks for http://tex.stackexchange.com/