As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [javascript]

JavaScript is a scripting language commonly implemented as part of a web browser, but also of some PDF viewers.

Filter by
Sorted by
Tagged with
51 votes
5 answers
95k views

language option supported in listings

I am afraid that listing doesn't support javascript. \begin{lstlisting}[language=javascript] ... \end{lstlisting} What am I doing wrong?
user1592714's user avatar
45 votes
1 answer
4k views

How to embed Javascript in LaTeX Beamer?

I'm wondering if it is possible to add javascript animations in LaTeX Beamer, e.g. figures created with C3 or D3? As far as I remember the animate packages uses javascript in order to display (and ...
user1729210's user avatar
37 votes
3 answers
9k views

Automatic "Zoom in" hypertext boxes in PDF

I remember long time ago, seeing PDF documents (such as online PDF versions of newspapers) that had hypertext boxes around paragraphs, such that when you clicked inside those boxes the surrounded ...
alfC's user avatar
  • 14.1k
35 votes
2 answers
6k views

pdftex and javascript forms with automatic calculations

I would like to create a PDF document in TeX with a form. Some of the fields in the form will be calculated based on the values of other fields. Here is a MWE, thanks to Victor Ivrii on the pdftex ...
Matthew Leingang's user avatar
35 votes
2 answers
47k views

\listings code style for HTML5 (CSS, HTML, JavaScript)

I would like to create a code style for HTML5 that can be used with the \listings package. An HTML5 document consists of three languages: CSS, HTML and JavaScript. That makes the whole thing a bit ...
Benny Code's user avatar
  • 3,012
34 votes
1 answer
6k views

Copy to clipboard feature in PDF output

Is it possible to have a clickable "copy to clipboard" feature in a PDF document generated by LaTeX? Ideally in the form of a macro that also allows for graphical elements to be embedded inside it (...
1010011010's user avatar
  • 6,287
25 votes
1 answer
2k views

Move-around box in PDF display

I tried using the fancytooltips package and like it a lot. One thing that I could imagine would be nice is to have the entry showing up as a movable box instead of just a tooltip. (Sometimes the ...
Mika H.'s user avatar
  • 3,381
21 votes
1 answer
12k views

How do you say Happy New Year with LaTeX?

Title says it all. How do you wish "Happy New Year" to a TeXie? Compile the code below with pdfLaTeX, view it with "PDF Reader" or "Adobe Acrobat Pro" and press the "Happy New Year" button on the ...
Yiannis Lazarides's user avatar
18 votes
1 answer
2k views

Beamer and JavaScript in a web browser

I have written a talk in Beamer and to illustrate one of my points I've written a program in JavaScript (well actually Processing). You can view it here (it seems to run ok in Chrome and Firefox, and ...
James's user avatar
  • 281
15 votes
2 answers
5k views

What is the best way to insert document-level JavaScript in LaTeX documents

I have been toying with the idea of converting some forms at work to interactive forms. I have tried some of the routines that come with insdljs, but they seem a bit dated. The idea is very attractive....
Yiannis Lazarides's user avatar
14 votes
2 answers
1k views

Insert web content dynamically (Javascript?)

This year in my field we have a large conference overlapping with the European soccer championship. Luckily my talk does not overlap with any match, but in case it will happen in the future I was ...
Federico Poloni's user avatar
14 votes
1 answer
11k views

hyperref: how to format text in a forms text-field

I would like to pre-format the text in a form text-field, e.g. make it bold, italic or use a specific font. The following code generates a simple text-field: \documentclass{scrreprt} \usepackage{...
Rainer's user avatar
  • 358
13 votes
2 answers
7k views

Example of Javascript form within pdflatex

Can someone please show me an example of how to include a simple Javascript form within a pdflatex document? Can someone please show me an example of accessing and modifying the PDF file's DOM from ...
Mayer Goldberg's user avatar
13 votes
1 answer
2k views

Forming a "spoiler text" environment in LaTeX (via Javascript?)

I've been writing a mathematical text for some time, and seeing as it is the 21st century, I would like this text to be interactive and dynamic, probably in PDF format. The main function that I am ...
Christopher A. Wong's user avatar
12 votes
2 answers
971 views

How to create PSTricks animations on the web page with interactive control panels?

I just visited a cool site that showing PSTricks animations with interactive control panels. For more details, please visit this link (click). The question is how does the owner of the site make the ...
kiss my armpit's user avatar
11 votes
1 answer
4k views

JavaScript library for producing TiKZ-like diagrams?

I can use mathjax for equations and symbols generally, but what about diagrams? Mathjax doesn't support TiKZ, so I'm looking for a JavaScript library which can be used in place of TiKZ. So far ...
Alasdair's user avatar
  • 5,119
10 votes
1 answer
6k views

Is it possible to embed a scrollable frame inside a PDF?

(This is an end-of-year crazy question) Is it possible to embed a (scrollable) frame or a PDF inside a PDF? If so, how to do it in (pdf)LaTeX? This is something pretty common in HTML (see for ...
alfC's user avatar
  • 14.1k
10 votes
2 answers
2k views

Would it be possibile to advance Beamer at the level of the HTML presentations?

I use mostly Reveal.js for my presentations and lately I learned Beamer. As far as I see you can reproduce almost anything from a HTML pres. in Beamer with a little work, except for the animations/...
EdTeX's user avatar
  • 173
9 votes
1 answer
7k views

Hello World in pdfLaTeX

After many years being silent, TeX can now talk! Almost minimal code below! It should be of particular interest to Physicists and Cosmologists. Need to have Adobe Reader installed. \documentclass{...
Yiannis Lazarides's user avatar
9 votes
2 answers
5k views

texlive.js possible?

I just found about emscripten, texlive.js is it really a converted version of texlive in JavaScript or a server as Scribtex and many others? Is this really possible?
La Raison's user avatar
  • 560
9 votes
1 answer
335 views

Alternative text for Javascript (form) boxes for viewers that don't support Javascript?

I am using the tdclock package to display the current date and time. In looks pretty good in Acrobat, but in other viewers (like Evince) it looks terrible because they don't support Javascripts and ...
alfC's user avatar
  • 14.1k
8 votes
1 answer
2k views

Hide LaTeX parts through JavaScript

I'm creating an interactive pdf form with the hyperref package. The form is quite comprehensive, so the current goal is to only show parts that are relevant to the specific user. For example, the user ...
igorr02's user avatar
  • 131
7 votes
1 answer
2k views

(La)TeX Web browser [closed]

I had an idea this morning and would like to share and to know if someone has already developed it somewhere! A Mozilla group is currently building a JavaScript Application able to transform any PDF ...
user1004847's user avatar
7 votes
1 answer
3k views

Javascript application in latex

I would like to know if it is possible to add an interactive app created with Javascript to a Latex document. I would like to add some of the Javascripts that appear here. Like that one: EDIT I ...
idriskameni's user avatar
6 votes
2 answers
2k views

How to check if a string is a valid LaTex rule?

I am using MathQuill lib for the formula input and trying to restrict a number of operations. Is there any way I can differentiate between a string and a LaTex rule? For example: def check('\sum') =&...
exp's user avatar
  • 63
6 votes
2 answers
2k views

timeline and animate package

I'm trying to make some pdf with animate package controlling a loop with the timeline. The purpose is to have a loop but reaching the last frame, the color of the dot should change. My main questions ...
PCar's user avatar
  • 113
6 votes
1 answer
1k views

Inject JavaScript with pdflatex etc. for page level events

I am experimenting a little bit with JavaScript in PDF documents generated via pdflatex. I wonder, whether there is a method to access the event handler of Adobe Acrobat or Acrobat Reader in order to ...
user avatar
5 votes
1 answer
4k views

Two column layout with form

So here is the basic idea: 2 column Layout, 1 column with text and 1 column with a form you can fill in Acrobat Reader etc. I tried to use parallel and/or paracol package along with the hyperref \...
zwck's user avatar
  • 51
5 votes
1 answer
161 views

Key Listener to Show/Hide TikZ-Comments & Text Highlighting in PDF Output

While working on curating my lecture notes with LaTeX, I've come across a dilemma:             readability and aesthetics VS. rigor and ...
steve's user avatar
  • 2,050
5 votes
2 answers
2k views

Is there any solution to include Java Applets in presentations/beamers?

I am preparing a presentation on the compiler Texmaker "documentclass" in "beamer". I was fascinated with the package "multimedia" which is a solution to include movies in the presentation. Question: ...
MathOverview's user avatar
  • 2,779
5 votes
1 answer
3k views

How do I place a simple javascript in the resulting PDF?

I would like to use LaTeX to produce a PDF document with forms with the following features: -One or two user-modifiable text fields -One output text field -A "run" button that, when pressed, will take ...
Yitzhak Kornbluth's user avatar
4 votes
1 answer
784 views

Including Javascript to flatten PDF form made in latex

The goal of this is to simplify a process at my work. Any advice would be very much appreciated. This is what we have been doing Using Latex I create a pdf and send it to person 2. Person 2 emails ...
swoop dewoop zoom's user avatar
4 votes
1 answer
1k views

\pushbuttons with Icons with pdflatex (xobject reference)

I would like to create a pushbutton with icons instead of text. Like the text in the example below the icons should change with the mouse options. The manual of the eforms package (eformman.pdf) ...
Ulrike Fischer's user avatar
4 votes
1 answer
1k views

LaTeX 3D PDF with U3D file and media9: add a view at runtime

I am wondering if I could hack media9 package to achieve such a feature: end-users should be able to add a new view of an animated U3D file at runtime. So I'll be editing the VIEWS FILE from a ...
Bilbo's user avatar
  • 41
4 votes
0 answers
724 views

How to get and process bitmap graphics at a pixel level on-the-fly?

We are trying to solve How to get intersection point(s) of two glyphs? and there are some interesting subtasks. In word cloud algorithms they are converting glyphs (a vector form) to a raster form and ...
Malipivo's user avatar
  • 13.3k
4 votes
0 answers
1k views

Latex forms, MakeTextField, LayoutTextField and javascript questions

I trying to do underlined TextField with label under the field (hyperref package). using Underlined text field in a fillable form i tried to renew MakeTextField: \renewcommand{\MakeTextField}[2]{{\...
Drak_kin's user avatar
3 votes
2 answers
729 views

Can you influence any PDF element using JavaScript?

Using the package insDLJS, one can add JavaScript to PDF's generated by LaTeX. To reference a specific element, one can use this.getField("myElementName"). Can I give any element in LaTeX a field name?...
LBogaardt's user avatar
  • 385
3 votes
1 answer
1k views

Compiling my own mktexfmt

I'm trying to compile my own version of pdftex which works fine. However, I must compile my own format file (fmt) for that. This should be done with mktexfmt. My problem is that I don't know where to ...
user24070's user avatar
3 votes
1 answer
721 views

Is it possible to generate random numbers dynamically with javascript on a PDF?

PDFs can be used to manage javascript, such as the packages ocgtools, ocg-p, ocgx or ocgx2, which allow you to create interactive and clickable PDFs. The hyperref package allows you to insert URLs or ...
AndréC's user avatar
  • 23.5k
3 votes
1 answer
269 views

Is TeXMaker capable of using a .js script made to work for TeXWorks? If not, how do I go about turning a .js into a .tms?

I'm trying to do the following: LaTeX -> (text selected, keyboard shortcut pressed) -> \hyperref[LaTeX]{LaTeX} I can't use user tags for this because it can't use selection twice, only once. I ...
Robo's user avatar
  • 71
3 votes
2 answers
364 views

Texstudio script for deleting $ $

I was wondering how can create a texstudio script for removing the $ $ notation. what is the problem of following code. %SCRIPT txt = cursor.selectedText() txt.replace("$","") editor.write(txt) ...
Hamid's user avatar
  • 1,064
3 votes
2 answers
2k views

Include live remote image in Beamer presentation

From this question, I see that it is possible to include remote images within a PDF, via the media9 package. Can direct inclusion of Javascript--as in this question--be used to update the image (...
kyle's user avatar
  • 449
3 votes
1 answer
259 views

TeXstudio readAllStandardOutputStr seems not to work

I try to insert automatic timestamps into a LaTeX file, to get id's for some items On a windows machine I have got the following macro (JavaScript): %SCRIPT var res=system("c:\\cygwin\\bin\\...
Ulrich Hauser-Ehninger's user avatar
3 votes
1 answer
1k views

How can I make toggle buttons with images using pdflatex?

I am currently designing an interactive PDF by means of the media9 package in Latex. I have three \mediabutton buttons that I would like to treat as toggle buttons. A picture of the buttons is shown ...
Wynand Winterbach's user avatar
3 votes
1 answer
191 views

Can we have viewer specific text in a pdf generated by pdfLaTex?

I am wondering if we could have a pdf file, which can tell what viewer its being viewed with. I was looking for some tex command, which says something like: If viewer is Acrobat, print "Hi You are ...
Pavithran Iyer's user avatar
3 votes
1 answer
286 views

Interactive formula using hyperref

I trying to make a digital roleplaying player sheet using Overleaf that I wish to have fillable boxes where the values in them will be extracted and used in some formulas. For example I would want to ...
RV307's user avatar
  • 33
3 votes
1 answer
268 views

Can we animate in LaTeX without precompiling every frame, i.e. simulate?

The animate package is great for simple animations, but it has the drawback that every frame of the animation has to be created during compilation. For animations with a simple dynamic but a long loop ...
schtandard's user avatar
  • 13.9k
3 votes
1 answer
207 views

Set precise time on a video using javascript

Hi i'm trying to get a button to set the video time a precise point. The code listed below is what i've made up till now but its not working. i think because it cant get the document.getElementById. ...
Massimiliano's user avatar
3 votes
1 answer
847 views

Change Picture with Javascript

since months i cant find a way to change pictures by pressing a button in one field. With a text is is like: \documentclass[a4paper]{article} \usepackage{eforms} \begin{insDLJS}[test]{test}{...
Guest's user avatar
  • 31
3 votes
1 answer
3k views

Is there a way to properly display JSX in LaTeX?

I have this simple example of jsx code. How can I change the settings so that the indention of the code snippet gets right? Btw in case somebody has a decent link or example of listings which support ...
thiloilg's user avatar
  • 133