看板LaTeX
標 題Re: [問題] 請問如何看到並編輯tex的原始檔?
發信站SayYA 資訊站 (Fri Apr 20 19:23:42 2007)
轉信站ptt!ctu-reader!news.nctu!SayYa
※ 引述《Edward (蒙古大夫 2.0)》之銘言:
> ※ 引述《[email protected] (Liang)》之銘言:
> > 我手上有一些副檔名為tex的檔案,需要對裡面的內容做更動
> > 我用texmacs是看得到裡面的內容,可是內容似乎有點問題
> > 所以我希望直接看到文字檔的東西
> > 請問:
> > 如何將.tex轉檔成普通文字檔?
> > 另外,這些檔案有附圖檔和字型檔,但是開啟.tex檔時沒有自動加入
> > 請問,圖形的話是否要一個一個手動加入?字型的話需要加在那個子目錄?
> > 謝謝大家幫忙,感激不盡~
> 使用 detex。
看了這篇覺得 detex 應該需要安裝
在 ubuntu 上
aptitute search detex 發現沒有 package
http://www.cs.purdue.edu/homes/trinkle/detex/
# tar source
http://www.cs.purdue.edu/homes/trinkle/detex/detex-2.7.tar
google 一下 發現這篇
http://ubuntuforums.org/showthread.php?t=7570
無法 從 source make 的問題
gcc -O -c -o detex.o detex.c
xxx.l:42: error: conflicting types for ‘malloc’
make: *** [detex.o] Error 1
修改 Makefile
#line 114
#DEFS += ${DEFS} -DNO_MALLOC_DECL
DEFS = -DNO_MALLOC_DECL
重新 make
sed -f states.sed detex.l > xxx.l
lex xxx.l
rm -f xxx.l
mv lex.yy.c detex.c
gcc -O -DNO_MALLOC_DECL -c -o detex.o detex.c
lex.yy.c:796: error: expected identifier or ‘(’ before ‘]’ token
make: *** [detex.o] Error 1
lex.yy.c 是 sed 產生的暫存檔 從 Makefile 發現 已經 mv 成 detex.c 了
vi detex.c
#line 796
]]
將這兩個 ]] 拿掉
/*]]*/
就成功了! make 出 這個 執行檔
detex
$ cat my.tex
\documentclass{article}
\begin{document}
This is a \LaTeX\ testing example
\end{document}
$ detex my.tex
article
This is a testing example
到這邊 成功可以使用 detex 了
或許有更方便的方法 不過 這是我目前知道會動的方法
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: nlp4.et.ntust.edu.tw