Chapter 6
Using Scientific word

6.1 location of external package in Scientific word
6.2 inputting Latex files into SW document
6.3 Adding Latex code into SW so that SW do not touch it
6.4 Fixing decoration fbox

6.1 location of external package in Scientific word

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

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

and from inside SW, follow instructions as given here

http://www.mackichan.com/index.html?techtalk/455.htm mainFrame

pict

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

6.2 inputting Latex files 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 find 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 file 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 file 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 file.txt (assuming of course the file is in the same folder as master.tex).

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

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

sometimes I have a need to insert Latex code into the .tex file 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 field. This field 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 file. 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.4 Fixing 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/