Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wish: empty header #184

Closed
GoogleCodeExporter opened this issue Apr 18, 2015 · 5 comments
Closed

wish: empty header #184

GoogleCodeExporter opened this issue Apr 18, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. txt2tags --target=tex some.txt, where the first three lines of some.txt are 
blank.
2. pdflatex some.tex
3.

What is the expected output? What do you see instead?

I need a document without a title, but pdflatex complains "no \title given".


What version of the product are you using? On what operating system?

version 2.6 installed through homebrew on OS X 10.9.5


Please provide any additional information below.

This is not a bug report but it's just a wish.  I don't know how to mark an 
"issue" as such.

Original issue reported on code.google.com by ryofu...@gmail.com on 26 Sep 2014 at 12:45

@GoogleCodeExporter
Copy link
Author

Hello,

with the current SVN (development) version, you can use templates, which is an 
interesting feature because you can tweak your targets, like removing \title :)

You can try this example if you wish (I'm using an older revision of txt2tags 
but it's after the release of the 2.6 version, you should also be able to use 
http://txt2tags.googlecode.com/svn/trunk/txt2tags which is the latest version):

--8<---------------
wget 
https://bitbucket.org/farvardin/textallion/raw/fbb3b2cd23c6504daf50f31d371747c48
1761a58/contrib/txt2tags/txt2tags

wget http://pastebin.com/raw.php?i=hvAtXA6S -O latex_no_title.tex

echo "(it's an adaptation of wget 
https://bitbucket.org/farvardin/textallion/raw/fbb3b2cd23c6504daf50f31d371747c48
1761a58/templates/latex_no_title.tex)" 

chmod +x txt2tags

printf "\n\n\n\n\nHello, this is a simple //LaTeX// file written with 
**txt2tags**\n\n" > sample.t2t
./txt2tags -T latex_no_title.tex -t tex -o sample.tex sample.t2t
pdflatex sample.tex

--8<---------------

If you need tweaking more LaTeX documents, you can also use this project which 
is built on top of txt2tags:

https://bitbucket.org/farvardin/textallion

I haven't tested it for a while on Mac OS X but it should work.

Original comment by eforg...@gmail.com on 26 Sep 2014 at 7:26

@GoogleCodeExporter
Copy link
Author

Thank you for your response!  Your method just worked.

However, what I really wish is that //by default// txt2tags allow for a 
document with an empty header.

I was looking for a //simple// PDF generator for simple documents, with which a 
simple text file is converted to a PDF file whose contents looks similar to the 
original text file.  For example, the behavior of "txt2tags -T 
latex_no_title.tex -t tex" is closer to what I was looking for.  In other 
words, I was looking for something a bit like the org mode of emacs, or perhaps 
a2ps with a bit of rich-text capability.

Best regards,

Ryo

Original comment by ryofu...@gmail.com on 27 Sep 2014 at 2:52

@GoogleCodeExporter
Copy link
Author

I understand what you mean, but I fear txt2tags won't be changed soon, for 
various reasons. 

However, at the current state of txt2tags, because of its powerful 
preprocessors, you can't be limited because of some choices in the txt2tags 
design which were made in the past (you can also completely customise the 
syntax for the "rich-text").

So the template was an idea, but now I remember there is a much easier way to 
solve your problem: the template thing is cool if you need to add complicated 
LaTeX settings, but for your case you just need to simplify the default one. So 
to avoid this extra title page, the best way is just to remove the call to 
\maketitle in the source, after you generated it.

So just add this line at the beginning of your file (or in a ~/.txt2tagsrc) and 
it will remove the part that is annoying you in your latex source (and the 
output will be the same as the one in the previous example):

%!postproc(tex): '\\maketitle' ''

(we use a double \ because it's an escape sequence in the regex)


There is also an other way, which doesn't rely on LaTeX but convert a pdf from 
html: 

wkhtmltopdf can convert html to pdf, with the use of webkit: 
http://wkhtmltopdf.org/

You can get your pdf this way:

txt2tags -t html file.t2t && wkhtmltopdf file.html file.pdf

But I think the pdf output is much less elegant than the LaTeX one.

Original comment by eforg...@gmail.com on 27 Sep 2014 at 10:16

@GoogleCodeExporter
Copy link
Author

> So to avoid this extra title page, the best way is just
> to remove the call to \maketitle in the source, after you generated it.

Thank you!  That solves my problem.  I'll use that as my default setting (in 
~/.txt2tagsrc).

Ryo

Original comment by ryofu...@gmail.com on 30 Sep 2014 at 2:13

@aureliojargas
Copy link
Member

The problem was solved, I'm closing this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants