How to change fontsize of \namesection in latex? - text

In code bellow:
\namesection{}{John Doe}{
\urlstyle{same}
\href{mailto:john.doe#gmail.com}{john.doe\char`#gmail.com} | 666 666 666\\
\href{https://github.com/johndoe}{github.com/johndoe}
}
I would like to make "John Doe" smaller. Unfortunately I only found the way to make all fonts in \namesection smaller, not the "John Doe" string only.

Ok I've found it!
% Name command
\newcommand{\namesection}[3]{
\centering{
\fontsize{20pt}{30pt}
line 42 in .cls file.

Related

Escape characters in .csv for Azure Synapse seems to dissapear?

I have .csv file that looks like this:
"ID", "Name", "Extra Info"
"1", "John", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
"2", "Adam", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
I'm trying to load this file using this code in Synapse:
SELECT
TOP 2 *
FROM
OPENROWSET(
BULK 'https://[MY STORAGE ACCOUNT].dfs.core.windows.net/[FILE PATH]/[...]/*.csv',
FORMAT = 'CSV',
        PARSER_VERSION = '2.0'
)
AS [result]
Expecting this result:
ID
Name
Extra Info
1
John
{"Event": "Click", "Button Name": "Accept"}
2
Adam
{"Event": "Click", "Button Name": "Accept"}
But I keep getting this error:
Error handling external file: 'Unexpected token 'Event\' at [byte: XXX].
Expecting tokens ',', ' ', or '"'. '.
File/External table name: 'https://[MY STORAGE ACCOUNT].dfs.core.windows.net/[FILE PATH]/[...]/[SPECIFIC FILE NAME].csv'.
It looks like it's ignoring the first quote (") and Escape character in the Extra Info column? Leading to it think that \Event\ is some special token?
I just don't understand why or what I can do to fix this?
I think I found the answer based on this post and some of the Azure documentation:
How Field Quote works: Is my understanding of how FIELDQUOTE works correct?
Escaping Quotes in the Azure Documentation: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-single-csv-file#escape-quoting-characters
It seems that the only valid way to escape Quotes is by using double quotes.
This means my .csv should be formatted like this:
"ID", "Name", "Extra Info"
"1", "John", "{""Event"": ""Click"", ""Button Name"": ""Accept""}
"2", "Adam", "{""Event"": ""Click"", ""Button Name"": ""Accept""}
Instead of the original (which uses ):
"ID", "Name", "Extra Info"
"1", "John", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
"2", "Adam", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
Unfortunately I don't see a way around this other than BULK editing all my .csv files...

Parsing text in dictionary

I have a dictionary which has following text:
{
"body": "Customer: \"I have a big problem. You cut off my head!\"\r\n\r\nMe: \"I'm sorry? How did I cut off your head?\"\r\n\r\n(The customer shows me an obviously self-taken picture, with the top of his head removed.)\r\n\r\nMe: \"Sir, it looks like it was taken that way.\"\r\n\r\nCustomer: \"No it wasn't! My whole head was there when I took it. I'm sure!\"\r\n\r\nMe: \"Okay, let me see your memory card...\"\r\n\r\n(The customer hands it to me, and I go in the lab and pull it up on the computer. Sure enough, he chopped his own head off in the picture.)\r\n\r\nMe: \"Sir, that is the whole image, and the top of your head isn't in it.\"\r\n\r\nCustomer: \"But it's DIGITAL, can't you fix it?\"\r\n\r\nMe: \"You can't create something from nothing.\"\r\n\r\nCustomer: \"But... but... but... I need a photo for a dating website!\"\r\n\r\nMe: \"Give me the camera and go stand over there.\"\r\n\r\nCustomer: *excited* \"Hot d***! You can be my best man!\"\r\n\r\nMe: \"A thank you card will be enough.\"\r\n\r\n(Skip ahead 9 months...)\r\n\r\nFemale customer: \"Is your name ***?\"\r\n\r\nMe: \"Yes, can I help you?\"\r\n\r\nFemale customer: \"My husband wanted you to have this.\" *hands me an envelope*\r\n\r\n(I open the envelope, and sure enough there's a thank you card with a picture of him and his wife. He actually got married and sent her in with the card!)",
"category": "Men / Women",
"id": 18189,
"title": "A Heady Proposition"
},
But I am not sure at all how to parse the text for body so that I can get a readable text from above.
I am looking for a general solution instead of parsing based on keywords like Customer and Me
The text should look as following image:
You can split by the delimiter pattern \r\n\r\n+
Using the re and pprint modules:
pprint(re.split('\r\n\r\n+',your_dict['base']))
generates:
['Customer: "I have a big problem. You cut off my head!"',
'Me: "I\'m sorry? How did I cut off your head?"',
'(The customer shows me an obviously self-taken picture, with the top of his '
'head removed.)',
'Me: "Sir, it looks like it was taken that way."',
'Customer: "No it wasn\'t! My whole head was there when I took it. I\'m '
'sure!"',
'Me: "Okay, let me see your memory card..."',
'(The customer hands it to me, and I go in the lab and pull it up on the '
'computer. Sure enough, he chopped his own head off in the picture.)',
'Me: "Sir, that is the whole image, and the top of your head isn\'t in it."',
'Customer: "But it\'s DIGITAL, can\'t you fix it?"',
'Me: "You can\'t create something from nothing."',
'Customer: "But... but... but... I need a photo for a dating website!"',
'Me: "Give me the camera and go stand over there."',
'Customer: *excited* "Hot d***! You can be my best man!"',
'Me: "A thank you card will be enough."',
'(Skip ahead 9 months...)',
'Female customer: "Is your name ***?"',
'Me: "Yes, can I help you?"',
'Female customer: "My husband wanted you to have this." *hands me an '
'envelope*',
"(I open the envelope, and sure enough there's a thank you card with a "
'picture of him and his wife. He actually got married and sent her in with '
'the card!)']
You can now print this array line by line to a PDF using the module pyPdf, with a nice font of your choice - achieving the look above +-.
You'll need to add further code to add some formatting, such as the italics above; e.g.:
Anything before a : should be bolded, and any line holding )( should be italicized.

Vim, practical usage example

While I mostly use Sublime Text (with the Vintageous plugin) I'm trying to adopt Vim-style practices into my workflow. As you might expect, I'd like to learn how to more quickly jump around a document to edit its content.
For example, let's say I want to jump around and edit the ID values in a JSON file or perhaps jump from the first line of the document down to edit the first name of Gale Gomez.
I understand some of the basic commands like 'change inside quotes' (ci") or 'change word' (cw), I'm hoping to get better at page navigation.
Thoughts or suggestions?
{
"id": 5,
"firstName": "Jayne",
"lasttName": "Norris",
"email": "jaynenorris#talae.com"
},
{
"id": 6,
"firstName": "Gale",
"lasttName": "Gomez",
"email": "galegomez#talae.com"
},
{
"id": 7,
"firstName": "Garner",
"lasttName": "Crane",
"email": "garnercrane#talae.com"
},
{
"id": 7,
"firstName": "Gill",
"lasttName": "Carter",
"email": "gillcarter#talae.com"
},
{
"id": 8,
"firstName": "Evans",
"lasttName": "Douglas",
"email": "evansdouglas#talae.com"
}
To jump to the next ID and edit it:
/"id<return>3wcw
(searches for string "id, goes forward 3 words, then edits the next word, which is the ID's value)
To edit another ID:
n3wcw
(repeats the last search with “n”, then same as before)
Go to the first line of the document:
gg
Change first name of Gale Gomez:
/Gale<return>cw
(searches for “Gale”, then edits it)
And don't forget * to search the word under the cursor (for example id in your case), then n for next occurrence, N for previous occurrence.
# is the same as *, only it searches backward. Actually, I never use that.
If you press / and then <UP> and <DOWN>, then <CR>, you can select and repeat one of your previous searches.
And sometimes when a search hits the last line of the window you may wish to type zz to scroll the window so that the current line will be in the middle of it and you will see some lines below.
Also, you can press % while over an opening/closing parenthesis to jump to the corresponding closing/opening parenthesis.

What is different about these two pairs of strings that makes this sed script with one and not the other?

This question is related to this other question I asked earlier today:
Find and replace text with all-inclusive wild card
I have a text file like this
I want= to keep this
This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1 WebServices and some more "text" that" should "</be> </deleted>
<this is stuff in tags I want=to begone> and other text I want gone too. </this is stuff in tags I want to begone>
A novice programmer walked into a "BAR2" descript keepthis
and this even more text, let's keep it
<I actually want this>
and this= too.`
when I use sed -f script.sed file.txt to run this script:
# Check for "aff"
/\baff\b/ {
# Define a label "a"
:a
# If the line does not contain "desc"
/\bdesc\b/!{
# Get the next line of input and append
# it to the pattern buffer
N
# Branch back to label "a"
ba
}
# Replace everything between aff and desc
s/\(\baff\)\b.*\b\(desc\b\)/\1TEST DATA\2/
}
I get this as my output:
I want= to keep this
This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1 WebServices and some more "text" that" should "</be> </deleted>
<this is stuff in tags I want=to begone> and other text I want gone too. </this is stuff in tags I want to begone>
A novice programmer walked into a "BAR2" descript keepthis
and this even more text, let's keep it
<I actually want this>
and this= too.
However, by simply changing the search strings from aff and desc to FOO1 and BAR2:
# Check for "FOO1"
/\bFOO1\b/ {
# Define a label "a"
:a
# If the line does not contain "BAR2"
/\bBAR2\b/!{
# Get the next line of input and append
# it to the pattern buffer
N
# Branch back to label "a"
ba
}
# Replace everything between FOO1 and BAR2
s/\(\bFOO1\)\b.*\b\(BAR2\b\)/\1TEST DATA\2/
}
gives the expected output:
I want= to keep this
This is some <text> I want to keep <and "something" in tags that I" want to keep> aff FOO1TEST DATABAR2" descript keepthis
and this even more text, let's keep it
<I actually want this>
and this= too.`
I am completely stumped about what is going on here. Why should searching between FOO1 and BAR2 work differently from the exact same script with aff and desc?
The end marker should be \bdesc instead of \bdesc\b.
Note the \b in the pattern, it matches a word boundary. Your above text contains the word description, but not desc.
Your previous question made me assume that you want that. If you don't care about word boundaries, remove the \b escape sequences completely.

Importing String with variables from Txt file

I need to import text from txt file with some variables. I use BufferedReader and File Reader. In code I have :
String car = "vw golf";
String color = "nice sunny blue color";
And in my txt file:
I have nice " +car+ " which has "+color+".
My expected output :
I have nice vw golf which has nice sunny blue color.
My actual output is :
I have nice " +car+ " which has "+color+".
If I've understood correctly, what you want to do is replace " + car + " with the value of your car string and likewise for colour. You've tried to do this by writing your text file as if it were a command to be evaluated. However, that won't happen - it will just be outputted as is. I'm going to assume you are using c#. What you need to do is, prior to outputting your string, parse it to replace the markers with the variables. I would recommend you get rid of the double quotes in your text file. You could then do something like this:
string text = this.ReadTextFromFile();
string ammended = text.Replace("+car+", car);
As mentioned, this is assuming you remove the double quotes from your text file so it reads:
I have nice +car+ which has +color+.
Also, you don't need to use the + symbols, but I suppose they are a good way of designating a unique token to be replaced. You could use {car} in the file and then likewise in the Replace startment, for example.
I may not have properly understood what you wanted to do, of course!
Edit: Incase of confustion,
this.ReadTextFile();
was just a short hand way of saying that the text variable contains the contents as read from your text file.

Resources