On Mon, Jun 15, 2009 at 20:58, Massimo Redaelli wrote:

Dear Massimo,

Thanks a lot for such a quick response.

>     thanks for letting me know about this. I am certainly willing to
> fix it, but my knowledge of Context is null.

My knowlegde of LaTeX equals that as well, so ... :) :) :)

I'm putting this back to the mailing list since I should be studying
instead of playing with TeX now ...

> Could you suggest to me a good starting point to find out differences
> and incompatibilities of Latex and Context?

ConTeXt knows and respects 99% of plain TeX commands. So only
LaTeX-specific ones will need to be fixed. I suggest to take a look at
pgfplots or TikZ package itself to see how the differences are
implemented. If you are ready to adapth the package to ConTeX, plain
TeX support could be done at the same time for no extra cost, I guess.

I suspect that almost all of your code works out of the box already
anyway. These are the most obvious exceptions, but I didn't inspect
closely enough, so there might be others:

\NeedsTeXFormat -> no equivalent in ConTeXt (and is not needed)
\RequirePackage{name} -> \usemodule[name]
\RequirePackage{xstring} -> no idea what it does; it might be that the
functionality of this package will have to be adapted/implemented in
ConTeXt or something else will have to be done
\DeclareOption -> it might be that this needs to be implemented in
semi-low-level ConTeXt (you'll get help on this mailing list); maybe
that's the most work, but once you have a single example you just
copy-paste
\ExecuteOptions
\ProcessOptions
\newcommand -> in ConTeXt one would use the "plain-TeX" \def\commandname#1#2...

\newenvironment{circuitikz}{
\begin{tikzpicture}}{\end{tikzpicture}}
->
\long\def\startcircuitikz#1\stoptikzcircuitikz{\starttikzpicture#1\stoptikzpicture}

You can take a look at pgfplots for example. They put all the code to
tex/generic/pgfplots and only a single file to tex/latex/pgfplots. The
beginning of circuitikz.sty should go to
tex/latex/circuitikz/circuitikz.sty, while the "contents" of that file
and probably all other files should better have the ending "tex" and
go to tex/generic/circuitikz/...(I don't know exact conventions of
tikz).code.tex and you should create a file in
tex/context/third/circuitikz/t-circuitikz.tex that starts
approximately like this:

% some nice header, but you may worry about that later
\def\pgfcircversion{0.2.1}
\writestatus{loading}{2009/04/17 The CircuiTikz circuit drawing
package version \pgfcircversion}
\startmodule[circuitikz]

\unprotect % this sets the catcodes of @ and ! to letter (if needed)

\usemodule[tikz]
\usetikzlibrary[calc]
\usepgflibrary[decorations.pathmorphing]

% maybe some ConTeXt-specific initialisations

% load all the generic file(s) that you need
\input nameofyourfile.code.tex

% define the environment
\long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}

\stopmodule

\protect \doifnotmode{demo}{\endinput}
% you may put some simple sample document below

In order to test the package:

% \usemodule[tikz] % maybe you don't need this if you load circuitikz already
\usemodule[circuitikz][american]
\starttext
\startcircuitikz
....
\stopcircuitikz
\stoptext

But I'm sure that the list will help you further with implementation details ...

Mojca


> On Mon, 2009-06-15 at 20:48 +0200, Mojca Miklavec wrote:
>> On Mon, Jun 15, 2009 at 20:35, Maurí­cio wrote:
>> > I would like to use this package for
>> > drawing circuits:
>> >
>> > http://home.dei.polimi.it/mredaelli/circuitikz/index.html
>> >
>> > The examples are in Latex, but I imagine it
>> > could be used in ConTeXt since it's written
>> > using Tikz.
>> >
>> > How can I do that? The recomended instalation
>> > procedure at the website is to just uncompress
>> > everything in texmf-local directory, but that
>> > creates a 'latex' directory that I imagine
>> > ConTeXt won't use.
>>
>> Hello Maurí­cio,
>>
>> You'll need to convince the author to make a generic package.
>>
>> I'm not sure if he's familiar with ConTeXt or not. The changes that
>> are needed might be doable in reasonable amount of time (from my first
>> impression there are not too many LaTeX-specific commands present),
>> but the package won't work out of the box as it stands at the moment.
>>
>> Mojca
>
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to