KTUGFaq

KTUG FAQ

α:
йȣ:
Your temporary financial embarassment will be relieved in a surprising manner.
FrontPage占쏙옙占쏙옙占 › noweb
[]

noweb̶

noweb LaTeX ϴ cweb ̴. web/cweb TeX ϴ ó noweb LaTeX Ѵ. , LaTeX Ű cweb ϴ literate programming Բ ִ.

[]

ٿε/ν

[]

ƿ ν ϱ1

ν ϴ port (http://www.macports.org/) ϴ ̴.
sudo port install noweb
/opt/local/bin noweb ġȴ.
[]

ƿ ν ϱ2

noweb ܺ α׷ ҷ ߰ ó ϴ ִ. ܺ α׷ C ڵ带 ̳ʸų, awk α׷̰ų icon α׷̴. ׷Ƿ noweb ̿ؼ پ ̿ϱ ؼ ݵ awk icon ־ Ѵ.
  • ϴ src 丮 ̵Ѵ.
  • awk nawk νĽŰ sudo ln -s /usr/bin/awk /usr/bin/nawk
  • icon ġ ִ. http://www.cs.arizona.edu/icon/
    • ̳ʸ Ƿ ̸ ν Ͽ ϵ Ѵ. 쿡 Ѵ.
    • icon ̳ʸ PATH ġش.
  • src 丮 Makefile Ѵ. ⿡ ̺귯 ҽ awk icon , ΰ Ƿ شǴ LIBSRC ְ ũ ־ Ѵ. , ü make install ι־ Ѵ.
    #LIBSRC=./icon 
    LIBSRC=awk
    # If you have no Icon compiler, but do have icont, make ICONC=icont
    ICONC=icont
    ICONT=icont
      
  • ؼ 丮 ־ Ѵ. (翬) ʿ 丮 ־ Ѵ.
    TEXINPUTS=/Users/smcho/Library/texmf/tex/latex/
      
  • make; sudo make install; ָ ڵ 򸰴.
    • ݵ ҽڵ尡 򸮴 Ȯ ־ Ѵ!!!!

[]

ν

츦 ؼ ν ϸ ɰ ˴ϴ. -- smcho

ٷ ڿ ϵǾ ִ. ٸ Ű ϰ ġѴ.
[]

ִ Ҵ.

\documentclass{article}
\usepackage{noweb}
\usepackage{dhucs}
\begin{document}

\section{ }
 ִ α׷ ۼ . 

@ 
     ó  ִ. 
<<nine.c>>=
<<headers>>
<<engine>>
<<main>>
<<print>>
<<test>>
@

´ [[status]] ǥð ϴ. 
<<headers>>=
/*  */
#include <stdio.h>
#include <assert.h>
@

<<engine>>=
/*
   DoxyGen string
*/
int engine(int x, int y)
{
  assert(x >= 0 && y >= 0);
  return (x * y);
}
@

<<print>>=
/*
  Write down the result.
*/
int print(int x, int y, int z)
{
  printf("(%d) X (%d) = (%d)\n",x,y,z);
}
@

<<main>>=
/*
  Main Routine
*/
int main()
{
  int i, j;
  for (i = 1; i < 3; i++) {
    for (j = 1; j < 3; j++) {
      int z = engine(i,j);
      print(i,j,z);
    }
  }
}
@

<<test>>=
/*
  Test routine
*/
int test()
{
  printf("testme\n");
}
@
\end{document}
[]

noweave -delay nine.nw > nine.tex

ҽڵ
notangle nine.nw -Rnine.c > nine.c
[]

ؼҽ ϸ pdf ִ.

ҽڵ带 ϸ α׷ ִ.
 $ gcc nine.c -o nine
$ ./nine 
(1) X (1) = (1)
(1) X (2) = (2)
(2) X (1) = (2)
(2) X (2) = (4)

[]

ڵ ûũ

noweb <<>> ¡Ǵ ڵ ûũ ϳ ִ Ѵ. \nowebchunks ̿Ѵ.

[]

ε

noweb  ǰ 𿡼 Ǿ ˷ִ index ִ.
[]

ε

[[main]] ϸ main ε ϵȴ.
[]

ε

@ %def main ڵûũ ϸ ε ڵûũ ȴ. main ε , ̸ ǵ ̴.

[]

ε

\nowebindex Ͽ Ѵ.
  • noweb ɿ -index ߰Ѵ.
[]

å

hyperref ϴ ε ڵ ûũ ڵ ȴ.
\usepackage[pdftex,colorlinks,backref,bookmarks
  ,pdftitle={knoweb.sty}
  ,pdfauthor={smcho}
  ,pdfpagemode={UseOutline}
  ,bookmarksopen={true}
  ]{hyperref}
[]

ū α׷

ϳ nw Ͽ ҽ ִ. -R ɼ ϸ ȴ.

nw , tex ȯ \input ̿ؼ ϳ 'ū' ִ.

ΰ ϸ ū Ʈ ִ. ׷ make ϵ ÿ Ѵ.

Makefile . make tex ̿ؼ 丮 ִ nw Ͽ ҽ Ʈ(.m) ڵ , Ŀ make ̿ؼ pdf Ǿ ִ.

Makefile ؼ for ̿ؾ Ѵ. ̰ Ʈ Ƽ ϳ C α׷ ٸ, ϳ tex Ͽ ټ .tex include ϴ ̿ؾ ϱ ̴.

, Make ̿ؼ ϸ óϱ ٶٸ abc.m : abc.nw ó ҽ ָ ȴ. ڵ óǴ ߴ.

SHELL=/bin/sh
NOWEAVE=noweave
NOTANGLE=notangle
NODEFS=nodefs
PDFLATEX=pdflatex

TARGET=codeanalysis
NWS = $(wildcard *.nw)
NAMES = $(NWS:.nw=)
TEXS = $(NWS:.nw=.tex)

.SUFFIXES: .nw .tex .dvi .html .pdf .m
.SECONDARY: $(TEXS) # Don't delete the tex file
.PHONY: tex

all: $(TARGET).pdf

test:
	@echo $(TEXS)
	
pdf:
	$(PDFLATEX) $(TARGET).tex

tex: 
	@for t in $(NAMES); do \
	echo "processing $$t.nw"; \
	$(NODEFS) -autodefs c $$t.nw > $$t.defs; \
	$(NOWEAVE) -delay -filter btdefn -autodefs c -indexfrom $$t.defs $$t.nw > $$t.tex; \
	$(NOTANGLE) -R$$t $$t.nw > $$t.m; \
	done

$(TARGET).pdf : $(TARGET).tex
	$(PDFLATEX) $< -o $@
	
.nw.tex:
	$(NODEFS) -autodefs c $*.nw > $*.defs
	$(NOWEAVE) -delay -filter btdefn -autodefs c -indexfrom $*.defs $*.nw > $@
	

sclean:
	rm -f *~  *.dvi *.log *.html *.pdf *.m *.out *.defs

clean:
	rm -f *~  *.dvi *.log *.html *.pdf *.m *.out *.defs *.tex *.aux
	
[]

Ÿ

  • notangle ִ ҽڵ ش. ̰ bcpp ̿Ͽ ҽ ڰ ȯ ִ.
  • memoir \tt Ʈ memoir ٰ . ̰ memoir "" ƴϰ \tt non-compatible command ִ Ÿ ̱ ߻Ѵ. ̰ [oldfontcommands] ɼ ؾ Ѵ.
[]

wc noweb ̿ؼ .
[]

ٿε

@wc.zip (12.41 KB)
[]

nodefs -autodefs c wc.nw > wc.defs
noweave -delay -filter btdefn -autodefs c -indexfrom wc.defs wc.nw > wc.tex
pdflatex wc.tex
pdf ִ.

notangle wc.nw > wc.c
C ҽڵ带 ִ.
[]

@wc.pdf (204.25 KB) , ε ڵ ũ pdf 󿡼 Ϻϰ Ǿ ִ. ѱ۵ dhucs ϴ 쿡 ȴ.



^
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2008-12-17 02:11:18
Processing time 0.0560 sec