How to print % symbol in receipt from raw text in ESC POS? - printing

Please, I need help. What is the right command in ESC POS so I can print the % symbol in my receipt? I used raw text for my receipt, but when I write the % symbol, for example, Standard Tax 6%, instead of printing Tax 6%, it printed Tax 60... Please help me.

Ok, I figured it out. I'm using printf in Linux terminal to type the command and the text for my receipt. I just add \x25, where 25 is the hexadecimal for % symbol in Ascii Table. Simple things, but I took some time to figure it out, as I'm a beginner and not-so-good in understanding English, can I say that, hee. I hope this will help someone out there later on that might in the same situation in writing raw text and command in ESC POS.

Related

How can convert Maple formula to Mathtype format

as you know when working with Maple each equation you typed with maple format will be seen like as mathtype after calculation with default blue font, for example you type QK:=Matrix(3,3,[Q[1,1],Q[1,2],0,Q[2,1],Q[2,2],0,0,0,Q[3,3]]); and you see this in the matrix format with subscript of each member of matrix. If you want to send this output to MS word software you got the picture of equation that can not edited or formatted like as mathtype formulation.
the question is how can I convert Maple output calculation to mathtype format?
I have found MathML formulation editor but when copy maple output on it, it can show formulation only in the plain text format that can not calculate or convert to the mathtype format.
Thanks, find it!
at the first step right click on Maple output and select special copy and select copy as MathMl and paste it on the Formulator editor. at the second step copy the available formula in the Formulator and paste it on the Mathtype. the result was excellent for formula that dont have any Greek character, but if Greek character is available in the output formula, the result in the Formulator substitute this character with english spell with & sign at first and ; sing at the end. I want to find solution for this problem as example β change to &betta;
It seems you have discovered the answer that we (Design Science) have on our website: http://www.dessci.com/en/support/mathtype/works_with.asp#!target=maple. One issue with Maple's MathML when pasted into MathType is the attributes it adds to the markup. For example, this is the MathML output from Maple for the variable x:
<mi mathcolor='#0000ff' color='#0000ff' fontstyle='2D Output' fontweight='normal'>x</mi>
Those 4 attributes help to replicate the look of the math as displayed in Maple, but they're unnecessary in MathType and most anywhere else you may paste the MathML. It doesn't take long before all these attributes contribute so much overhead that MathType simply can't handle it. (MathType thinks it's taking so long to interpret the MathML that surely it's in an infinite loop -- and gives an error.)
The problem with the Greek letters from Maple is that what should be a single character ampersand – & – comes out in the MathML markup as the entity for ampersand: &. It would be great if MathType could just look at that and think "Hmm. Ok, I'm pretty sure Maple meant just &, so I'll assume that." But it doesn't.
Let M be maple form. For finding latex form you can use this commend:
latex(M)

ASCII Representation of Hexadecimal

I have a string that, by using string.format("%02X", char), I've received the following:
74657874000000EDD37001000300
In the end, I'd like that string to look like the following:
t e x t NUL NUL NUL í Ó p SOH NUL ETX NUL (spaces are there just for clarification of characters desired in example).
I've tried to use \x..(hex#), string.char(0x..(hex#)) (where (hex#) is alphanumeric representation of my desired character) and I am still having issues with getting the result I'm looking for. After reading another thread about this topic: what is the way to represent a unichar in lua and the links provided in the answers, I am not fully understanding what I need to do in my final code that is acceptable for this to work.
I'm looking for some help in better understanding an approach that would help me to achieve my desired result provided below.
ETA:
Well I thought that I had fixed it with the following code:
function hexToAscii(input)
local convString = ""
for char in input:gmatch("(..)") do
convString = convString..(string.char("0x"..char))
end
return convString
end
It appeared to work, but didnt think about characters above 127. Rookie mistake. Now I'm unsure how I can get the additional characters up to 256 display their ASCII values.
I did the following to check since I couldn't truly "see" them in the file.
function asciiSub(input)
input = input:gsub(string.char(0x00), "<NUL>") -- suggested by a coworker
print(input)
end
I did a few gsub strings to substitute in other characters and my file comes back with the replacement strings. But when I ran into characters in the extended ASCII table, it got all forgotten.
Can anyone assist me in understanding a fix or new approach to this problem? As I've stated before, I read other topics on this and am still confused as to the best approach towards this issue.
The simple way to transform a base16-encoded string is just to
function unhex( input )
return (input:gsub( "..", function(c)
return string.char( tonumber( c, 16 ) )
end))
end
This is basically what you have, just a bit cleaner. (There's no need to say "(..)", ".." is enough – if you specify no captures, you'll automatically get the whole match. And while it might work if you write string.char( "0x"..c ), it's just evil – you concatenate lots of strings and then trigger the automatic conversion to numbers. Much better to just specify the base when explicitly converting.)
The resulting string should be exactly what went into the hex-dumper, no matter the encoding.
If you cannot correctly display the result, your viewer will also be unable to display the original input. If you used different viewers for the original input and the resulting output (e.g. a text editor and a terminal), try writing the output to a file instead and looking at it with the same viewer you used for the original input, then the two should be exactly the same.
Getting viewers that assume different encodings (e.g. one of the "old" 8-bit code pages or one of the many versions of Unicode) to display the same thing will require conversion between different formats, which tends to be quite complicated or even impossible. As you did not mention what encodings are involved (nor any other information like OS or programs used that might hint at the likely encodings), this could be just about anything, so it's impossible to say anything more specific on that.
You actually have a couple of problems:
First, make sure you know the meaning of the term character encoding, and that you know the difference between characters and bytes. A popular post on the topic is The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Then, what encoding was used for the bytes you just received? You need to know this, otherwise you don't know what byte 234 means. For example it could be ISO-8859-1, in which case it is U+00EA, the character ê.
The characters 0 to 31 are control characters (eg. 0 is NUL). Use a lookup table for these.
Then, displaying the characters on the terminal is the hard part. There is no platform-independent way to display ê on the terminal. It may well be impossible with the standard print function. If you can't figure this step out you can search for a question dealing specifically with how to print Unicode text from Lua.

How to display a character in the wrong characterset

How can I output whatever æ would be, if ø = ø?
I'm guessing the left side is unicode and the right side is something else, for example iso-8859-1, but how can I print out what a unicode character would be when messed up?
Backstory: I have a bit of a strange problem here with Steam messing up character encodings. Trying to help a friend recover their account and I think they have used the letter æ in their secret answer. The dialog for resetting the password doesn't accept that letter, and it says the answer is wrong if we try natural alternatives. In the recovery email I get, the letter ø shows up as ø in the secret question. So, I'm thinking perhaps when the answer and question was created, the letter æ was accepted, but messed up. Figured I could try to use the messed up equivalent, but don't know what that would be, and my programming skills fails me in finding it myself :p
In Python, you can encode the string to a byte-string in UTF-8, and then convert the byte-string to a (text) string using iso-8859-1. The result will be the desired mojibake.
In Python 3:
>>> 'æ'
'æ'
>>> 'æ'.encode('utf8')
b'\xc3\xa6'
>>> 'æ'.encode('utf8').decode('iso-8859-1')
'æ'
In Python 2, use u'æ' instead of 'æ'.

LaTeX: Extract numbers and letters from command variables and conversion to roman numerals

I'm writing a thesis and have been searching on many occasions trying to find a solution to my programming problem. Basically, I have a series of items that I've distinguished in my research data as "A1", "A2", "A3", … , "A13", "B1", B2", and so on. These data labels, by the way, I can't change now because it's been used throughout my thesis. They are always formatted as [caps-letter][digit(length of 1 to 2 chars)], e.g., X20 or L9. For each data item, I want to assign a specific name. Because LaTeX doesn't allow numbers in the command, I have already created a LONG list of the following types of commands to assign names to each data label:
\newcommand{\DataNameAi}[]%
{Data name for A1}
\newcommand{\DataNameAii}[]%
{Data name for A2}
% …
\newcommand{\DataNameXxi}[]%
{Data name for X11}
% …
and so on. Basically, as you can see I've named the command as "\DataName" followed by the letter (in caps), followed by the number written out as roman numerals. This was all manually done, and I did this only because LaTeX didn't seem to like any arabic numbers in the command name. If it permitted this, I would have used \DataNameA1 etc.
Elsewhere, I also have a command to reference the data specifically:
\newcommand{\GotoData}[1]%
{\hyperref[data#1]{Data~#1}}
See data at \Gotodata{E10} % this links to another location labelled \label{dataE10}
Now, I want to now assign a latex command that can take just one variable, the data label (whether it's "Q30" and "A3"), and use the \GotoData command as well as bring up the corresponding data name in the \DataName*** command. That is, type \CompleteData{E10}, for example, and then have LaTeX load something like:
"This is [Data E10] named [Data name for E10]."
This means the command might look something like:
\newcommand{\CompleteData}[1]%
{This is [\GotoData{#1}] named [\DataNameEx].}
\CompleteData{E10} % <--- this should look like "This is [Data E10] named [Data name for E10]."
As you can see, the code above is incomplete: I'm stuck with how to use the #1 variable to generate the necessary \DataName*** command within the \CompleteData newcommand.
So very basically, I see the only way as achieving this result is to have the code extract and convert the last number (one to two digits long) into a roman numeral. Specifically, I've been trying to figure out how to do a few things:
how to extract just the digits from the end of a parameter in a newcommand (such as the digits in my "Q31" or "A1" parameters).
similarly extract the letter from the first character of the parameter
how to convert numbers to numerals
I've tried searching in many different ways but never seem to find what I need to answer these two questions … I thought I was close when I found this site but later realised it's not what I'm after. The etextools LaTeX package also looked promising but I'm too novice (not even a programmer) to make much sense out of the help PDF that comes with my TexLive (2010) installation. I've also read about \roman and \romannumeral (e.g., here) but those two commands cause errors when I compile for some reason. On my computer, \roman{2} becomes "roman" while \romannumeral{2} becomes "2". Just don't understand how they work.
Any guidance, demonstration code, or hints would be greatly appreciated! Thank you.
Here's an example that works for me:
\documentclass{article}
\usepackage{hyperref}
\newcommand{\DataNameAii}{Data name for A2}
\newcommand{\GotoData}[1]{\hyperref[data#1]{Data~#1}}
\newcommand{\CompleteData}[1]{This is [\GotoData{#1}] named [\FormatDataName#1$].}
\newcounter{DataNumber}
\def\FormatDataName#1#2${\setcounter{DataNumber}{#2}\csname DataName#1\roman{DataNumber}\endcsname}
\begin{document}
\section{Data A2}\label{dataA2}
\CompleteData{A2}
\end{document}
\FormaDataName extracts the first character into #1, and the number into #2. It does that using the fact that \FormatDataName takes a delimited argument (delimited by a final $). After that, it's just a case of constructing the macro name you want to call (using \csname), and using \roman to format the number as roman numerals. (I think the reason you couldn't get this to work is because you weren't passing \roman a counter).

Special characters in LaTeX table caption

When I include \overline{x} or other special characters in the caption text of a table, the whole caption text won't appear at all. When I put simple text without special characters, the caption works fine. How can I include special characters in the caption?
Are you putting $ around the maths? I.e.:
\caption{This is a caption with maths $\overline{x}$ in it.}
Apparently your real problem was that TeX's fancy error correction mechanism prevented you from knowing that there was a syntax error in the document. Back in 1982 or so, running TeX on a long document would take so much time that Knuth didn't want TeX to just quit when it ran into an error. Instead, TeX tries to guess what you meant and go on typesetting the document, so that you can fix a bunch of errors before you run it again; for example, when it spots a math-mode command outside math mode, it assumes that you forgot a dollar sign and inserts it. No automatic error-correction mechanism is perfect, so syntax errors often cause some part of text to be lost, or typeset in a wrong way.
TeX does try to tell you that it has found errors, but I suppose current IDEs make it easy to ignore the output. Try running latex on the document from the command line and pay attention to what it says. For example, the short document
\documentclass{article}
\begin{document}
It seems \sqrt{2} I forgot some dollar signs.
\end{document}
causes TeX to prompt you with
! Missing $ inserted.
<inserted text>
$
l.3 It seems \sqrt{
2} I forgot some dollar signs.
?
The 2009 way of dealing with this is to type X to quit, fix the source document, and run latex again - but you can actually enter other commands at the prompt to edit the input that TeX sees. If you just type Q (to run quietly - same as specifying \batchmode, which Emacs or whatever IDE you are using probably does for you) you get a typeset document as a result, and it might not be obvious that there are in fact syntax errors in it.
If you looking for how to insert any special character in Latex in a table then this may help you. Check this out...
\documentclass{article}
\begin{document}
\begin{tabular}{|l|r|r|}
Item & Quality & Price(\$)\\
Nails & 500 & 34\\
Wooden boards & 100 & 4\\
Bricks & 240 & 11\\
\end{tabular}
\end{document}

Resources