I am trying to put the following script in a table all in one box with two columns, i need help to identify what are the special symbols in this coding:
var date=new Date(); //variable is set for date
var dayweek=date.getDay(); //variable day of the week is set for day
var dayweek_str:String; //variable day of the week is formatted as characters
var year=date.getFullYear(); //year will be displayed
var month=date.getMonth(); //variable is set for the month
var month_str:String; //variable month is formatted as characters
var days=date.getDate(); //variable is set for day
var days_str:String; //variable day is formatted as characters
switch (month){ //this section will declare a case value to correspond to a given month
case(0):month_str="January"; break;
case(1):month_str="February"; break;
case(2):month_str="March"; break;
case(3):month_str="April"; break;
case(4):month_str="May"; break;
case(5):month_str="June"; break;
case(6):month_str="July"; break;
case(7):month_str="August"; break;
case(8):month_str="September"; break;
case(9):month_str="Octomber"; break;
case(10):month_str="November"; break;
case(11):month_str="December"; break; }
if (days<10){ //this will read the current case value of the system date which will match a given month
days_str="0"+days;
}else{
days_str=days; }
switch (dayweek){ //this section will declare a case value to correspond to a given day of the week
case(0):dayweek_str="Sunday"; break;
case(1):dayweek_str="Monday"; break;
case(2):dayweek_str="Tuesday"; break;
case(3):dayweek_str="Wednesday "; break;
case(4):dayweek_str="Thursday"; break;
case(5):dayweek_str="Friday "; break;
case(6):dayweek_str="Saturday"; break; }
date_txt.text=dayweek_str+" "+days_str+" "+month_str+" "+year; //full date will be displayed as day date month year
Please can anybody help?
General ⇒ Special symbols in latex
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Special symbols in latex
Hi,
you could also just use a verbatim environment, for example:
But this could be more difficult when you want to use it inside tables for example. But there are packages like examplep that can handle this.
Stefan
you could also just use a verbatim environment, for example:
Code: Select all
\documentclass[a4paper,10pt]{article}
\begin{document}
{\footnotesize
\begin{verbatim}
var date=new Date(); //variable is set for date
var dayweek=date.getDay(); //variable day of the week is set for day
var dayweek_str:String; //variable day of the week is formatted as characters
var year=date.getFullYear(); //year will be displayed
var month=date.getMonth(); //variable is set for the month
var month_str:String; //variable month is formatted as characters
var days=date.getDate(); //variable is set for day
var days_str:String; //variable day is formatted as characters
switch (month){ //this section will declare a case value to correspond to a given month
case(0):month_str="January"; break;
\end{verbatim}
}
\end{document}
Stefan
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Special symbols in latex
Is that code of a specific programming language? If so, take a look a the listings package. It lets you format code in several predefined programming languages.ma501th wrote:I am trying to put the following script in a table all in one box with two columns, i need help to identify what are the special symbols in this coding:
[...]
Please can anybody help?
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Special symbols in latex
As I mentioned in my first answer and Thorsten recommended too: the listings package is very useful! Depending on what you are going to do, it may save you a lot of time.
If you want to look at the possibilities: Here is the user's guide.
Stefan
If you want to look at the possibilities: Here is the user's guide.
Stefan