Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1 2 3 
Send Topic Print
Exporting to Latex (Read 42695 times)
Arthur Magnusson
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #15 - Mar 16th, 2010, 7:56pm
 
Hi, I've been playing around with this. Great stuff this MMD

I've tried to implement latex equations, (one of) the code(s) in an original latex file to insert an equation is
\[ equation \], and MMD suggest to put inline code as HTML comment. It works when I insert it into my Tinderbox text directly. But I was trying to do a template for separate equation too.
It looks something like this:

<!-- \[ ^text^ \] -->

Now, there are two problems: 1) Backslashes are not exported well, I've tried the ^encode command but just can't get my head round what syntax I'm supposed to use.
2) What if I need to use the caret in my equation. Tinderbox seems not to allow to insert the caret into any text unless it's a template. Fair enough, as it's reserved for exports, but still there must be a way to use them anyway, double carets?

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting to Latex
Reply #16 - Mar 17th, 2010, 6:04am
 
Your point #2 is incorrect. TB doesn't prevent you from using a caret - see TB's Help, Appendix 4 under miscellaneous codes. To escape a literal ^ during export you simply double it, ^^.

Latex. (Note I've no practical LATEX expertise). I have a note with this text:

It was the ^^ best of \ times.

I have a template with this code:

<!-- \[ ^text^ \] -->

Exporting the note via the template I get this HTML code (as seen in/copied from BBEdit):

Quote:
<!-- \[ <p>It was the ^ best of \ times.</p> \] -->


I doubt you want the <p> tags, so I amended the template code:

<!-- \[ ^text(plain)^ \] -->

Now I get:

Quote:
<!-- \[ It was the ^^ best of \ times. \] -->


What is the problem with backslashes?

It would help us help you if you gave a real example of something you're trying to export with an example of exactly how it should look (and the output encoding type needed if not visible but pertinent and currently problematic).
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Arthur Magnusson
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #17 - Mar 17th, 2010, 6:41am
 
Thanks for the clarification, much appreciated

re 2) it now works - it's strange, the text input window sometimes acts inexpectedly. wouldn't allow me to copy/paste at times, or in that case to insert carets..(!)

re 1) Sorry, doing tests on a clean tbx file shows that there no such problem. My issues were due to a misunderstanding of the interaction syntax between the templates and the multimarkdown conversion from html to latex.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Exporting to Latex
Reply #18 - Mar 17th, 2010, 10:17am
 
I just inserted, deleted, copied and pasted a few hundred carets without difficulty.

Hmmmm....
Back to top
 
 
WWW   IP Logged
Arthur Magnusson
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #19 - Mar 17th, 2010, 10:23am
 
I was testing this several times, and it only happens when the given note has a prototype!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting to Latex
Reply #20 - Mar 17th, 2010, 10:45am
 
I can't replicate this. It would really help in this sort of situation if you'd post a link to a specimen TBX that shows the problem. You mention prototypes but give no real info as to the sort of text you're processing, the exact template code, etc., etc.  More info is good!
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Arthur Magnusson
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #21 - Mar 17th, 2010, 6:44pm
 
Sure, I appreciate that my description was terse.
Here's a very simple tb file I created where the problem occurs: http://senduit.com/c4df79

It might be a bug that only happens on my mac, though I'm clueless as to why. I tried switching off any third-party programs, too
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting to Latex
Reply #22 - Mar 18th, 2010, 5:15am
 
OK, thanks for the file. Unfortunately, it doesn't actually replicate your case and I can't see what you've actually tested. Carets seem to be the problem but only one test case has any. It's odd that your selecting the 'plain' built-in template yet exporting a '.html' file. Interestingly, if I place a single caret in either of your test notes - either one its own or touching a word, TB exports that (as seen in HTML view); I assume this is because

Let's try again and cut TB out of the loop for a moment.  Can you put in a forum message here the exact starting text and the same text exactly as you expect to receive. Don't forget, none of us here can see your system.

It seems that in neither note in the example file have you tried the caret remedy. IOW if you want to output literal caret (^) use ^^, i.e. double it. So for

It was the ^best of  ^ times...

alter the text to

It was the ^^best of  ^^ times...

In your last test note you state "here I can't insert carets although I can paste them from elsewhere". So you are saying that if you place your text cursor in the note and type Shift+^ you don't get a ^ character appear in the note? Again, that doesn't happen here, there is no problem inserting cursors.

What are your international settings? Perhaps you're using different country settings and a different keystroke is needed. Select Finder and in its Help menu type "About Keyboard Viewer". Follow the instructions to open Keyboard viewer. With the viewer open, look at the '6' key in the simulated keyboard. Now hold down the Shift key. Does the 6 change to a ^? If it doesn't, that is your problem.  It may be your keyboard is marked with a ^ above the ^ but your international settings differ.  By using the Keyboard viewer and experimenting with holding down (groups of) modifier keys - Cmd, Opt, Shift - the viewer should tell you the right key combo on your system to create a caret.
Back to top
 
« Last Edit: Mar 18th, 2010, 5:16am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Arthur Magnusson
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #23 - Mar 18th, 2010, 5:50am
 
Hi Mark,

thanks for checking it, I'm very grateful for your service.

Regarding the export, it now works: like I mentioned above, the problem didn't lay with TB export but instead with the multimarkdown conversion into latex. So no need for diagnostic

Regarding entering carets, I wasn't aware of the shift+6 combo for carets!!
I always used option+I, then space (which is common for entering hat-accents in French because it allows to type in the required vowel, or just space for an empty caret). So my usual combination only works in note without prototypes (still a mystery, but not that important), but the shift+6 combo works fine!

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting to Latex
Reply #24 - Mar 18th, 2010, 6:24am
 
Happy to help. Ah, the accent entry bit all makes sense.  For TB use, definitely use Shift+6 and I think the caret entry issues will go away. Sounds like you're 'fixed' - for this issue anyway. I've added some clarification to aTbRef and the TB Help as to how best to add a caret symbols (given the ambiguity this thread has exposed).

I hope you're at last getting something into LATEX!
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Charles Turner
Full Member
*
Offline



Posts: 180
New York, USA
Re: Exporting to Latex
Reply #25 - May 10th, 2010, 7:47am
 
Hi all-

Finally started working seriously with Amber's great contribution. I noticed that Tinderbox's production of a UTF-8 file (I thought I would never say this!) gives LaTex a bit of a hit: the BOM header is flagged as gremlins, and the UTF-8 coding in general seems to make my setup insist that "\begin{document}" is nonexistent. Even so, it produces a complete rendering.

What I really missed with Amber's approach was the ability to use Markdown, so I could type in italics, bold text, block quotes, etc. without having to use LaTeX conventions.

So here's a version of a Tinderbox-export-to-MultiMarkdown that uses a Nakajoji window:

http://www.vze26m98.net/tbx/tbx_mmd.zip

To use it, select "My Document," open a Nakajoji view and set the radio buttons to "Selected notes." (You should be using "TextTemplate" as your export template.) Export produces a MultiMarkdown formatted text file which you run through Fletcher Penney's Perl scripts, not the SmartyPants-cum-XLST processing that Amber's script does automatically.

Headers are taken from the outline item titles. In this case, "My Document" becomes the document title, and you can look at its text (and the template) to see how to add additional metadata.

Children of "My Document" become Chapters, and their children become Sections. As MMD headers below 3 asterisks (###) don't start new sections or numberings, these would simply be added into the body of the outline text. If you want Parts, add another level to the templates between the first and second. In other words:

"My Document"   (Title:)  - TextTemplate
Part                 (#)
Chapter             (##)  - ChapterTemplate
Section            (###)  - SectionTemplate

I haven't done a lot of work with this, but simple lists and block quotes are demonstrated. I'll continue to develop it, but my interest is in footnotes and citations, and less so mathematics typesetting. But I'll try to help with support, questions and cmplnts. ;-)

Enjoy! Charles
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting to Latex
Reply #26 - May 10th, 2010, 11:14am
 
Thanks for this contribution. A BOM should - in standards terms - be beneficial. It has proved otherwise as the majority of apps not only eschew a BOM but worse, they treat it as an error. Note: the next release of TB will no longer insert a BOM in exported files.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Charles Turner
Full Member
*
Offline



Posts: 180
New York, USA
Re: Exporting to Latex
Reply #27 - May 10th, 2010, 1:25pm
 
Well, I could have been more precise.

Historically, LaTeX likes 7-bit ASCII, but with XeLaTeX and Biber, etc. it's increasingly a Unicode world.

What's more precise is that the UTF-8 file that Tbox produces isn't compatible with the 7-bit input that MultiMarkdown's standard templates are expecting. But that can be easily changed. (What I'm working on now...)

Charles
Back to top
 
 
WWW   IP Logged
Rónán Kennedy
Full Member
*
Offline



Posts: 26

Re: Exporting to Latex
Reply #28 - May 22nd, 2010, 11:36am
 
Charles

Thanks for the sample file, which is very useful. Do you have any idea how you can change the frontmatter in the resulting LaTeX file? I had a look at the XLST file, but it wasn't obvious to me how to modify that part of the final output?

Regards,

Rónán
Back to top
 
 
  IP Logged
Charles Turner
Full Member
*
Offline



Posts: 180
New York, USA
Re: Exporting to Latex
Reply #29 - May 23rd, 2010, 11:36am
 
Hi Rónán-

Here's an updated archive with their accompanying modded XSLT files:

http://www.vze26m98.net/tbx/tbx_mmd_20100523.zip

Beware that I'm using XeLaTeX, Biber, biblatex and the biblate-chicago-df style for citations. That gives me a complete UTF-8 path through LaTeX, but may not be what you're interested in.

The resulting PDF shows the use of MMD for footnotes and bibliographic citations, maybe some other stuff that I've forgotten about.

The XSLT files should show you how to go about re-configuring them for alternate LaTeX formatting. The "preamble" is in xml2latex.xslt, and there is other material in memoir.xslt.

If I had to suggest a method, trying hacking the LaTeX output of MMD to get the formatting you want, then go back searching through the XSLT files to locate what you need to change. It's really pretty simple.

I've been using the FileMerge.app included with the Xcode Dev Tools to help. Diff your hacked and original LaTeX files, and use that as reference/reminder about what to search for with your text editor in the XSLT files.

HTH, Charles

(PS: Next up for me is figuring out how to output sections of my Tbx work so that I'm not always LaTeXing some huge single file...)
Back to top
 
« Last Edit: May 23rd, 2010, 11:37am by Charles Turner »  
WWW   IP Logged
Pages: 1 2 3 
Send Topic Print