Tag Info

New answers tagged

3

Only the backslash needs to be escaped: \documentclass{article} \usepackage{fancyvrb} \usepackage{luacode} \begin{luacode} function OpenFile(mode,name) out=io.open(name,mode) return end function CloseFile() io.close(out) return end \end{luacode} \newcommand\OpenFile[2][a]{\luaexec{OpenFile('#1','#2')}} \def\CloseFile{\luaexec{CloseFile()}} ...


4

Lua has an io library that seems to work with LuaLaTeX. I don't really know what the recommended usage is though. % !TeX program = lualatex \documentclass{article} \begin{document} Foo. \directlua{ out = io.open('somefile.tex','a') out:write('Hello world. ') out:write('This is different') io.close(out) } \input{somefile} \end{document}


3

It's possible to use the standard TeX file handle routines such as \newwrite and \newread and \openout etc., letting LuaLaTeX write the code to the file as if should be written 'to' the current file (well, the TeX input processing assembly line ;-)) \documentclass{article} \usepackage{luacode} \newwrite\luageneratedfile \begin{document} ...


1

Imho it is a problem with the endash in your font: \documentclass{article} \usepackage{fontspec} \newfontfamily\greekfont[Script=Greek]{GFS Porson} \begin{document} \greekfont Οὑτωσ \fbox{—}τοίνυν, Οὑτωσ \fbox{–}τοίνυν, \end{document}


52

The preflight tool of PDFBox validates against the PDF/A-1b standard, more than just PDF. The first errors regarding PDF/A-1b should be resolved by a recent pdfTeX, I do not get these errors with pdfTeX 1.40.16 (TeX Live). The last error 7.1 about MetaData comes from the requirement of PDF/A-1b to also embed the meta data in XMP format, see package ...


4

Several issues here. table.pack() expects a comma-separated list of values, not a string. So the appropriate syntax would be without the quotes, i.e: table.pack(#1) Using the mentioned syntax, Lua would receive: table.pack(a,b,c,d,e) in your example, but that is not a list of values, but a list of variables. Undefined variables indeed. So you have to quote ...


2

\directlua expands input in an \edef-like fashion. You should always watch for expansion: here we have ~, which is expanded if you don't protect it: \documentclass{beamer} \newcommand{\test}[1][n==3]{% \directlua{% local fin = "\unexpanded{#1}" repeat n = math.random(1,5) tex.print(n .. " ") until ...


1

After discussions with Christian (many thanks!!) and many different error messages that I received, two things helped finally to solve the problem: Update ALL packages inputenc doesn't work together with lualatex and leads to not compiling the external files. Removing this package helped.


5

It seems a bug somewhere. A temporary workaround: \documentclass{article} \usepackage{fontspec} %\setmainfont{Linux Libertine O} \newcommand{\hdigit}[1]{% \accent\string"02C6 #1% } \begin{document} \^5 causes a collision! And 5^^^^0302 too. But \hdigit{5} doesn't. \end{document}


0

In the end I decided that typing unicode characters directly as David Carlisle suggested was the way to go for my problem. It avoids hacking the Latex parser and the formulas in my text file are much more readable. The biggest hurdle was figuring out how to input unicode characters on linux without having to change the text editor I was using. In the end, I ...


2

As it turned out in An equivalent of psfrag and polyglossia together?, you cannot use psfrag with XeLaTeX. For me it was a serious problem.


7

Maybe this is what you're looking for. \documentclass{article} \usepackage{ifluatex} \ifluatex \usepackage{fontspec} \else \catcode`\^^^=\active \begingroup\lccode`~=`\^^^\lowercase{\endgroup \def~^}#1#2#3#4{$\langle$U+\uppercase{#1#2#3#4}$\rangle$} \fi \begin{document} ^^^^1e0f \end{document} The ^^^^ notation in LuaTeX specifies the Unicode ...


0

The correct FlashVar for setting the video source in StrobeMediaPlayback.swf is src=/filepath/file2.MP4 otherwise, the reported error occurs. The following MWE should work: \documentclass{beamer} \usepackage{media9} \begin{document} \begin{frame} \includemedia[ width=0.7\linewidth, height=0.5\linewidth, % activate=onclick, %this is default ...


-1

I had the same issue you're describing. I was only able to successfully embed the video when filepath is in the same directory as my beamer.tex file. This is particularly confusing because I'm not aware that this limitation is spelled out in the media9 documentation.


3

In Lua itself the backslash is also a escape character inside "...". Replace "..." by [[...]]. With the latter \ is not an escape character any longer: \documentclass{article} \usepackage{luacode} \begin{document} \begin{luacode*} i=6 j=8 tex.print([[\begin{tabular}{|l|l|}\hline]]) tex.print(i.."&"..j) tex.print([[\\ \hline]]) ...


2

As it is possible to access nodes created by \special commands, we can access tags inserted by tex4ht. Small proof of concept is lua4ht package. Advantage is that it supports fontspec and unicode-math packages, which tex4ht doesn't support otherwise, the downside is that mathml production is broken, so it is produced as normal italic text in the sample. In ...


3

The question is somewhat general, but refers to the specific problem of periods, which have a special meaning for TeX delimiters. (Choosing other punctuation from other fonts works fine, right?) My understanding is that they should always have delcode of zero; unicode-math has a line of code to ensure this, and due to a broader bug in how range is ...


10

Instead of using tex.print you can use print. Then the argument is written to the standard output (monitor) and you can control it: \documentclass{article} \usepackage{luacode} \begin{document} The following is my table \begin{luacode} i=6 j=8 tex.print("\\begin{tabular}{|l|l|}\\hline") tex.print(i.."&"..j) tex.print("\\\\ \\hline") ...


10

The \directlua primitive is expandable so provided we formulate the code to use it directly we can show the result: \documentclass{article} \begin{document} The following is my table \showtokens\expandafter{% \directlua{ i=6 j=8 tex.print("\noexpand\\begin{tabular}{|l|l|}\noexpand\\hline") tex.print(i.."&"..j) ...


13

The problem has a long history. It was brought up in 2011, as far as I know, with a message to the TeX Live mailing list; the thread went on also in the LuaTeX list. The problem is that LuaTeX doesn't add the italic correction in math mode after characters having category code 11. Indeed, in TeX Live 2011, the output from your code would be the same as you ...


5

The problem are the line ends: tex.sprint([[ \begin{tabular}{ | l | l | p{4.in} | } \hline {\bf File} & {\bf Cards} & {\bf Summary} \\ \hline \end{tabular} ]]) The string encoded via [[ and ]] will contain characters with code 10 ("\n", new line character). When TeX gets the string from Lua, it takes it as whole line, thus the line ends does ...


2

use the environment luacode without the star and escape the backslashes: \documentclass{report} \usepackage{luacode} \begin{document} \begin{luacode} tex.print("\\begin{tabular}{| l | l | p{4.in} | } \\hline") tex.print("\\bfseries File & \\bfseries Cards & \\bfseries Summary \\\\\\hline") tex.print("\\end{tabular}") \end{luacode} \end{document} ...


3

You are using the wrong print command in the first example. Since you are entering multiple lines, these lines are not string any more. So, you can't use sprint in that case. You should've used texio.write_nl instead. \documentclass{report} \usepackage{luacode} \begin{document} \begin{luacode*} texio.write_nl([[ \begin{tabular}{| l | l | p{4.in} | } ...


4

You should use XeTeX or luaTeX and your font should support Bengali. I have used Mukti Narrow (I had issues with Free Serif, whitout fontspec package): \documentclass{article} \font\beng="Mukti Narrow Bold:script=beng" \begin{document} This is Bengali: {\beng পারে} \end{document} This is an example from ieeetran class, which works just fine: ...


1

I think it depends on the language of the text you use. But you should use XeTeX or luaTeX. This is a minimal example from Wikipedia: \documentclass[11pt]{article} \usepackage{fontspec} \setmainfont[Ligatures=TeX]{Linux Libertine O} \begin{document} \subsection{Ελληνικά} Ὅλοι οἱ ἄνθρωποι γεννιοῦνται ἐλεύθεροι καὶ ἴσοι στὴν ἀξιοπρέπεια καὶ τὰ δικαιώματα. ...


1

So i kind of solved the problem with some help form the pgfplots manual pages 470-2, and this other question. I have this in my preamble: \usepackage{tikz,pgfplots,pgfplotstable} \pgfplotsset{compat=1.9} %\usetikzlibrary{external} \usepgfplotslibrary{external} \tikzexternalize \tikzset{external/system call={lualatex -shell-escape -halt-on-error -interact ...


5

You can iterate over all the character nodes and check for a non-ascii character \documentclass{article} \usepackage{fontspec} \begin{document} \def\myTestString{fo―o\textemdash bar}% \setbox0\hbox{\myTestString} \if\directlua{% res="TF" local h=tex.getbox(0).head for n in node.traverse(h) do if (n.id==37) then print("\string\n==" .. n.char) ...



Top 50 recent answers are included